Starting a new ASP.NET Core API usually means rebuilding the same layers, security plumbing and test projects by hand. This Windows app does it in one click: choose a name and a few options, preview every file before it's written, and get a security-first .NET 10 solution that builds and passes its own tests right away.
Dependencies only point inward: Api → Infrastructure → Application → Domain, and the architecture tests check it on every run.
Layers that stay clean
A rich domain model whose state only changes through its own methods, version 7 GUIDs, domain events handled in the same save, and audit fields filled in on the server. Reflection-based tests fail if a layer references the wrong one.
CQRS without MediatR
A small, readable sender instead of a paid library. Every request goes through logging and FluentValidation; expected errors come back as Result values and become RFC 9457 ProblemDetails in the API.
Sign-in done properly
E-mail confirmation, lockout after 5 failures, TOTP two-factor with recovery codes and password reset. A 10-minute JWT plus a refresh token in an HttpOnly; Secure; SameSite=Strict cookie that rotates on every use; replaying an old one revokes the whole session.
Secure by default
Every endpoint needs a signed-in user unless marked otherwise, other users' records return 404, unknown JSON fields are rejected, and there are rate limits, security headers, body/time/page limits and error responses that never leak internals. Sign-in, sign-up and password reset don't reveal whether an e-mail is registered, not even through response times.
No secrets in the repo
The random JWT signing key (and the PostgreSQL connection string) goes into dotnet user-secrets while the solution is generated, never into a file in the repository. Outside Development the app refuses to start if a setting is missing or weak.
A guarded supply chain
Central Package Management with transitive pinning, lock files, NuGet Audit that stops Release builds on known vulnerabilities, package source mapping, and every .NET security analyzer turned on with warnings as errors in Release.
Options
The right-hand preview shows every file that will be created, with its content, before anything is written to disk.
Option
What changes
Solution name
Root namespace, folder and project names. Invalid names get a suggestion (“Mağaza Yönetimi” → MagazaYonetimi), and names that would clash with generated types (Firma.Result) are rejected.
Database
SQL Server (LocalDB), PostgreSQL or SQLite: the NuGet package, the UseXxx call and the development connection string.
Solution file
The classic .sln or the newer .slnx.
Authentication
Built-in (ASP.NET Core Identity + JWT with every flow above) or an external OpenID Connect provider such as Entra ID, Auth0 or Keycloak, where the API only validates tokens and accepts asymmetric signatures only.
Sample feature
TodoItems, which walks through every layer, a domain event and the ownership check. When it's off, the skeleton comes empty.
Test projects
Unit, architecture and integration tests. The integration tests run the whole app in memory on SQLite, whichever database you picked.
After generating
git init, dotnet build and opening the folder; build output streams into the app's log.
How it works
A template engine that has nothing to do with WinForms, with the window as a thin layer on top.
Templates are a real solution
The Templates folder is an exact copy of the generated solution, embedded in the DLL as resources along with their folder paths. Copy it next to the exe to change templates without rebuilding.
Tokens and conditional blocks
Tokens like __Name__ are replaced in contents and paths. Option-dependent parts are marked with comment-style blocks for each file type — //#if LocalAuth, <!--#if Sample-->, @*#if Sample*@ — with #elif, #else, !, &&, || and parentheses. An unknown symbol is treated as a typo and reported as an error.
Plan first, then write
The whole plan is built in memory, which is what the preview shows, and only then written to disk. Files whose entire content is conditional are skipped when their option is off, and dot_gitignore / X.csproj.template become .gitignore / X.csproj so IDEs don't mistake templates for real projects.
Secrets stay outside
The JWT signing key, the user-secrets ID and the ports are random for every solution. Secrets are written to %APPDATA%\Microsoft\UserSecrets\<id>\secrets.json, not into the solution folder; everything else is deterministic, so the same options produce the same files.
Unit tests generate the plan for 3 databases × 2 sign-in modes × sample and tests on/off × 2 solution formats — 48 combinations — and check that no token or directive is left over, JSON and XML files are valid, the projects and solution file agree, and no secret ends up in any file.
Separate build tests generate five scenarios from scratch, fail on a single compiler warning and run the generated tests: sign-up and sign-in flows, lockout, refresh-token rotation and theft detection, two-factor, access to other users' records, security headers, rate limits and an algorithm-confusion attack. A generated SQLite API was also run end to end with migrations and Swagger UI.
PowerShell
dotnet test
$env:CAG_BUILD_TESTS = "1"; dotnet test
Setup
Windows 10/11 and the .NET 10 SDK, which also brings the Desktop Runtime the app needs.
Download a release
Unzip the archive from the Releases page and run CleanArchitectureGenerator.exe.
Or run from source
PowerShell
dotnet run --project src/CleanArchitectureGenerator.App
Build a single-file exe
The output is publish\CleanArchitectureGenerator.exe; add -SelfContained for machines without .NET.
PowerShell
.\publish.ps1
Remembers your choices
The last used options are saved in %LOCALAPPDATA%\CleanArchitectureGenerator\settings.json.
Code layout
CleanArchitectureGenerator.Engine handles templates, solution generation and name validation; CleanArchitectureGenerator.App is the WinForms window; CleanArchitectureGenerator.Engine.Tests holds the xUnit tests.
Known limitations
Windows only, because of WinForms. The generation engine itself is platform-independent, but there's no separate command-line tool.
It targets .NET 10, and package versions are fixed in the template's Directory.Packages.props; updating them means editing that file.
It generates an API only; the pages that open the e-mail confirmation and password reset links belong in your client app.
The first migration isn't generated; the solution's README gives the dotnet ef migrations add command.
Rate limits are kept in each server's memory, and Data Protection keys need a shared store when you run more than one instance; both are on the generated SECURITY.md checklist.
Two-factor recovery codes are stored the way Identity's default store keeps them, without encryption.
Solutions created in very deep folders can hit Windows' 260-character path limit when building; the app warns about long paths.