How xorazm92/crm_back works
Main Components
• Backend API: Represented by the NestJS application. Notice the “src/api” directory, which is subdivided into specific domains such as admin, assignments, attendance, auth, course, dashboard, fileupload, group, lesson, student, submissions, and teacher. Each module encapsulates its own controllers, services, and DTOs.
• Frontend Client: Found in “src/client” – it consists of React components (pages, layouts, etc.) that serve as the user interface.
• Database: Managed through Prisma (files in “prisma” directory, migrations, schema, and seed file). This indicates a relational database backend which can be represented as a separate data store.
• Shared Utilities & Infrastructure: The common and infrastructure folders include cross-cutting concerns such as decorators, guards, exception handling, logging, configuration, and libraries (custom JWT, bcrypt, pagination, etc.). These components support both the backend business logic and overall application stability.
• External Configurations & Deployment Artifacts: Files like Docker Compose, environment examples, and build configurations indicate that the deployment and operational environment is also part of the design (containerization, CI/CD considerations).
Relationships and Interactions
• The Frontend and Backend communicate via HTTP(S) requests: the React client makes API calls to the NestJS backend endpoints.
• The Backend is organized in a modular fashion where each module (admin, auth, etc.) controls its own domain logic. These modules often call shared utilities (custom JWT, base-services, and exception filters) that manage security, logging, and error handling.
• The Backend interacts with the underlying database through Prisma. All database-related changes (migrations, schema updates, and seeding) are managed here.
• External libraries (e.g., NestJS core, custom middlewares, decorators, guards) integrate with these modules to enforce business rules and secure operations.
• Development and deployment tools (Docker Compose, ESLint, Prettier) aren’t part of runtime architecture, but indicate the system’s build and deployment pipeline.
Architectural Patterns and Design Principles
• Modular Design: Each domain (or microfeature) is encapsulated in its module (controller, service, DTO), aligning with NestJS’s modular architecture.
• Layered Architecture: There is a clear separation between the API layer (controllers), business logic (services), and data access layer (Prisma-managed database).
• Separation of Concerns: The “common”, “infrastructure”, and “config” directories suggest the internal decoupling of cross-cutting concerns such as authentication, logging, and error handling.
• Client-Server Separation: The “src/client” directory stands alone from backend logic, emphasizing distinct development and deployment cycles.