Prjoect Developed with .NET 9, Minimal APIs, MongoDB for persistence, and CQRS with MediatR for separation of concerns. The project follows best practices.
- Features
- Technologies Used
- Project Structure
- Installation
- Instructions for Configuration
- Usage
- License
- Clean Architecture:
- Clear separation of concerns into
Domain
,Application
,Infrastructure
, andPresentation
layers.
- Clear separation of concerns into
- Minimal APIs:
- Lightweight and fast routing for HTTP endpoints.
- MongoDB Integration:
- Flexible NoSQL database with centralized
MongoDbContext
.
- Flexible NoSQL database with centralized
- CQRS with MediatR:
- Command-query separation with pipeline behaviors.
- Validation:
- Input validation using FluentValidation.
- Error Handling:
- Middleware for consistent exception handling.
- Interactive API Documentation:
- Auto-generated Swagger UI.
- .NET 9: Modern framework for web applications.
- MongoDB: NoSQL database for scalable data storage.
- MediatR: CQRS pattern with request/response handlers.
- FluentValidation: Robust input validation framework.
- Swagger: API documentation and testing tool.
CleanArchitectureDotNet9
βββ CleanArchitectureDotNet9.Domain
β βββ Entities
β β βββ User.cs
β βββ Common
β βββ BaseModel.cs
βββ CleanArchitectureDotNet9.Application
β βββ Common
β β βββ ValidationBehavior.cs
β β βββ SystemExceptions.cs
β βββ Features
β β βββ UserFeatures
β β βββ Add
β β βββ AddUserHandler.cs
β β βββ AddUserMapper.cs
β β βββ AddUserRequest.cs
β β βββ AddUserResponse.cs
β β βββ AddUserValidator.cs
β βββ Behaviors
β β βββ ValidationBehavior.cs
β βββ Repository
| βββ ICommon
β β βββ IBaseRepository.cs
| βββ UserRepository
β βββ IUserRepository.cs
βββ CleanArchitectureDotNet9.Infrastructure
β βββ Persistence
β β βββ DotNetContext.cs
β βββ Repositories
β β βββ BaseRepository.cs
β β βββ UserRepository.cs
β βββ Settings
β βββ MongoSettings.cs
βββ CleanArchitectureDotNet9.Presentation
β βββ Endpoints
β β βββ UserEndpoints.cs
β βββ Extensions
β β βββ ErrorHandlerExtensions.cs
β β βββ CorsExtensions.cs
β β βββ SwaggerExtensions.cs
β β βββ ApiBehaviorExtensions.cs
β βββ Program.cs
βββ appsettings.json
To get started with the DotNetFireStore project, follow these steps:
- Clone the Repository:
git clone https://github.com/MohanedZekry/CleanArchitectureDotNet9.git
-
Open your
appsettings.json
file in your .NET Core project. -
Locate the database configuration section, which should look like this:
"MongoDB": { "ConnectionString": "your-connection-string", "DatabaseName": "your-db-name" },
Replace the placeholders with your actual connections project details:
After setting up the project, you can start using it to interact with MongoDb.
This project is licensed under the MIT License. See the LICENSE file for details.