ApiGen.Cli
1.0.0
dotnet tool install --global ApiGen.Cli --version 1.0.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local ApiGen.Cli --version 1.0.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ApiGen.Cli&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package ApiGen.Cli --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
🚀 api_gen - Enterprise .NET Web API Code Generation & Architecture Engine
Automated C# .NET 8/9 Web API Scaffolding Engine from SQL Server & PostgreSQL with AI DB Engineer, Persistent Architecture Memory, and Interactive Lazy Terminal UI.
🌟 1. Core System Features
- ⚡ CRUD & Customized API Generator:
- Automatically scaffolds full RESTful CRUD APIs from database tables (Paging, Sorting, Filtering, Bulk Operations, Soft Delete).
- Flexibly maps Stored Procedures (multiple Result Sets, IN/OUT parameters), Table-Valued Functions, Scalar Functions, and Database Views into specialized RESTful API endpoints.
- 🧠 AI DB Engineer & Persistent Architecture Memory (
api_gen db-engineer):- Built-in AI Database Architect that connects to SQL Server / PostgreSQL, designs schema migrations (DDL), optimizes indexes, and maintains persistent database architecture memory (
.api_gen/db_memory.json). - Automatically recalls past schema context across project iterations without re-scanning the database from scratch.
- Built-in AI Database Architect that connects to SQL Server / PostgreSQL, designs schema migrations (DDL), optimizes indexes, and maintains persistent database architecture memory (
- 🖥 Interactive Lazy Terminal UI (
api_gen lazy):- Keyboard-driven Terminal User Interface (TUI) inspired by Lazygit.
- Toggle schema objects with
[Space], preview live syntax-highlighted C# code in real-time, and trigger generation with[g].
- 🤖 End-to-End System Scaffolding (
api_gen scaffold):- Type a high-level system prompt (e.g.,
api_gen scaffold "Learning Management System LMS"), and the engine automatically designs tables, foreign keys, views, stored procedures, and scaffolds the complete .NET solution in seconds.
- Type a high-level system prompt (e.g.,
- 🔐 Session Management & Enterprise Services:
- Encrypted Local CLI Session state and runtime Output Application Session Provider (
ICurrentUserSession, Redis/Memory Session, Auto-Audit & Procedure Parameter Binding). - Built-in integrations for MinIO / AWS S3 / Azure Blob Storage, Hangfire Background Jobs, MassTransit Event Bus (RabbitMQ), Rate Limiting Middleware, and Multi-Tenancy.
- Encrypted Local CLI Session state and runtime Output Application Session Provider (
- 📦 Packaging & Export Engine:
- Distributed as a standard Global .NET Tool (
dotnet tool install -g api_gen) via NuGet Feed. - Automatically exports TypeScript Client SDK (
api_client.ts) and Postman Collection (postman_collection.json).
- Distributed as a standard Global .NET Tool (
💻 2. CLI Command Reference
| Command | Description | Example Usage |
|---|---|---|
api_gen init |
Initializes api_gen.config.json configuration & workspace session |
api_gen init --provider SqlServer |
api_gen generate |
Scaffolds the .NET Web API solution based on configuration | api_gen generate --output ./src |
api_gen lazy |
Launches the interactive Terminal User Interface (TUI) | api_gen lazy |
api_gen db-engineer |
Activates AI DB Engineer to optimize DB and update persistent memory | api_gen db-engineer "Create Invoices table" |
api_gen scaffold |
Auto-architects DB & scaffolds complete system solution | api_gen scaffold "ECommerce Platform" |
api_gen prompt |
Generates & refines APIs using natural language prompts | api_gen prompt "Create sales report API with 60s Redis cache" |
api_gen watch |
Watches database schema changes and re-scaffolds via Hot Reload | api_gen watch |
api_gen export |
Exports TypeScript Client SDK or Postman Collection | api_gen export --type ts |
🏗 3. Target Output Solution Architecture (.NET Clean Architecture)
The output C# solution strictly adheres to Clean Architecture & CQRS Pattern:
MySolution/
├── src/
│ ├── MyApi.Domain/ # Entities, Value Objects, BaseEntity Audit
│ │ ├── Entities/
│ │ └── Common/
│ │
│ ├── MyApi.Application/ # DTOs, Interfaces, Validators, Feature Handlers
│ │ └── Features/
│ │ ├── Customers/
│ │ └── CustomProcedures/ # DTOs for Stored Procedures
│ │
│ ├── MyApi.Infrastructure/ # EF Core DbContext, Dapper Repositories, Redis, MinIO
│ │ ├── Data/
│ │ │ └── ApplicationDbContext.cs
│ │ └── Repositories/
│ │
│ └── MyApi.WebApi/ # Controllers, Program.cs, Swagger Docs, Middleware
│ └── Controllers/
│
└── api_gen.config.json # Configuration Schema
🎛 4. Configuration Schema (api_gen.config.json)
{
"ProjectSettings": {
"SolutionName": "Avatech.SalesService",
"Namespace": "Avatech.SalesService",
"TargetDotNetVersion": "net8.0",
"Architecture": "CleanArchitecture",
"OrmType": "Hybrid"
},
"Database": {
"Provider": "SqlServer",
"ConnectionString": "Server=localhost;Database=SalesDb;User Id=sa;Password=YourPassword123;TrustServerCertificate=True;"
},
"GeneratorOptions": {
"GenerateCrudControllers": true,
"GenerateSwaggerDocs": true,
"EnableSoftDelete": true,
"SoftDeleteColumn": "IsDeleted",
"AuditColumns": ["CreatedBy", "CreatedAt", "UpdatedBy", "UpdatedAt"]
}
}
🚀 5. Installation & Global .NET Tool Usage
# 1. Build and pack into NuGet Tool Package
dotnet pack src/ApiGen.Cli/ApiGen.Cli.csproj -c Release -o ./nupkg
# 2. Install as a Global .NET Tool
dotnet tool install -g --add-source ./nupkg ApiGen.Cli
# 3. Execute anywhere on your system
api_gen init
api_gen generate
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 141 | 7/29/2026 |