How bentran1vn/mbs-command works
Project and Its Purpose
• The project is part of a Mentor Booking System that serves three distinct user roles (Students, Mentors, Admins) through a clean, modular backend architecture.
• The README confirms features like CQRS, Repository, Outbox, and Idempotency patterns, indicating a structured approach to separating read (using MongoDB) and write (using MSSQL Server) operations.
File Structure
• The repository is organized into multiple modules/layers that reflect a Clean Architecture:
• MBS-COMMAND.API: Acts as the API entry point, configuring middleware (exception handling, JWT, Swagger) and hosting the ASP.NET Core application.
• MBS_COMMAND.Application: Contains abstractions, command handlers (CQRS pattern), validator and pipeline behaviors, and dependency injection setup for the application layer.
• MBS_COMMAND.Contract: Defines common contracts, messages, enumerations, and shared types for inter-module communication.
• MBS_COMMAND.Domain: Houses domain entities, aggregates, business rules, exceptions and interfaces that capture the core business logic.
• MBS_COMMAND.Infrastucture: Implements cross-cutting concerns like caching (Redis), authentication (JWT), mailing, media handling (Cloudinary) and background jobs, plus the integration with RabbitMQ/MassTransit.
• MBS_COMMAND.Persistence: Implements the database logic using EF Core, with configurations, migrations and the repository base pattern to interact with MSSQL Server (and possibly MongoDB for read operations).
• MBS_COMMAND.Presentation: Contains REST API-specific endpoint implementations and global configuration to expose functionalities to external clients.
• Supporting files for Docker, GitHub workflows, and launch settings complete the build/deployment automation and containerization.
Main Components and Their Relationships
• API Gateway/Entry-point: (MBS-COMMAND.API) responsible for handling incoming requests and dispatching them to appropriate endpoints.
• Application Layer: (MBS_COMMAND.Application) orchestrates command and query handling using the Mediator pattern (MediatR) and contains pipeline behaviors for logging, validation, performance measurement, etc.
• Domain Layer: (MBS_COMMAND.Domain) centralizes business logic and domain entities, ensuring the core rules and invariants.
• Infrastructure Layer: (MBS_COMMAND.Infrastucture) provides implementation details for external systems (caching with Redis, sending emails, handling media uploads) and integrates RabbitMQ/MassTransit for reliable messaging alongside implementing the Outbox pattern.
• Persistence Layer: (MBS_COMMAND.Persistence) manages EF Core based interactions including context, configurations, repository implementations, and database migrations for transactional (MSSQL) data persistence. It also supports converting domain events to outbox messages.
• Presentation Layer: (MBS_COMMAND.Presentation) exposes API endpoints for modules such as Groups, Feedbacks, Mentor Skills, Schedules, Slots, Subjects, and Users.
Architectural Patterns and Technologies to Highlight
• Clean Architecture: Emphasize the separation of concerns by isolating the domain from infrastructure and application concerns.
• Repository & Outbox Patterns: Illustrate the repository abstraction in the domain and persistence layers and mark the Outbox pattern for consistent event handling.
• Technology stack:
• Backend: ASP.NET Core 8, EF Core, MediatR, RabbitMQ/MassTransit.
• Databases: MSSQL Server (writes/transactions), MongoDB (read-heavy operations), and caching using Redis.
• Others: Docker for containerization, GitHub Actions for CI/CD, Nginx & YARP Reverse Proxy for routing.