How ivanpaulovich/clean-architecture-manga works
Main Components
• Accounts API: This is the core service where the virtual wallet’s banking operations (Deposit, Withdraw, Transfer, Open/Close Account, etc.) reside. Its internal structure follows Clean Architecture with distinct layers:
• Domain Layer (Entities, ValueObjects, Domain services, etc.)
• Application Layer (Use Cases, Presenters, Interfaces for use cases, service abstractions)
• Infrastructure Layer (Data access, repositories, currency exchange, external authentication adapters)
• WebApi Layer (Controllers, API endpoints implementing different versions (V1, V2), middleware, Swagger and health checks)
• Identity Server: A dedicated service managing authentication and authorization using IdentityServer and related UI/quickstart modules.
• Wallet SPA: The React+Redux frontend that provides the consumer UI and communicates with the backend APIs.
• Database (SQL Server): Although not represented as a project folder, it is clearly referenced in the README and managed via migrations inside the Infrastructure project.
• Docker & NGINX:
• Docker Compose files and associated setup scripts indicate container orchestration for accounts-api, identity-server, wallet-spa, SQL Server, and an NGINX reverse proxy.
• The NGINX component is used to route external requests (SSL, reverse proxying) to the correct containers.
Relationships and Interactions
• Clients (Wallet SPA) interact with the backend system through NGINX, which acts as an entry point.
• The Wallet SPA makes calls to both the Accounts API (for wallet transactions) and to the Identity Server (for handling authentication flows).
• Within the Accounts API, the WebApi controllers receive HTTP requests, then forward them to use case classes in the Application layer. The Application layer, in turn, interacts with the Domain model (entities like Account, Credit, Debit, etc.) and uses the Infrastructure layer for persistence (Entity Framework Core and repositories) and external services (like CurrencyExchange).
• The Identity Server handles authentication tasks, provides OpenID Connect endpoints, and serves login, consent, and account management pages.
• Docker Compose ties these containers together, ensuring the services are network-accessible within a containerized environment.
Architectural Patterns and Design Principles
• Clean Architecture: Clearly demonstrated by the separation between Domain, Application, Infrastructure, and Presentation (Web Api and SPA) layers.
• Use Cases as Organizing Structures: Each business operation (e.g., OpenAccount, Transfer) is self-contained in its own use-case folder.
• Hexagonal/Onion Architecture: The core business rules are isolated from external dependencies (e.g., data access and external authentication).
• MVC Elements and API Versioning: Demonstrated from the WebApi project structure (with V1 and V2 directories) and custom API conventions.
• Docker-based Deployment: Containerization is used to manage multi-service deployment which is critical in a modern microservices environment.
Elements to Always Include
• Clearly labeled components (e.g., “Accounts API – Domain Layer”, “Accounts API – WebApi”, “Identity Server”, “Wallet SPA”, “SQL Server DB”, “NGINX Reverse Proxy”).
• Annotations such as “Clean Architecture Layers” with brief notes on the purpose of each component.
• Footnotes or legends that explain the use cases and architectural choices, ideally referencing the Clean Architecture and modularity aspects as per the README.