BuildQuickPkg 1.1.0
dotnet tool install --global BuildQuickPkg --version 1.1.0
dotnet new tool-manifest
dotnet tool install --local BuildQuickPkg --version 1.1.0
#tool dotnet:?package=BuildQuickPkg&version=1.1.0
nuke :add-package BuildQuickPkg --version 1.1.0
BuildQuickPkg
An interactive .NET CLI tool that scaffolds a complete Clean Architecture ASP.NET Core solution: API, Application, Domain, and (optionally) Infrastructure projects, already wired up, testable, and building in seconds. Stop hand-rolling the same folder structure and .csproj references for every new API.
📖 Full documentation (or browse in-repo): getting started, CLI reference, architecture guide, EF Core, Docker, JWT, microservices, and troubleshooting.
What it generates
Given a project name of MyAwesomeApi with the 4-layer architecture and tests enabled, the tool creates:
MyAwesomeApi/
├── MyAwesomeApi.sln
├── .gitignore
├── README.md
├── Dockerfile # (optional) multi-stage build → publish → run
├── docker-compose.yml # (optional) api + db services
├── src/
│ ├── MyAwesomeApi_API/ # Presentation layer (Minimal API, Swagger, CORS, launch profiles)
│ │ ├── Controllers/
│ │ ├── Extensions/
│ │ ├── Middlewares/
│ │ ├── Properties/launchSettings.json
│ │ ├── appsettings.json # shared settings (logging, JWT issuer/audience, ...)
│ │ ├── appsettings.Development.json # local connection string + dev JWT signing key
│ │ ├── appsettings.Production.json # secrets left blank, supplied via env vars
│ │ └── Program.cs
│ ├── MyAwesomeApi_Application/ # Use cases / business logic
│ │ ├── Services/Implementation/
│ │ ├── Services/Interfaces/
│ │ └── Utilities/
│ ├── MyAwesomeApi_Domain/ # Entities, DTOs, enums, no dependencies on other layers
│ │ ├── Dtos/RequestDtos/
│ │ ├── Dtos/ResponseDtos/
│ │ ├── Entity/
│ │ └── Enums/
│ └── MyAwesomeApi_Infrastructure/ # EF Core, external services, persistence
│ ├── Context/ # (optional) generated DbContext when EF Core is selected
│ └── Migrations/
└── tests/
└── MyAwesomeApi_API.Tests/ # xUnit + WebApplicationFactory integration tests
└── HealthEndpointTests.cs
appsettings.json, per environment
Every generated API ships all three settings files, loaded by ASP.NET Core's standard appsettings.json → appsettings.{Environment}.json → environment variables layering:
| File | Loaded when | Contains |
|---|---|---|
appsettings.json |
Always (base layer) | Logging defaults, AllowedHosts, and the JWT issuer/audience/expiry when JWT is enabled |
appsettings.Development.json |
ASPNETCORE_ENVIRONMENT=Development (default for dotnet run) |
A working local connection string and a dev-only JWT signing key, safe to commit and never used in production |
appsettings.Production.json |
ASPNETCORE_ENVIRONMENT=Production |
Connection string and JWT key left blank, meant to be supplied via environment variables (ConnectionStrings__DefaultConnection, Jwt__Key) or a secret manager |
API style
Choose Minimal API (top-level app.MapGet/app.MapPost calls in Program.cs) or Standard API (Controllers backed by an interface/service pair, the service-controller pattern). Every generated project has Controllers/, Services/Interfaces/, and Services/Implementation/ folders either way; Standard API is what actually populates them. Both styles expose the same URLs, so this only changes how the code is organized.
Optional add-ons
Three more prompts let you opt into common boilerplate at generation time:
- Entity Framework Core (
None/PostgreSQL/SQL Server): adds the provider package plusMicrosoft.EntityFrameworkCore.Designto the layer that ownsInfrastructure/Context(the dedicated Infrastructure project in 4-layer, or Domain in 3-layer), generates a starter{ProjectName}DbContext, wires upAddDbContextinProgram.cs, and writes matching connection strings intoappsettings.Development.json. - Dockerfile & docker-compose.yml: a multi-stage
Dockerfile(SDK build → ASP.NET runtime) and adocker-compose.ymlwith anapiservice; when EF Core is also selected, adbservice (Postgres or SQL Server) is included and wired up viaConnectionStrings__DefaultConnection. - JWT Authentication boilerplate: adds
Microsoft.AspNetCore.Authentication.JwtBearer, registers bearer-token authentication/authorization, and wires up two sample endpoints:POST /api/auth/token(issues a token) andGET /api/secure(requires one), so you can see it working immediately. In Standard API style, these are anAuthController+IAuthService/AuthServiceinstead of top-level endpoints.
In microservice mode, each service gets its own appsettings.*, DbContext, Dockerfile, and docker-compose.yml.
Said no to one of these and want it later? BuildQuickPkg add efcore|jwt|docker|repository|env|caddy retrofits it onto a project you already generated, no regeneration needed. See Adding a Feature Later.
Project references are pre-wired according to Clean Architecture's dependency rule: API → Application, Infrastructure, Infrastructure → Application, Domain, Application → Domain, and Domain depends on nothing. The generated API project includes Swagger/OpenAPI, CORS, and Serilog structured logging out of the box, plus a sample /api/health endpoint, so the solution is immediately runnable and testable.
Two architecture options are offered at generation time:
- 4-layer: a dedicated Infrastructure project (shown above)
- 3-layer: Infrastructure concerns (
Context/,Migrations/) folded intoDomain/Infrastructure/instead of a separate project, for smaller services that don't need the extra layer
Test project generation is optional; when enabled, it references the API project directly and includes a working WebApplicationFactory<Program>-based test for the health-check endpoint.
Monolithic vs. microservice
By default the tool generates a single solution (as above). Choose Microservice instead and it will ask how many services you need and what to name each one, then generate one fully independent Clean Architecture solution per service, with the same target framework, same architecture pattern, and same package versions across all of them:
ShopSystem/
├── ShopSystem.sln # aggregate solution, builds every service at once
├── .gitignore
├── README.md
└── services/
├── OrderService/
│ ├── OrderService.sln # each service is also independently buildable/runnable
│ ├── src/OrderService_API/ ...
│ └── tests/OrderService.UnitTests/
├── InventoryService/
│ └── ...
└── PaymentService/
└── ...
Each service gets its own HTTP/HTTPS ports, offset by 10 from your chosen base port so they don't collide when run side by side.
Structured logging (Serilog)
Every generated API ships with Serilog wired up via Serilog.AspNetCore: a console sink, UseSerilogRequestLogging() for per-request timing, and the standard fatal-exception/flush-on-shutdown bootstrap pattern in Program.cs.
Installation
dotnet tool install --global BuildQuickPkg
Upgrading, downgrading to a specific version, and uninstalling are covered in Managing your install.
Usage
BuildQuickPkg
# or, to skip the project-name prompt:
BuildQuickPkg MyAwesomeApi
You'll be prompted interactively for:
| Prompt | Options / Default |
|---|---|
| Project Name | free text, default MyAwesomeApi (skipped if passed as an argument) |
| Target Framework | net8.0 / net9.0 / net10.0 |
| Architecture Pattern | 4-layer (with Infrastructure) / 3-layer |
| API Style | Minimal API / Standard API (Controllers + Services) |
| Deployment Style | Monolithic / Microservice |
| Number of services + a name for each | (microservice only) |
| Include xUnit test project | yes / no, default yes |
| Port | default 5200 |
| HTTPS Port | default 5201 |
| Add Entity Framework Core | None / PostgreSQL / SQL Server |
| Add Dockerfile & docker-compose.yml | yes / no, default no |
| Add JWT Authentication boilerplate | yes / no, default no |
Then run the generated API:
cd MyAwesomeApi/src/MyAwesomeApi_API
dotnet run
Requirements
- .NET 8 SDK or later
Project source layout
The tool itself follows the same separation-of-concerns principle it generates for you:
BuildQuickPkg/
├── Program.cs # CLI entry point: routes to `add`, or runs the generation prompts
├── Commands/ # `BuildQuickPkg add <feature>`: retrofits a feature onto an existing project
│ ├── AddFeatureCommand.cs # Parses "efcore/jwt/docker/repository/env/caddy" and dispatches to the commands below
│ ├── AddEfCoreCommand.cs
│ ├── AddJwtCommand.cs
│ ├── AddDockerCommand.cs
│ ├── AddRepositoryCommand.cs # Generic Repository/UnitOfWork (requires efcore first)
│ ├── AddEnvCommand.cs # .env with dummy values matching the project's actual setup
│ ├── AddCaddyCommand.cs # Caddyfile reverse proxy
│ └── HelpText.cs # --help / -h output for the root command and `add`
├── Scaffolding/
│ ├── ScaffoldingConfig.cs # Options record: naming, architecture, API style, ports, tests, EF/Docker/JWT
│ ├── EfCoreProvider.cs # None / PostgreSql / SqlServer
│ ├── ApiStyle.cs # Minimal / Controller
│ ├── SolutionScaffolder.cs # Orchestrates folder creation, file writes, and `dotnet sln`
│ ├── ProjectStructure.cs # Resolves layer project names and the folder tree (new projects)
│ ├── ExistingProject.cs # Describes an already-generated project, resolved from disk
│ └── ExistingProjectLocator.cs # Locates ExistingProject from the current working directory
├── Templates/
│ ├── CsprojTemplates.cs # .csproj content for each layer (4-layer, 3-layer, test)
│ ├── ProgramTemplate.cs # Generated API Program.cs (+ optional EF Core / JWT / Controller wiring)
│ ├── ControllerTemplate.cs # Health/Auth Controller + service pairs for Standard API style
│ ├── RepositoryTemplate.cs # Generic IRepository<T>/Repository<T> + IUnitOfWork/UnitOfWork
│ ├── AppSettingsTemplate.cs # appsettings.json / .Development.json / .Production.json
│ ├── EfCoreTemplate.cs # Generated DbContext + provider package/connection-string helpers
│ ├── DockerTemplate.cs # Dockerfile + docker-compose.yml
│ ├── EnvTemplate.cs # .env content matching the project's actual setup
│ ├── CaddyTemplate.cs # Caddyfile reverse proxy
│ ├── HealthEndpointTestTemplate.cs # Generated xUnit health-check test
│ ├── LaunchSettingsTemplate.cs
│ └── GitignoreTemplate.cs
└── Utilities/
├── ProcessRunner.cs # Wraps `dotnet` CLI process execution
├── CsprojEditor.cs # Adds PackageReferences to an existing .csproj (used by `add`)
├── ProgramCsEditor.cs # Patches an existing Program.cs at its stable markers (used by `add`)
├── AppSettingsEditor.cs # Merges JSON sections into an existing appsettings*.json (used by `add`)
├── ProjectFeatureDetector.cs # Reads an existing project's actual EF Core/JWT/API style/port (used by `add`)
└── NameValidation.cs # Validates a project/service name is safe as a C# namespace + folder name
Contributing
Issues and pull requests are welcome. See CONTRIBUTING.md for how to get set up, add a new generation option, and test your change.
License
MIT. See LICENSE.
| 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. |
This package has no dependencies.
1.1.0
New:
- API Style prompt: choose Minimal API (top-level Map* endpoints) or Standard API (Controllers backed by an interface/service pair, the service-controller pattern). Both styles expose identical URLs; Standard API is what populates the Controllers/ and Services/Interfaces+Implementation folders that every generated project already scaffolds.
- New "BuildQuickPkg add repository" command: adds a generic IRepository<T>/Repository<T> plus IUnitOfWork/UnitOfWork with basic CRUD (GetByIdAsync, GetAllAsync, AddAsync, Update, Remove, SaveChangesAsync), written next to your DbContext. Requires "add efcore" first.
- New "BuildQuickPkg add env" command: generates a .env file with dummy values matching what's actually configured in the project (connection string if EF Core is set up, JWT settings if JWT is set up, always the port), and adds .env to .gitignore automatically.
- New "BuildQuickPkg add caddy" command: generates a Caddyfile reverse proxy wired to the project's real configured port.
- "BuildQuickPkg add jwt" is now Controller-style aware: retrofitting JWT onto a Standard API project adds an AuthController + IAuthService/AuthService instead of top-level endpoints, matching how the project was generated.
- A visual documentation site (Docsify, zero build step) now ships under /docs, browsable at https://oluiy.github.io/build-quick-aspnet/, with the same guides as the in-repo docs plus search and sidebar navigation.
Fixed:
- Controller-style projects with JWT enabled failed to build: the generated AuthService.cs lives in the Application project, which had no package reference for JWT types or IConfiguration. The Application project's .csproj now gets those packages when Standard API + JWT are both selected (or retrofitted via "add jwt").
1.0.9
New:
- Entity Framework Core support (PostgreSQL or SQL Server) at generation time: provider package, a starter DbContext wired into Program.cs, and connection strings in appsettings.
- Docker support: a multi-stage Dockerfile and docker-compose.yml, with a database service included automatically when EF Core is selected.
- JWT Authentication boilerplate: bearer auth wired end to end, plus working sample endpoints (issue a token, call a protected route) so it's provably working out of the box, not just middleware.
- Every generated project now ships appsettings.json, appsettings.Development.json, and appsettings.Production.json, layered per ASP.NET Core convention.
- New "BuildQuickPkg add" command: retrofit EF Core, JWT, or Docker onto a project you already generated, no regeneration needed.
BuildQuickPkg add efcore postgres
BuildQuickPkg add jwt
BuildQuickPkg add docker
Safe by design: inserts at stable markers in Program.cs and aborts cleanly (writing nothing) if it can't find them, rather than guessing and risking your own code.
- --help / -h and --version / -v flags.
- Full documentation site under /docs, including a getting-started guide, architecture guide, and a guide for each optional feature.
Fixed:
- Projects targeting net9.0/net10.0 failed to build with CS0234/CS7069 (a version conflict between Microsoft.AspNetCore.OpenApi and Swashbuckle.AspNetCore) plus a high-severity NU1903 vulnerability warning. The unused, conflicting package reference has been removed.
- Swashbuckle.AspNetCore upgraded from 6.6.2 to 10.2.3, the current stable line supporting net8.0/net9.0/net10.0 and OpenAPI 3.1. Generated Program.cs updated for the underlying Microsoft.OpenApi 2.x rewrite this version depends on (OpenApiInfo moved from the Microsoft.OpenApi.Models namespace to Microsoft.OpenApi). Verified with a clean build on all three target frameworks.
- The generated xUnit test project failed to compile in every generated solution due to a missing using directive.
- The generated API's CORS policy is now scoped to Development only, instead of also applying in Production.
- Failures in the underlying dotnet CLI calls (new sln, sln add) are no longer swallowed silently; they now surface a clear error instead of a false "Success" message.
- Input validation added for microservice generation to prevent an unrecoverable zero-service solution.
- A project or service name with a stray space (e.g. a trailing space typed by mistake) previously crashed generation with an unhandled exception from "dotnet sln add", or silently produced a broken, uncompilable project. Names are now trimmed and validated up front, with a clear message if one isn't safe to use as a C# namespace and folder name.
- When JWT is enabled, Swagger UI now actually shows an Authorize button and lock icons (via a Bearer security scheme registered with Swashbuckle) instead of silently ignoring authentication entirely. Also fixed in the "add jwt" retrofit command.