How eduardopires/equinoxproject works
Project Type and Purpose
• The Equinox Project is a full-stack, open-source .NET Core application.
• Its goal is to showcase best practices with technologies such as ASP.NET (MVC and WebAPI), Entity Framework Core, ASP.NET Identity, AutoMapper, MediatR, and more.
• The project implements Domain Driven Design (DDD), CQRS, Event Sourcing, and Cross-Cutting concerns via a modular, layered architecture.
Analyzing the File Structure
• The solution (Equinox.sln) is subdivided into multiple projects under the src directory, indicating a clearly separated architecture:
• Presentation Layer:
• Equinox.Services.Api – Offers RESTful API endpoints (with JWT, Swagger, etc.)
• Equinox.UI.Web – Implements the web presentation using ASP.NET MVC (includes Identity areas for user management).
• Application Layer:
• Equinox.Application – Contains application services, AutoMapper configurations, view models, and event normalizers.
• Domain Layer:
• Equinox.Domain.Core & Equinox.Domain – Hold domain models, commands, events, validations, and domain interfaces. This layer encapsulates the business rules, notifications, and domain events.
• Infrastructure/Cross Cutting:
• Equinox.Infra.CrossCutting.* – Handles messaging via an in-memory bus, identity (with custom JWT and ASP.NET Identity), and dependency injection (IoC).
• Infrastructure/Data:
• Equinox.Infra.Data – Manages data persistence including the Entity Framework context, migrations, repository implementations, and event sourcing via a SQL event store.
• Additional folders and scripts such as the SQL folder (for database setup) and Dockerfiles (for container deployments) indicate deployment and setup considerations.
Key System Components and Their Relationships
• Presentation Components:
• Equinox.Services.Api (API endpoints) and Equinox.UI.Web (web frontend) that allow client interaction.
• Application Services:
• Equinox.Application that orchestrates operations by mapping view models to domain commands and events.
• Domain Logic:
• Equinox.Domain (commands, events, and validations) and Equinox.Domain.Core handling business logic following DDD principles.
• Infrastructure and Data Persistence:
• Equinox.Infra.Data implements repositories, unit of work and event sourcing.
• Equinox.Infra.CrossCutting components handle aspects like identity, authorization, and dependency injection.
• Cross-Cutting Services:
• Identity (in Infra.CrossCutting.Identity), and In-memory Bus (for event publication using MediatR).
The typical data flow is as follows:
• The client (via browser or mobile) triggers a request to either the UI project or the API project.
• Controllers (in API or UI) call application services in Equinox.Application.
• The application services use domain classes (from Equinox.Domain) to execute business logic.
• Repositories from Equinox.Infra.Data access the database and store events (supporting event sourcing) and state.
• In addition, Domain Events are dispatched through a messaging bus (using MediatR, located in CrossCutting.Bus) to react asynchronously where required.
• Authentication and authorization aspects are supported by the ASP.NET Identity modules within the Infra.CrossCutting.Identity area.
Architectural Patterns and Technologies
• DDD, CQRS, Unit of Work, and Repository patterns serve as a backbone.
• Event Sourcing is implemented to track domain events.
• Dependency Injection is set up via the native .NET Core DI container and custom IoC registrations in Equinox.Infra.CrossCutting.IoC.
• AutoMapper is used to map between domain models and view models.
• MediatR plays a vital role for handling commands, notifications, and events.
• Swagger is used for API documentation and JWT is employed for token-based authentication.