How juanpabloleonf/microservice-series works
Main Components
• API Layer (Presentation/Interface): Represented by the REST controllers found under app/src/infrastructure/inputs/rest/controllers. These controllers translate HTTP requests into application calls.
• Application Layer: Contains the use cases, DTOs, and handlers (i.e., the business logic) under app/src/application. This is where request DTOs are handled and converted into domain actions.
• Domain Layer: Holds the core business models, domain interfaces (services), persistence interfaces, and domain-specific use cases (in app/src/domain). This layer represents the core business rules and entity models for Series, Season, and Chapter.
• Infrastructure Layer: Includes both inputs (API specifics) and outputs such as the MySQL-related repositories, entity mappings, and configuration. The infrastructure adapters (e.g., MySQL repositories in app/src/infrastructure/outputs/mysql) implement persistence interfaces from the domain layer.
• Configuration and Dependency Injection: Found under app/configuration, this component sets up the environment, dependency injections, global error handling, and CORS, integrating all other components.
• External Dependencies/Services: Include the MySQL database (for persistence), Docker engine for container orchestration, and external tools (Swagger for API documentation, Cryptography libraries, etc.).
Out the Relationships and Interactions
• HTTP Request → Controller → Request DTO behavior.
• The Application layer then interacts with the Domain Layer’s use cases:
• Application handler → Domain use cases → Domain models and business rules.
• The Domain Layer defines interfaces (ports) for persistence; its implementations are provided by the Infrastructure layer (MySQL repositories and adapters).
• Finally, error handling, validation (via Pydantic), and dependency injection configurations that bind all these layers are also highlighted.
Architectural Patterns and Key Technologies
• Hexagonal Architecture (Ports & Adapters): Emphasize the clear separation where the application’s core (Domain and Application layers) remains independent of external delivery mechanisms (REST controllers) and storage mechanisms (MySQL repositories).
• Technology Stack:
• FastAPI (API and controllers)
• SQLAlchemy (via repositories and ORM concepts)
• Pydantic (data validation)
• MySQL (persistent storage)
• Docker (containerization)
• Additional libraries for cryptography and error handling