.NET Architecture Reference Implementations
Curated collection of open-source .NET projects demonstrating various architectural patterns and approaches
A collection of high-quality GitHub repositories showcasing different architectural patterns in .NET applications. These serve as practical references for understanding and implementing various architectural approaches.
Choosing an Architecture #
Selecting the right architectural pattern depends on several factors:
Decision Criteria:
- Project Complexity: How complex is your domain logic? Simple CRUD vs. complex business rules
- Team Size & Structure: Small team vs. multiple autonomous teams
- Scalability Needs: Monolithic deployment vs. independent scaling requirements
- Maintenance Horizon: Short-term project vs. long-term evolving system
- Team Expertise: Familiarity with patterns, willingness to adopt new approaches
Pattern Overview:
Clean Architecture: Choose when you need strict separation of concerns, high testability, and framework independence. Best for applications where business logic needs to be isolated from infrastructure concerns.
DDD/CQRS: Ideal for complex business domains with intricate rules. Use when read and write operations have different performance characteristics or when you need clear separation between commands and queries.
Microservices: Select when you need independent deployment, polyglot persistence, team autonomy, or different scaling requirements per service. Avoid if you’re starting small or lack distributed systems experience.
Modular Monolith: Perfect middle ground when you want modularity and clear boundaries without distributed system complexity. Great for most enterprise applications that don’t need independent deployment.
Vertical Slice: Choose when you want feature-focused organization that’s simpler than layered architecture. Each feature is self-contained, making it easier to understand and modify individual features.
Reference Repositories by Pattern #
Clean Architecture #
When to use: You need framework independence, high testability, and clear separation between business logic and infrastructure.
Trade-offs: More files and abstractions upfront; can be overkill for simple CRUD applications.
Clean Architecture Template ⭐ Most Popular Jason Taylor’s widely-adopted Clean Architecture implementation with dependency inversion and separation of concerns. Includes SPA support with Angular/React.
Ardalis Clean Architecture
Steve Smith’s proven solution template with installable NuGet package and CQRS-based use cases. Great for quick project starts with dotnet new templates.
Clean Architecture Manga - Hexagonal Example Implementation of hexagonal architecture (ports and adapters pattern) combined with clean architecture principles.
Domain-Driven Design & CQRS #
When to use: Complex business domains, need for read/write optimization, or when commands and queries have different concerns.
Trade-offs: Steeper learning curve; more infrastructure code; potential overengineering for simple domains.
Modular Monolith with DDD Demonstrates DDD principles in a modular monolith, achieving modularity without microservices complexity. Excellent example of bounded contexts within a single deployment unit.
Sample .NET Core CQRS API REST API demonstrating CQRS with raw SQL (Dapper) for reads and DDD/EF Core for writes, using MediatR for command/query handling.
ASP.NET Core CQRS - Enterprise CRM Real-world enterprise CRM with ASP.NET Core + Angular, implementing CQRS design pattern with layered architecture and DDD best practices.
Architecture - Modern .NET Best Practices Comprehensive showcase of Clean Architecture, SOLID principles, and modern patterns including Mediator and Result patterns with folder-by-feature structure.
Microservices & Distributed Systems #
When to use: Independent deployment, polyglot persistence, team autonomy, or different scaling needs per service.
Trade-offs: Distributed system complexity; network reliability concerns; more operational overhead; harder to debug.
eShop - Microsoft Reference Application Microsoft’s official reference microservices architecture for eCommerce, showcasing cloud-native patterns, event-driven communication, and container orchestration.
.NET Starter Kit Modern .NET template with built-in multitenancy support, providing production-ready starting point for SaaS applications with modular architecture.
Alternative Approaches #
Evolutionary Architecture by Example Demonstrates how systems can evolve over time while maintaining architectural integrity. Shows practical refactoring paths between architectural styles.
Vertical Slice Architecture Example Jimmy Bogard’s implementation organizing code by features rather than technical layers. Each slice contains all the code needed for a specific feature, reducing coupling.
How to Use These Repositories #
For Architectural Decisions:
- Start by identifying your constraints (team size, complexity, timeline)
- Review the “When to use” guidance for each pattern above
- Explore 2-3 relevant repositories to understand implementation details
- Consider starting simpler (Clean Architecture or Modular Monolith) and evolving as needed
Suggested Learning Path:
- Beginner: Start with Clean Architecture (Jason Taylor or Ardalis) to understand separation of concerns
- Intermediate: Explore DDD/CQRS examples to handle complex domains
- Advanced: Study microservices and evolutionary architecture for distributed systems
Evaluating Against Your Needs:
- Clone repos that match your target pattern
- Study their folder structure and dependency flow
- Look at how they handle cross-cutting concerns (logging, validation, errors)
- Assess the complexity vs. value trade-off for your team
Common Pitfall: Don’t copy patterns blindly. Understand the problems they solve and only adopt complexity when it provides clear value.