Amazing
Welcome to the Clean Architecture template with Minimal API! This project serves as a starting point for building robust and maintainable applications using Clean Architecture principles.
This template targets .NET 8 and is organized into distinct layers, each with a specific responsibility. It's designed to help developers quickly set up a new project that adheres to best practices in software architecture.
If you find this project useful, please give it a star. Thanks! ⭐
The following prerequisites are required to build and run the solution:
- .NET 8.0 SDK (latest version)
- Entities: Core business objects representing data and behavior.
- Value Objects: Immutable types that represent a concept through multiple attributes.
- Specifications: Encapsulate business rules that are combinable.
- Domain Services: Handle complex business logic that doesn't fit within entities.
- Interfaces: Abstractions for services used by the application layer.
- DTOs: Data Transfer Objects for communication between layers.
- Commands and Queries: Implement the CQRS pattern for read and write operations.
- Validators: Ensure data meets required rules and constraints.
- Persistence: Implementation of data access using Entity Framework Core.
- Repositories: Classes responsible for data retrieval and storage.
- Services: External services like file storage, email senders, etc.
- Minimal API: Simplified approach to building HTTP APIs with ASP.NET Core.
- Endpoints: Define HTTP endpoints for client interactions.
- Middleware: Components that handle requests and responses.
- Clone the repository to your local machine.
- Navigate to the project directory.
- Restore dependencies using:
dotnet restore
- Run the application using:
dotnet build
The template is set to use SQLite by default. If you would like to use SQL Server instead, please open the CleanArchitecture.Infrastructure.Persistence.csproj
file and remove the UseSQLite
constant from the DefineConstants
property. Then, update the connection string in the appsettings.json
file.
<DefineConstants>UseSQLite</DefineConstants>
To add migrations and update the database, run the following commands:
dotnet ef migrations add InitialCreate --project CleanArchitecture.Infrastructure.Persistence --startup-project CleanArchitecture.Presentation
dotnet ef database update --project CleanArchitecture.Infrastructure.Persistence --startup-project CleanArchitecture.Presentation
If you are having problems, please let me know by raising a new issue.
This project is licensed with the MIT license.
Contributions are welcome! If you have ideas for improvements or encounter any bugs, feel free to open an issue or submit a pull request. Let's collaborate to make this project better. 😊