How baptistelecat/dhomotic-api works
Main Components Identification
a. API Gateway/Controller Layer: Represent the controller endpoints (e.g., weekplan controllers) that route incoming HTTP requests.
b. Core Modules: Zoom into each domain module:
• Auth Module: Contains strategies (API key, JWT), guards, entities (auth-user), and services (auth and firebase auth). It handles user authentication and authorization.
• Meal Module: Manages meal entities and associated converters and services to transform and manipulate meal data.
• ProductItem Module: Manages product item entities, converters, and services related to product items.
• User Module: Handles user entities (user, nestedUser), converters, and related business logic.
• Weekplan Module: This module is a bit more extensive. It contains controllers for weekplan endpoints; converters (for menu, menuMeal, cartProduct, cartProductItem, weekplan); DTOs for data transfer and validation; entities for representing weekplan and its components; and corresponding services to execute business logic.
c. Infrastructure/Providers: The Firebase provider used to connect, authenticate, and manage interactions with Firebase services (FireStore, auth, etc.).
d. External Interfaces: Include connections to Firebase (both export/import paths for authentication and Firestore data) and any deployment pipelines (Dockerfile, CI/CD workflow integrations).
Relationships and Interactions
a. Central NestJS application where the app.module.ts bundles and integrates all modules.
c. Internal data flow within each module, such as:
• The Auth module using guards, strategies, and services to validate user credentials.
• The Weekplan module’s controller calling its service, which internally uses converters to translate DTOs into entity representations and vice versa.
d. Interactions with Firebase for authentication and persistence layers.
e. Link external CI/CD components and deployment (aligned with GitHub workflows and Docker configuration) as separate infrastructure nodes that interact with repository updates.
Architectural Patterns and Design Principles
a. Modular Design: Clearly indicate that each domain (auth, meal, productItem, user, weekplan) is self-contained with its own controllers, services, entities, and converters.
b. Clean Separation of Concerns: For example, converters transform data between representations, while services encapsulate business logic.
c. Use of Dependency Injection: NestJS modules integration manages dependencies across modules.
d. External API Integration: Emphasize Firebase integration as a key external service.