How luongxuannhat/hrm-project works
Main Components
• Server Entry Point: Represent the main Node.js server (BE/app.js and BE/server.js) which bootstraps and starts the application.
• Configuration: Include a component for “Configuration” (from BE/config). This handles environment settings, system responses, etc.
• Routing & Controllers: Show that incoming HTTP requests hit “Routes” (BE/routes) which then delegate to various “Controllers” (found in BE/controllers). Label controllers for activities like attendances, leave_requests, late_early_requests, projects, teams, system_logs, users, and work_shifts.
• Models & Database: Highlight that domain entities (e.g., Attendance, LeaveRequest, Project, User, Team, WorkShift, etc.) are defined in BE/models. Even if the actual database isn’t directly shown, these models imply a connection with a database (likely a relational DB). You might denote a “Database” component connected to these models.
• Static/Public Assets: Note that there’s a “Public” directory (BE/public) holding static assets like images and js files (for Swagger customization).
• Seeders & Swagger: Include additional components showing “Seeders” for initializing data (found in BE/seeders) and “Swagger” for API documentation (found in BE/swagger).
Relationships/Interactions
• Start the flow from “Client” sending HTTP requests to the “Server Entry Point.”
• The Server processes these requests via “Routes” which pass them on to corresponding “Controllers.”
• “Controllers” call “Services/Helpers” where additional business logic is processed.
• “Middlewares” intercept requests during their journey to validate authentication and authorization.
Architectural Patterns and Design Principles
• MVC Structure: Clearly separate Controllers (handling business logic) from Models (database entities) and include Routes that buffer between external requests and controllers.
• Middleware Chain: Show a sequence where middlewares (authentication, authorization) process requests before they reach their designated controllers.
• Service Layer: Indicate that certain common operations (logging, file upload) are abstracted into service components, enhancing modularity and reusability.
• Environment Configuration: Emphasize the use of configuration files separated under BE/config to manage environment-specific variables and responses.
Relevant Technologies
• Node.js/Express: As the runtime and web framework driving the application.
• Swagger: For API documentation, as seen in BE/swagger.
• Potential Database (not explicitly shown but implied with the use of Models): Mention this if known.
• Additional modules and libraries are managed via BE/package.json.