How nhtbao101/be-accessories-store works
Main Components
• NestJS Framework Core – Represent the NestJS application at the heart of the system.
• Modular Components – Break down the application into its primary modules:
• Auth Module: Handles authentication including the strategies, guards, controllers, and DTOs.
• Admin Module: Manages administrative functionalities, including sub-modules like the user management portion under admin.
• User, Product, and Categories Modules: These are cleanly separated to encapsulate domain logic.
• Database Layer – Represent Prisma as the ORM tool with its schema (prisma/schema.prisma) and migration structure.
• Shared Module – Contains configuration, helper functions, and standardized response handling which can be used across modules.
• Infrastructure Components – Include deployment, CI/CD configurations (GitHub Actions in .github/workflows and other configuration files like .prettierrc, .eslintrc.js).
Relationships and Interactions
• Controllers interact with Services: Each module has its own controller that receives API requests and passes them to service components.
• Services call upon Repositories or Prisma Service: For data persistence and complex business logic, services either use specific repository patterns (e.g., in the Auth module) or leverage the centralized Prisma module (src/prisma).
• Module Dependencies: Although modules are isolated, they might interact (for instance, the Auth module might be utilised by other modules for access control via guards and interceptors).
• Integration with External Tools: Highlight CI/CD workflows from GitHub Actions and potential deployment tools like Mau mentioned in the README.
Architectural Patterns and Design Principles
• Modular Architecture: Each domain (auth, admin, user, product, categories) is self-contained, promoting separation of concerns.
• Dependency Injection: NestJS relies extensively on dependency injection which is central in wiring controllers, services, and repositories.
• Clean Layering: The system layers (controller → service → data access) are clearly delineated.
• Use of DTOs and Guards: For input validation and role-based access control, reinforcing security and data integrity.
Relevant Technologies, Frameworks, and Libraries
• NestJS: The core framework.
• TypeScript: The language used for type safety.
• Prisma: For ORM and managing database migrations.
• Testing Tools: Jest for unit and e2e tests.
• CI/CD: GitHub Actions workflows for continuous integration.
• Linting & Formatting: ESLint and Prettier for code consistency.
Elements
• Use clear labels for each module and component (e.g., Auth Module, Admin Module, User Module, etc.).
• API/Presentation Components (Controllers)
• Business Logic Components (Services, Strategies, Guards)
• Data Layer Components (Repositories/Prisma Service, Database)
• Cross-cutting Concerns (Shared Modules, Configurations)
• Optionally, indicate the testing and CI/CD pipeline as side components that facilitate the development and deployment process.