Skip to content

Repository files navigation

🏗️ Architect Generator

🇹🇷 Türkçe · 🇬🇧 English


🇹🇷 Türkçe

Clean / Onion mimarisinde, kimlik doğrulama ve CQRS dahil, çalışmaya hazır bir modüler monolith iskeleti üreten interaktif bir .NET CLI aracı.

Her yeni projeye aynı boilerplate'i kopyalayıp yapıştırmak yerine, birkaç soruya cevap veriyorsun ve saniyeler içinde tüm referansları bağlanmış, derlenebilir bir solution elde ediyorsun. Sonrasında kendi modüllerini ve entity'lerini kendi çalışma şeklinle ekliyorsun.

.NET 10 ile geliştirildi. Üretilen solution'lar da .NET 10 hedefler.

Neden?

Her yeni katmanlı .NET projesi hep aynı şekilde başlar: projeleri oluştur, referansları bağla, MediatR/EF/JWT ekle, auth akışını yaz, Swagger'ı ayarla… tekrar tekrar. Architect Generator bu tekrar eden kurulumu tek bir interaktif çalıştırmaya indiriyor; böylece daha ilk gün asıl iş mantığını yazmaya başlıyorsun — üstelik tüm projelerinde tutarlı, temiz bir mimariyle.

Özellikler

  • Clean / Onion mimarisiDomain, Application, Infrastructure, Persistence katmanları + bir Presentation Web API; tüm proje referansları otomatik bağlanır.
  • Modüler monolith — bir Base modülüyle başla, istediğin kadar özellik modülü ekle. Her modül kendi dört katmanını alır ve Web API'ye otomatik kaydedilir.
  • Kutudan çıkar çıkmaz kimlik doğrulama & yetkilendirme
    • JWT Bearer kimlik doğrulama
    • Login / Logout / Refresh-token akışı (selector-verifier refresh token)
    • Admin kullanıcı oluşturma + opsiyonel public (herkese açık) kayıt (yeni kullanıcı en düşük rolü alır)
    • Yapılandırılabilir rol seti (ilk rol = en yetkili / admin, son rol = en düşük yetkili)
    • BCrypt ile parola hash'leme
    • Redis tabanlı token geçersizleştirme
    • İlk admin için veritabanı seeding
  • CQRS (MediatR ile), istek doğrulama (FluentValidation pipeline behavior).
  • Generic repository + Unit of Work (EF Core üzerinde).
  • Çoklu veritabanı desteği — üretim anında sağlayıcını seç:
    • SQL Server · PostgreSQL · MySQL · SQLite
  • Opsiyonel test projeleri — her katman için bir xUnit projesi; FluentAssertions ve Moq hazır.
  • Swagger / OpenAPI Web API'de hazır.
  • Güvenlik varsayılanları — güvenlik header'ları + production'da HSTS, ve auth uçlarında (login / refresh-token / register) IP başına dakikada 5 istek rate limit'i (brute-force'a karşı); diğer controller'lar varsayılan 60/dk limitine tabidir.
  • Temiz derlenir — generator sonda bir dotnet build çalıştırır; bir yığın dosya değil, çalışan bir solution alırsın.

Güvenlik / dağıtımdan önce

İskelet güvenli varsayılanlarla gelir ama production'a hazır değildir; dağıtmadan önce:

  • appsettings.json içindeki JwtSettings:SecretKey'i gerçek bir gizli değerle değiştir. (Üretilen uygulama, dev placeholder ile production'da açılmayı reddeder.)
  • ConnectionStrings, RedisConnection ve SeedAdmin kimlik bilgilerini ortam değişkenleri / secret store'dan ver — repoya gizli değer yazma.

Gereksinimler

  • .NET 10 SDK
  • (Opsiyonel) Çalışan bir Redis örneği — üretilen solution'larda token geçersizleştirme için kullanılır.
  • Seçtiğin sağlayıcıya uygun bir veritabanı sunucusu (ya da sıfır kurulum için SQLite seç).

