# tarunre12/salary-management-system architecture

> Architecture diagram of the GitHub repository tarunre12/salary-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tarunre12/salary-management-system
- Repository: https://github.com/tarunre12/salary-management-system

## Overview

Salary Management System: employees register or log in, then use protected dashboards to record attendance and review salary summaries; administrators review workforce totals and export reports. The React client communicates with Express authentication and attendance routes, which apply authorization and use MongoDB-backed models. The graph preserves the documented PDF reporting capability. Some page implementations and database wiring were not excerpted; those links are limited to indexed references or documented architecture.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/App.jsx) (App routing), [`Frontend/src/api.js`](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/api.js) (API client), [`Backend/index.js`](https://github.com/tarunre12/salary-management-system/blob/main/Backend/index.js) (Express API), [`Backend/routes/auth.routes.js`](https://github.com/tarunre12/salary-management-system/blob/main/Backend/routes/auth.routes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_login["Login page<br/>[Login.jsx]"]
  node_registration["Registration page<br/>[Register.jsx]"]
  node_user_dashboard["User dashboard<br/>[UserDashboard.jsx]"]
  node_admin_dashboard["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_client_api["API client<br/>[api.js]"]
end

subgraph group_identity["Identity and access"]
  node_protected_route["Protected route<br/>[ProtectedRoute.jsx]"]
  node_auth_context["Auth context<br/>[AuthContext.jsx]"]
  node_express_app["Express API<br/>[index.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_auth_controller["Auth controller"]
  node_auth_middleware["Auth middleware<br/>[auth.middleware.js]"]
  node_token_config["JWT generation<br/>[token.js]"]
end

subgraph group_attendance["Attendance and salary"]
  node_attendance_routes["Attendance routes"]
  node_attendance_controller["Attendance and summaries"]
end

subgraph group_persistence["Persistence"]
  node_user_model[("User records<br/>[user.model.js]")]
  node_attendance_model[("Attendance records")]
  node_db_connection["Database connection<br/>[db.js]"]
end

node_employee(("Employee"))
node_administrator(("Administrator"))
node_mongodb[("MongoDB")]

node_employee -->|"uses"| node_app
node_administrator -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_registration
node_app -->|"routes to"| node_user_dashboard
node_app -->|"routes to"| node_admin_dashboard
node_app -->|"guards routes"| node_protected_route
node_app -->|"provides auth"| node_auth_context
node_protected_route -->|"checks session"| node_auth_context
node_auth_context -->|"checks session"| node_client_api
node_login -.->|"sends credentials"| node_client_api
node_registration -.->|"submits details"| node_client_api
node_user_dashboard -.->|"requests attendance"| node_client_api
node_admin_dashboard -->|"loads summaries"| node_client_api
node_client_api -->|"HTTP requests"| node_express_app
node_express_app -->|"connects database"| node_db_connection
node_express_app -->|"mounts routes"| node_auth_routes
node_express_app -->|"mounts routes"| node_attendance_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"protects check"| node_auth_middleware
node_attendance_routes -->|"protects endpoints"| node_auth_middleware
node_attendance_routes -->|"dispatches"| node_attendance_controller
node_auth_controller -->|"reads and creates"| node_user_model
node_auth_controller -->|"generates token"| node_token_config
node_auth_middleware -->|"loads user"| node_user_model
node_attendance_controller -->|"reads and writes"| node_attendance_model
node_attendance_controller -->|"loads users"| node_user_model
node_db_connection -.->|"connects"| node_mongodb

click node_app "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/App.jsx"
click node_login "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/Login.jsx"
click node_registration "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/Register.jsx"
click node_user_dashboard "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/UserDashboard.jsx"
click node_admin_dashboard "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/AdminDashboard.jsx"
click node_protected_route "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/components/ProtectedRoute.jsx"
click node_auth_context "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/context/AuthContext.jsx"
click node_client_api "https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/api.js"
click node_express_app "https://github.com/tarunre12/salary-management-system/blob/main/Backend/index.js"
click node_auth_routes "https://github.com/tarunre12/salary-management-system/blob/main/Backend/routes/auth.routes.js"
click node_auth_controller "https://github.com/tarunre12/salary-management-system/blob/main/Backend/controllers/auth.controllers.js"
click node_auth_middleware "https://github.com/tarunre12/salary-management-system/blob/main/Backend/middleware/auth.middleware.js"
click node_token_config "https://github.com/tarunre12/salary-management-system/blob/main/Backend/config/token.js"
click node_attendance_routes "https://github.com/tarunre12/salary-management-system/blob/main/Backend/routes/attendance.routes.js"
click node_attendance_controller "https://github.com/tarunre12/salary-management-system/blob/main/Backend/controllers/attendance.controllers.js"
click node_user_model "https://github.com/tarunre12/salary-management-system/blob/main/Backend/Models/user.model.js"
click node_attendance_model "https://github.com/tarunre12/salary-management-system/blob/main/Backend/Models/attendance.model.js"
click node_db_connection "https://github.com/tarunre12/salary-management-system/blob/main/Backend/config/db.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_login,node_registration,node_user_dashboard,node_admin_dashboard,node_client_api toneBlue
class node_protected_route,node_auth_context,node_express_app,node_auth_routes,node_auth_controller,node_auth_middleware,node_token_config,node_mongodb toneAmber
class node_attendance_routes,node_attendance_controller toneMint
class node_user_model,node_attendance_model,node_db_connection toneRose
class node_employee,node_administrator toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Login page](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/Login.jsx): `Frontend/src/pages/Login.jsx`
- [Registration page](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/Register.jsx): `Frontend/src/pages/Register.jsx`
- [User dashboard](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/UserDashboard.jsx): `Frontend/src/pages/UserDashboard.jsx`
- [Admin dashboard](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/pages/AdminDashboard.jsx): `Frontend/src/pages/AdminDashboard.jsx`
- [API client](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/api.js): `Frontend/src/api.js`

### Identity and access

- [Protected route](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/components/ProtectedRoute.jsx): `Frontend/src/components/ProtectedRoute.jsx`
- [Auth context](https://github.com/tarunre12/salary-management-system/blob/main/Frontend/src/context/AuthContext.jsx): `Frontend/src/context/AuthContext.jsx`
- [Express API](https://github.com/tarunre12/salary-management-system/blob/main/Backend/index.js): `Backend/index.js`
- [Auth routes](https://github.com/tarunre12/salary-management-system/blob/main/Backend/routes/auth.routes.js): `Backend/routes/auth.routes.js`
- [Auth controller](https://github.com/tarunre12/salary-management-system/blob/main/Backend/controllers/auth.controllers.js): `Backend/controllers/auth.controllers.js`
- [Auth middleware](https://github.com/tarunre12/salary-management-system/blob/main/Backend/middleware/auth.middleware.js): `Backend/middleware/auth.middleware.js`
- [JWT generation](https://github.com/tarunre12/salary-management-system/blob/main/Backend/config/token.js): `Backend/config/token.js`

### Attendance and salary

- [Attendance routes](https://github.com/tarunre12/salary-management-system/blob/main/Backend/routes/attendance.routes.js): `Backend/routes/attendance.routes.js`
- [Attendance and summaries](https://github.com/tarunre12/salary-management-system/blob/main/Backend/controllers/attendance.controllers.js): `Backend/controllers/attendance.controllers.js`

### Persistence

- [User records](https://github.com/tarunre12/salary-management-system/blob/main/Backend/Models/user.model.js): `Backend/Models/user.model.js`
- [Attendance records](https://github.com/tarunre12/salary-management-system/blob/main/Backend/Models/attendance.model.js): `Backend/Models/attendance.model.js`
- [Database connection](https://github.com/tarunre12/salary-management-system/blob/main/Backend/config/db.js): `Backend/config/db.js`

### Other components

- **Employee**
- **Administrator**
- **MongoDB**

## Connections

- Employee → App routing: uses (evidence: `README.md`)
- Administrator → App routing: uses (evidence: `README.md`)
- App routing → Login page: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Registration page: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → User dashboard: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Admin dashboard: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Protected route: guards routes (evidence: `Frontend/src/App.jsx`)
- App routing → Auth context: provides auth (evidence: `Frontend/src/App.jsx`)
- Protected route → Auth context: checks session (evidence: `Frontend/src/components/ProtectedRoute.jsx`)
- Auth context → API client: checks session (evidence: `Frontend/src/context/AuthContext.jsx`)
- Login page → API client: sends credentials (evidence: `Frontend/src/pages/Login.jsx`)
- Registration page → API client: submits details (evidence: `Frontend/src/pages/Register.jsx`)
- User dashboard → API client: requests attendance (evidence: `Frontend/src/pages/UserDashboard.jsx`)
- Admin dashboard → API client: loads summaries (evidence: `Frontend/src/pages/AdminDashboard.jsx`)
- API client → Express API: HTTP requests (evidence: `README.md`)
- Express API → Database connection: connects database (evidence: `Backend/index.js`)
- Express API → Auth routes: mounts routes (evidence: `Backend/index.js`)
- Express API → Attendance routes: mounts routes (evidence: `Backend/index.js`)
- Auth routes → Auth controller: dispatches (evidence: `Backend/routes/auth.routes.js`)
- Auth routes → Auth middleware: protects check (evidence: `Backend/routes/auth.routes.js`)
- Attendance routes → Auth middleware: protects endpoints (evidence: `Backend/routes/attendance.routes.js`)
- Attendance routes → Attendance and summaries: dispatches (evidence: `Backend/routes/attendance.routes.js`)
- Auth controller → User records: reads and creates (evidence: `Backend/controllers/auth.controllers.js`)
- Auth controller → JWT generation: generates token (evidence: `Backend/controllers/auth.controllers.js`)
- Auth middleware → User records: loads user (evidence: `Backend/middleware/auth.middleware.js`)
- Attendance and summaries → Attendance records: reads and writes (evidence: `Backend/controllers/attendance.controllers.js`)
- Attendance and summaries → User records: loads users (evidence: `Backend/controllers/attendance.controllers.js`)
- Database connection → MongoDB: connects
