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.