Başlangıç

git clone https://github.com/sonmezozlem/ArchitectGenerator.git
cd ArchitectGenerator
dotnet run

Birkaç soruyla yönlendirilirsin:

🏗️ Architect Generator
Solution adı: ShopApi
Klasör (boş = Desktop): C:\Projects

Veritabanı seçin:
  1) SQL Server (varsayılan)
  2) PostgreSQL
  3) MySQL
  4) SQLite
Seçim (1-4) [1]: 1

Test projeleri de oluşturulsun mu? (e/h) [e]: e

Roller [Admin,User]: Admin,Manager,User
Public (herkese açık) kayıt endpoint'i olsun mu? (e/h) [h]: h

Modül eklemek ister misin? (e/h): e
Modül adı (PascalCase, örn. Expense): Catalog
...

İşlem bittiğinde üretilen solution'ı açıp Web API'yi çalıştırabilirsin.

Ne üretilir?

YourSolution/
├─ YourSolution.slnx
└─ src/
   ├─ Base/
   │  ├─ Base.Domain
   │  ├─ Base.Application        # CQRS, Auth özellikleri, validation behavior'ları
   │  ├─ Base.Infrastructure     # JWT, BCrypt, Redis, auth servisleri
   │  └─ Base.Persistence        # DbContext, EF configuration'ları, repository'ler, UoW, seeding
   ├─ <YourModule>/              # interaktif eklenir — aynı dört katman
   │  ├─ <YourModule>.Domain
   │  ├─ <YourModule>.Application
   │  ├─ <YourModule>.Infrastructure
   │  └─ <YourModule>.Persistence
   └─ Presentation/
      └─ YourSolution.WebApi     # controller'lar, Swagger, DI kompozisyonu

Testler etkinse, her katman için bir xUnit projesi içeren paralel bir tests/ ağacı oluşturulur.

Yapılandırma soruları

Soru Açıklama Varsayılan
Solution adı Üretilecek solution'ın adı
Klasör Çıktı klasörü Desktop
Veritabanı sağlayıcısı SQL Server / PostgreSQL / MySQL / SQLite SQL Server
Test projeleri Her katman için xUnit test projesi üret Evet
Roller Virgülle ayrılmış; ilk = admin, son = en düşük yetki Admin,User
Public kayıt Herkese açık kayıt endpoint'i sun Hayır
Modüller Özellik modüllerini interaktif ekle

Teknoloji

Generator: .NET 10 · C# · dotnet CLI orkestrasyonu

Üretilen solution'lar: ASP.NET Core Web API · EF Core · MediatR · FluentValidation · JWT Bearer · BCrypt · Redis (StackExchange.Redis) · Swagger · xUnit / FluentAssertions / Moq

Yol haritası / fikirler

  • Modül başına ayrı DbContext seçeneği (ayrı migration zincirleri, modül başına şema)
  • Ek mimari hazır şablonları

🇬🇧 English

An interactive .NET CLI tool that scaffolds a production-shaped modular monolith following Clean / Onion Architecture — with authentication, CQRS, and multi-database support wired up out of the box. It gives you a hardened starting point (JWT auth, security headers, HSTS, rate-limited auth endpoints); the dev placeholders in appsettings.json still have to be replaced before you actually deploy.

Instead of copy-pasting boilerplate at the start of every project, you answer a few prompts and get a fully referenced, buildable solution in seconds. From there you add your own modules and entities the way you work.

Built with .NET 10. The generated solutions also target .NET 10.

Why

Every new layered .NET project starts the same way: create the projects, wire the references, add MediatR/EF/JWT, write the auth flow, configure Swagger… again and again. Architect Generator turns that repetitive setup into a single interactive run, so you can start writing actual business logic on day one — while keeping a clean, consistent architecture across all your projects.

