How thewizardshell/doctorchat-api works
Main Components
• Client/External Interface: Represent how clients (such as web/mobile or API consumers) interact with the system via HTTP requests.
• Core Application: The NestJS server itself, which is constructed around the application module (“app.module.ts”) that aggregates all the feature modules.
• Feature Modules:
• Auth Module – handles authentication and authorization (contains auth.controller.ts, auth.service.ts).
• Chat Module – likely handles chat communications (with its own controller and service).
• Citas Module – manages appointments or similar “citas” functionality.
• Informes Module – responsible for reports or medical/informative outputs.
• Domain/Entities Layer: Organized by domains (User, Doctor, AI) with repositories, interfaces, and tests. This layer underpins the persistence logic.
• Use Cases: Separate “use_cases” directory encapsulates business logic for commands like “register-user”, “register-doctor”, “register-cita”, and handling responses from AI integrations.
• External Services/Integrations:
• Firebase Service – under “src/services/firebase” with its own firebase configuration.
• Possibility of external integrations (like external chat systems, AI-based response processing) add up here.
Relationships and Interactions
• Within each module, indicate that Controllers delegate business logic to Services.
• Services, in turn, interact with the Data/Entities layer (through repositories) and trigger Use Cases when more elaborate business rules are processed.
• A link from the Use Cases layer back to Services or directly to Entities to represent data persistence or additional logic.
• Firebase as an External Integration component that is accessed by its dedicated service (firebase.service.ts).
Architectural Patterns and Design Principles
• Modular architecture with a clear separation between controllers (handling input/output), services (acting as business logic handlers), and repositories/entities (managing data and persistence).
• Use of a use case pattern where individual business operations are encapsulated in dedicated files.
• If applicable, illustrate any dependency injection patterns used by NestJS, where the AppModule orchestrates dependencies.
Relevant Technologies
• Node.js as the runtime environment.
• TypeScript for strong typing.
• NestJS as the primary framework.
• Firebase for some parts of the service layer.
• Testing frameworks (indicated in the “test” and “jest.e2e.json”) for validating endpoints and business logic.