How diaz-adrianz/nestjs-typeorm-ts works
Main Components
• NestJS Application – the overarching container hosting all functionalities.
• Controllers – each module (e.g., Auth, Payments, Notifications, Permissions, Roles, and Users) has its own controller handling the incoming HTTP requests.
• Services – underlying business logic for each module, showing dependency injection flows from controllers.
• Modules – groups of related controllers and services which encapsulate a feature set.
• Database Layer – represented by TypeORM, with entities (e.g., user.entity, payment.entity, notification.entity) and migrations, seeding processes.
• External Integrations – include components for Redis (caching), Firebase, Minio (file storage), Mail service, and Xendit (payment gateway).
Relationships and Interactions
• How a controller calls its corresponding service to handle logic.
• That these services often interact with the database layer (via TypeORM) to query or persist data.
• Authentication flow with JWT strategies, guards, and decorators that secure routes.
• Interactions with external services (for example, the mail service calls an SMTP server, or Minio services for file uploads).
Architectural Patterns and Design Principles
• Modular structure inherent to NestJS (each core module is isolated into its own folder under “src/core”).
• How cross-cutting concerns (logging, caching, validation, exception filters, interceptors) are handled via dedicated custom modules (in “src/lib”, “src/decorators”, “src/filters”, etc.).
• Use of dependency injection to enable clean separation of concerns.
Technologies, Frameworks, and Libraries
• NestJS as the application framework.
• TypeORM for ORM-based database connectivity and migrations.
• JWT for authentication.
• Redis (likely used for caching, although integration files for cache are in “src/lib/cache”).
• Tools for file uploads and external file storage like Minio.
• Integrations with external services (Firebase and Xendit).
• Winston for logging (as seen in “src/lib/logger”).
• Email service implemented with modules in “src/lib/mail”.
Additional Elements
• Configuration and utility modules (like config files under “src/config” and utilities under “src/utils”) as supporting components, indicating that they are used by various parts of the application.
• “src/lib” directory items (cache, firebase, logger, mail, minio, xendit) clearly as integration modules that enable external communication.
• It might help to add brief notes on each interaction (e.g., “JWT Guard validates token”, “TypeORM migration applies schema changes”).