How oscargps/bank-aseessment-back works
Main Components
• API Gateway / Entry Point: Represent the main.ts file as the application bootstrap.
• Module Structure: Separate modules such as “bank-store” (which includes sub-modules for deliveries, products, and transactions) and “core” (which handles database and health-check functionality).
• Common Components: Include the “common” directory for middleware like the API key middleware.
• Database Layer: Highlight components under “src/modules/core/database” which include entities, migrations, and seeds that handle data persistence using TypeORM and PostgreSQL.
• External Services: Note the integration points for external APIs (for example, WOMPI and Bank APIs) as mentioned in the environment variables and service files.
• Testing: Include a note about tests (Jest specs) to indicate supporting components for verifying functionality.
Relationships and Interactions
• Flow from the client making an HTTP request to the API, which is handled by controllers in different modules (deliveries.controller, products.controller, transactions.controller, health-check.controller).
• That controllers delegate business logic to their corresponding services in the “infrastructure/services” directories.
• Connection between the domain layer (DTOs and business logic) and the persistence layer (entities defined in the “core/database/domain/entities”).
Architectural Patterns and Design Principles
• Layered Architecture: Demonstrate separation between the API layer (controllers), business logic (services, mappers, and utilities), and data persistence (repositories/entities).
• Dependency Injection: Emphasize that each module (and even middleware) leverages NestJS’s DI container to manage service dependencies.
• Clean Separation of Concerns: Each module (e.g., transactions, deliveries, products) has its own substructure dividing domain types, controllers, and services.
Specify Technologies & Frameworks
• NestJS for the API framework
• TypeScript for static typing and modern JavaScript features
• TypeORM for Data Access and ORM
• PostgreSQL as the database engine
• Jest for testing and Swagger/OpenAPI for documentation
Detailing the Essential Elements
• Connecting lines to represent that controllers in each module depend on service layers, which in turn interact with the database layer.