Enterprise software architecture repository implemented as production-ready boilerplates. This repository is your comprehensive guide to understanding, comparing, and implementing different architectural patterns in real-world projects.
Architecture based on the separation of concerns in concentric layers, prioritizing independence from frameworks and databases.
Ideal use cases:
- Enterprise RESTful APIs
- Microservices with complex business logic
- Applications requiring high testability
- Long-term projects with large teams
Architecture centered on the business domain, using tactical and strategic patterns to model complex systems.
Ideal use cases:
- Systems with highly complex business logic
- E-commerce, finance, insurance
- Applications with multiple bounded contexts
- Constantly evolving systems
Event-based architecture for highly scalable distributed and asynchronous systems.
Ideal use cases:
- Real-time processing systems
- Decoupled microservices
- IoT applications
- Notification and messaging systems
SoftwareArchitecture/
├── docs/ # Detailed documentation
│ ├── clean-architecture/ # Clean Architecture Guide
│ ├── ddd/ # DDD Guide
│ ├── eda/ # EDA Guide
│ └── principles/ # SOLID, Clean Code
├── src/ # Implementations
│ ├── CleanArchitecture/ # Clean Architecture Project
│ │ ├── API/ # Presentation layer
│ │ ├── Application/ # Use cases
│ │ ├── Domain/ # Entities and business logic
│ │ ├── Infrastructure/ # External implementations
│ │ └── Tests/ # Unit and integration tests
│ ├── DDD/ # DDD Project
│ │ ├── API/
│ │ ├── Application/
│ │ ├── Domain/
│ │ ├── Infrastructure/
│ │ └── Tests/
│ └── EDA/ # EDA Project
│ ├── API/
│ ├── EventHandlers/
│ ├── Domain/
│ ├── Infrastructure/
│ └── Tests/
├── frontend/ # Frontend examples
│ ├── angular-example/ # Angular client
│ └── nextjs-example/ # Next.js client
├── docker/ # Dockerfiles
└── kubernetes/ # K8s Manifests
- JWT Authentication with refresh tokens
- Keycloak Integration for enterprise SSO
- Auth0 as a cloud alternative
- Rate Limiting for abuse protection
- CORS properly configured
- HTTPS enforced in production
- Secrets management with environment variables
- Swagger/OpenAPI 3.0 with complete documentation
- API Versioning (v1, v2)
- Standard pagination, filtering, and sorting
- Validation using FluentValidation
- Centralized error handling with Problem Details (RFC 7807)
- Health checks for monitoring
- SQL Server with Entity Framework Core
- PostgreSQL with full support
- Automated migrations
- Repository Pattern implemented
- Unit of Work for transactions
- Database seeding for development
- Docker optimized multi-stage builds
- Kubernetes manifests (Deployments, Services, ConfigMaps, Secrets)
- Health checks for orchestrators
- Structured logging with Serilog
- Metrics with Prometheus
- Distributed tracing with OpenTelemetry
- SOLID principles applied
- Clean Code throughout the codebase
- Design Patterns (Repository, Factory, Strategy, CQRS, Mediator)
- Dependency Injection native to .NET
- Async/Await for I/O operations
- Unit Tests with xUnit
- Integration Tests with WebApplicationFactory
- Test Containers for databases
- Mocking with Moq
- Code Coverage > 80%
- .NET 8.0 (LTS)
- C# 12
- ASP.NET Core Web API
- Entity Framework Core 8
- MediatR (CQRS/Mediator pattern)
- AutoMapper
- FluentValidation
- Serilog
- Angular 17+ (TypeScript)
- Next.js 14+ (React, TypeScript)
- Tailwind CSS
- Axios/Fetch for API calls
- SQL Server 2022
- PostgreSQL 16
- RabbitMQ
- MassTransit (.NET)
- JWT (JSON Web Tokens)
- Keycloak (Open Source)
- Auth0 (SaaS)
- Docker & Docker Compose
- Kubernetes
- GitHub Actions (CI/CD)
# Install .NET 8 SDK
dotnet --version # Must be 8.0+
# Install Docker
docker --version
# Install Docker Compose
docker-compose --version# Clean Architecture
cd src/CleanArchitecture
docker-compose up
# DDD
cd src/DDD
docker-compose up
# EDA
cd src/EDA
docker-compose upThe API will be available at http://localhost:5000 and Swagger at http://localhost:5000/swagger
# 1. Clone the repository
git clone <repository-url>
cd Software-Architecture-Lab
# 2. Choose an architecture (example: Clean Architecture)
cd src/CleanArchitecture/API
# 3. Restore dependencies
dotnet restore
# 4. Configure connection string in appsettings.Development.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=CleanArchDB;User Id=sa;Password=YourPassword123;TrustServerCertificate=True"
}
}
# 5. Apply migrations
dotnet ef database update --project ../Infrastructure
# 6. Run the application
dotnet run
# The API will be at https://localhost:7001# 1. Build Docker images
docker build -t clean-architecture-api:latest -f docker/CleanArchitecture.Dockerfile .
# 2. Apply Kubernetes manifests
kubectl apply -f kubernetes/clean-architecture/
# 3. Verify pods
kubectl get pods
# 4. Access the API
kubectl port-forward svc/clean-architecture-api 5000:80- Pros and cons
- Comparison with other architectures
- Real-world use cases
- Best practices
- Step-by-step implementation
- Tactical patterns (Entities, Value Objects, Aggregates)
- Strategic patterns (Bounded Contexts, Context Mapping)
- Ubiquitous Language
- Hexagonal architecture
- E-commerce examples
- Event Sourcing
- CQRS (Command Query Responsibility Segregation)
- Messaging with RabbitMQ
- Sagas and orchestration
- Event Storming
// Basic configuration included
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options => { /* ... */ });// Protection against abuse
services.AddRateLimiter(options => {
options.AddFixedWindowLimiter("fixed", options => {
options.Window = TimeSpan.FromMinutes(1);
options.PermitLimit = 100;
});
});See full documentation in docs/authentication/keycloak.md
# Run all tests
dotnet test
# Run with coverage
dotnet test /p:CollectCoverage=true /p:CoverageReportFormat=opencover
# Integration tests (requires Docker)
dotnet test --filter Category=Integration| Feature | Clean Architecture | DDD | EDA |
|---|---|---|---|
| Complexity | Medium | High | High |
| Learning Curve | Medium | High | High |
| Scalability | High | High | Very High |
| Testability | Very High | High | Medium |
| Maintainability | Very High | High | Medium |
| Performance | High | High | Very High |
| Best For | APIs, Microservices | Complex domains | Distributed systems |
| Team Size | Small-Large | Medium-Large | Large |
- Clean Architecture - Robert C. Martin (Uncle Bob)
- Domain-Driven Design - Eric Evans
- Implementing Domain-Driven Design - Vaughn Vernon
- Building Event-Driven Microservices - Adam Bellemare
See full guide in docs/principles/SOLID.md
See full guide in docs/principles/CleanCode.md
Contributions are welcome! Please:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License. See LICENSE for more details.
For questions, suggestions or issues, please open an issue on GitHub.
Happy Coding!