How agarci1994/kairos-backend works
Main Components
• Application Core:
• Entry Point: Represent the main.ts file that bootstraps the NestJS application.
• Root Module: Mark the app.module.ts which aggregates the modules and provides the configuration.
• Modules:
• Tasks Module: Highlight this module as it encapsulates functionality for image processing and task querying. Indicate both its REST controllers and its substructure.
• Common: Show a section for common utilities/enums/configurations (files in src/common) which might be shared across modules.
• Domain Layer:
• Domain Entities: Include elements such as task.schema.ts that describe the MongoDB model for tasks.
• Domain Repositories & Interfaces: Represent the contracts from the domain (tasks.interface.ts) that define how tasks are handled and persisted.
• Infrastructure Layer:
• Repositories Implementation: Include the repository implementation for tasks (tasks.repository.ts) which interacts directly with MongoDB.
• Image Processor: Represent the image-processor service (and its tests) which handles the image manipulation using Sharp.
• External Dependencies:
• Image Processing Library: Indicate Sharp as an external library responsible for image processing.
• Testing: Mention the testing framework (Jest with Supertest) as well as integration tests (see files in test/).
Relationships and Interactions
• How HTTP requests hit the Task Controller (task.controller.ts), which then calls the business logic in Tasks Service.
• How Tasks Service communicates with its repository layer to perform database operations.
• Image processor service being called within the tasks module to process image uploads before saving results.
Architectural Patterns & Design Principles
• That the design uses a clean separation of concerns and follows a domain-driven architecture:
• Domain Layer: Core business logic and entities.
• Infrastructure Layer: Database and external service implementations.
• Application Layer: Controllers that manage HTTP requests.
• That dependency inversion is applied by exposing interfaces (such as tasks.interface.ts) so that the infrastructure can swap implementations if needed.
Relevant Technologies, Frameworks, and Libraries
• NestJS & TypeScript framework for building the application.
• Mongoose for MongoDB schema modeling and data persistence.
• Sharp for image processing tasks.
• Jest and Supertest for writing and executing tests.
• Configuration and code formatting tools (ESLint, Prettier).
Elements
• From the HTTP client to the REST controller.
• From the controller to the service.
• From the service to the repository.
• From the repository to the MongoDB database.
• From the service to the image processor service.