How dthuy0224/hr-system works
Main Components
• Frontend: Represented by the “public” folder (static assets like JavaScript, CSS, images) and “views” directory (EJS templates). Highlight that the frontend handles the presentation layer for different user roles (Admin, Employee, Manager, Accounts Manager).
• Backend: The central Express application encapsulated in app.js, with the “routes” folder containing separate route files for admin, employee, and manager functions. The “config” folder (including passport.js) represents configuration (such as authentication) and middleware logic may be found in “routes/middleware.js”.
• Database: Referenced through db.js and the connection to MongoDB mentioned in the README. This will be a central data repository that holds employee records, attendance, projects, payslips, etc.
• Models: Found in the “models” directory, these files (attendance.js, leave.js, payslip.js, etc.) represent the data structures and business logic tied to the database.
• Seed Data: The “seed” folder with user-seeder.js and project-seeder.js indicates initial data population to bootstrap the application.
• Tests: The “test” directory which holds automated tests for routes and overall application functionality.
Relationships and Interactions
• That route files in the “routes” folder delegate requests to the appropriate business logic, often interacting with the “models” to query or modify data in the database.
• Authentication and role-based access control (configured in “config/passport.js” and “routes/middleware.js”) that govern permission levels for Admins, Employees, Project Managers, and Accounts Managers.
• How Seed components preload essential data that the backend uses upon startup.
Architectural Patterns & Design Principles
• Separation of Concerns: There’s clear separation between the presentation (views/public), application (routes, controllers in app.js), business logic (models), and data layers.
• MVC Pattern: Although not strictly enforced by framework conventions, there is an MVC-like structure with views (EJS templates), models (business logic), and controllers (Express routes).
• Role-Based Access: Emphasize the differentiated modules for various users as described in the README.
• Use of Middlewares: Indicate that middleware functions for authentication and request handling are integrated (e.g., inside the routes/middleware.js file).
Technologies, Frameworks, and Libraries
• Backend: Node.js with Express framework, Passport for authentication.
• Frontend: HTML, Bootstrap, JavaScript, jQuery, and additional JavaScript libraries found in “public/javascripts.”
• Database: MongoDB (as instructed in the README).
• Testing framework for backend integration tests (as seen in the “test” folder).