How bekzodqodirovdev/nasiya_app_backend works
Main Components
• API Modules: Represent the various API endpoints available in the project. This includes modules like Admin, Auth, Debtor, Debts, Images (both for debtors and debts), Likes, Messages, Payment, Phone Numbers, Sample Messages, Store, and Upload. These are housed inside the “src/api” directory.
• Core Domain Layer: This comprises the entities (domain models) and repositories which implement the data access layer. They are located under “src/core/entity” and “src/core/repository”. These components capture the business objects (like admin, debtor, debt, etc.) and abstract them from the persistence mechanism.
• Common Utilities: Encompassing decorators, guards, enums, etc. (found in “src/common”) these components support cross-cutting concerns such as authorization, data validation, logging, and exception handling.
• Infrastructure & Libraries: This part (e.g., “src/infrastructure/lib/…”) provides additional helper services such as base services, implementations for encryption (Bcrypt), exception filtering, and custom pagination utilities that support the overall operation.
• Configuration & Bootstrap: The “src/config” holds configuration settings necessary for the application while “src/main.ts” handles the application startup.
Relationships and Interactions between Components
• Each API module interacts with its respective service (inside its module directory) to manage the domain logic. For instance, the Admin module includes an Admin controller, service, and DTOs which communicate with the underlying repository implementations.
• The service layer (in modules and core) will use the infrastructure components (like exception filters, bcrypt, or pagination helpers) to service client requests effectively.
• The repositories (core layer) will abstract away the data storage concerns, and they may be used by the services across various modules.
• Utilities in the “common” folder (decorators, guards, enums) are used across multiple modules to ensure consistent validation, authorization, and data flow.
Architectural Patterns and Design Principles
• Modular Architecture: The project is divided logically into multiple modules representing different business capabilities. Each module is independent — making it easier to scale or reason about each domain.
• Layered Architecture: There is a clear separation between the API/controller layer, the business logic (services), the domain (entities and repositories), and infrastructure layers.
• Use of Dependency Injection: Typical to NestJS, components such as controllers are injected with their respective services, and services use repositories transparently.
Relevant Technologies/Frameworks
• NestJS Framework – for structuring modules, controllers, and services.
• TypeScript – used throughout the project.
• PNPM – the package manager used.
• Additional NestJS tools/utilities – for exception handling, JWT authentication (guards like jwt-auth.guard.ts), and decorators.
Additional Detail
• If there are any interactions with external services (such as deployment platforms like Mau on AWS mentioned in the README), note these as separate external components.