Features

  • Clean / Onion architectureDomain, Application, Infrastructure, Persistence layers + a Presentation Web API, with all project references wired automatically.
  • Modular monolith — start from a Base module, then add as many feature modules as you want. Each module gets its own four layers and is registered into the Web API for you.
  • Authentication & authorization out of the box
    • JWT Bearer authentication
    • Login / Logout / Refresh-token flow (selector-verifier refresh tokens)
    • Admin user creation + optional public self-registration (new users get the lowest role)
    • Configurable role set (first role = most privileged / admin, last role = least privileged)
    • Password hashing with BCrypt
    • Redis-backed token invalidation
    • Database seeding for the initial admin
  • CQRS with MediatR, request validation with FluentValidation (pipeline behavior).
  • Generic repository + Unit of Work over EF Core.
  • Multi-database support — pick your provider at generation time:
    • SQL Server · PostgreSQL · MySQL · SQLite
  • Optional test projects — one xUnit project per layer, pre-wired with FluentAssertions and Moq.
  • Swagger / OpenAPI ready in the Web API.
  • Secure defaults — security headers + HSTS in production, and a per-IP 5-requests/minute rate limit on the auth endpoints (login / refresh-token / register) to blunt brute-force; other controllers fall back to a default 60/min limit.
  • Builds clean — the generator runs a final dotnet build so you get a working solution, not a pile of files.

Security / before you deploy

The scaffold ships with secure defaults but is not production-ready as-is. Before deploying:

  • Replace JwtSettings:SecretKey in appsettings.json with a real secret. (The generated app refuses to start in production while the dev placeholder is still in place.)
  • Supply ConnectionStrings, RedisConnection and the SeedAdmin credentials via environment variables / a secret store — don't commit secrets.

Requirements

  • .NET 10 SDK
  • (Optional) A running Redis instance — used for token invalidation in generated solutions.
  • A database server matching the provider you choose (or just pick SQLite for zero setup).

Getting started

git clone https://github.com/sonmezozlem/ArchitectGenerator.git
cd ArchitectGenerator
dotnet run

You'll be guided through a few prompts (the CLI prompts are in Turkish), then open the generated solution and run the Web API.

What gets generated

YourSolution/
├─ YourSolution.slnx
└─ src/
   ├─ Base/
   │  ├─ Base.Domain
   │  ├─ Base.Application        # CQRS, Auth features, validation behaviors
   │  ├─ Base.Infrastructure     # JWT, BCrypt, Redis, auth services
   │  └─ Base.Persistence        # DbContext, EF configurations, repositories, UoW, seeding
   ├─ <YourModule>/              # added interactively — same four layers
   │  ├─ <YourModule>.Domain
   │  ├─ <YourModule>.Application
   │  ├─ <YourModule>.Infrastructure
   │  └─ <YourModule>.Persistence
   └─ Presentation/
      └─ YourSolution.WebApi     # controllers, Swagger, DI composition

With tests enabled, a parallel tests/ tree is created with one xUnit project per layer.

Configuration prompts

Prompt Description Default
Solution name Name of the generated solution
Path Output folder Desktop
Database provider SQL Server / PostgreSQL / MySQL / SQLite SQL Server
Test projects Generate xUnit test projects per layer Yes
Roles Comma-separated; first = admin, last = lowest privilege Admin,User
Public register Expose a public self-registration endpoint No
Modules Add feature modules interactively

Tech stack

Generator: .NET 10 · C# · dotnet CLI orchestration

Generated solutions: ASP.NET Core Web API · EF Core · MediatR · FluentValidation · JWT Bearer · BCrypt · Redis (StackExchange.Redis) · Swagger · xUnit / FluentAssertions / Moq

Roadmap / ideas

  • Per-module dedicated DbContext option (separate migration chains, schema-per-module)
  • Additional architectural presets

License

Licensed under the MIT License — see the LICENSE file for details. MIT lisansı altındadır — ayrıntılar için LICENSE dosyasına bakın.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages