# vasanthpapa/smartsalary architecture

> Architecture diagram of the GitHub repository vasanthpapa/smartsalary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vasanthpapa/smartsalary
- Repository: https://github.com/vasanthpapa/smartsalary

## Overview

SmartSalary manages workforce records, attendance, and salary calculations through a React dashboard backed by an Express API. The main workflow is admin login, employee and attendance management, optional biometric attendance sync, and salary calculation/reporting. The graph includes the documented real-time capability, but the sampled excerpts do not show the client’s socket handling or the rules UI implementation; those links are therefore omitted. Biometric sync and storage behavior are represented from the excerpts; some UI-to-API connections remain unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/App.jsx) (App shell), [`server/index.js`](https://github.com/vasanthpapa/smartsalary/blob/main/server/index.js) (Express server), [`server/services/biometricSync.js`](https://github.com/vasanthpapa/smartsalary/blob/main/server/services/biometricSync.js) (Biometric sync), [`server/routes/attendance.js`](https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/attendance.js) (Attendance API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workforce app"]
  node_app["App shell<br/>[App.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_employees_ui["Employees<br/>[Employees.jsx]"]
  node_attendance_ui["Attendance<br/>[Attendance.jsx]"]
  node_bulk_table["Bulk attendance"]
  node_individual_report["Individual report"]
  node_monthly_report["Monthly report"]
  node_late_tracker["Late tracker"]
  node_calculator["Salary calculator<br/>[Calculator.jsx]"]
  node_workforce_context["Workforce state"]
  node_shared_context["Context interface<br/>[workforceShared.js]"]
end

subgraph group_api["API and access"]
  node_server["Express server<br/>[index.js]"]
  node_auth_route["Login API<br/>[auth.js]"]
  node_employee_route["Employee API<br/>[employees.js]"]
  node_attendance_route["Attendance API<br/>[attendance.js]"]
  node_rules_route["Rules API<br/>[rules.js]"]
  node_system_route["System API<br/>[system.js]"]
  node_auth_middleware["Token verification<br/>[auth.js]"]
end

subgraph group_domain["Workforce services"]
  node_biometric_sync["Biometric sync<br/>[biometricSync.js]"]
end

subgraph group_storage["Data storage"]
  node_employee_model[("Employee records<br/>[Employee.js]")]
  node_attendance_model[("Attendance records<br/>[Attendance.js]")]
  node_rules_model[("Rules records<br/>[Rules.js]")]
  node_mock_store[("Demo store<br/>[mockStore.js]")]
  node_db_config["Storage selection<br/>[db.js]"]
end

node_admin(("Admin"))
node_etimeoffice["eTimeOffice"]
node_mongodb[("MongoDB Atlas")]

node_admin -->|"uses"| node_app
node_app -->|"shows"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_employees_ui
node_app -->|"routes to"| node_attendance_ui
node_app -->|"routes to"| node_calculator
node_app -.->|"reads state"| node_workforce_context
node_workforce_context -->|"uses interface"| node_shared_context
node_app -->|"uses hook"| node_shared_context
node_attendance_ui -->|"renders"| node_bulk_table
node_attendance_ui -->|"renders"| node_individual_report
node_attendance_ui -->|"renders"| node_monthly_report
node_dashboard -->|"renders"| node_late_tracker
node_dashboard -->|"uses"| node_shared_context
node_employees_ui -->|"uses"| node_shared_context
node_calculator -->|"uses"| node_shared_context
node_server -->|"initializes"| node_db_config
node_server -->|"mounts"| node_auth_route
node_server -->|"mounts"| node_employee_route
node_server -->|"mounts"| node_attendance_route
node_server -->|"mounts"| node_rules_route
node_server -->|"mounts"| node_system_route
node_server -->|"protects routes"| node_auth_middleware
node_admin -.->|"submits credentials"| node_auth_route
node_employee_route -->|"reads and writes"| node_employee_model
node_employee_route -->|"uses fallback"| node_mock_store
node_employee_route -->|"uses credentials"| node_biometric_sync
node_attendance_route -->|"reads and writes"| node_attendance_model
node_attendance_route -->|"uses records"| node_employee_model
node_attendance_route -->|"uses fallback"| node_mock_store
node_attendance_route -->|"dispatches sync"| node_biometric_sync
node_rules_route -->|"uses records"| node_rules_model
node_rules_route -->|"uses fallback"| node_mock_store
node_biometric_sync -->|"fetches punches"| node_etimeoffice
node_biometric_sync -->|"loads employees"| node_employee_model
node_biometric_sync -->|"loads and saves"| node_attendance_model
node_biometric_sync -->|"uses fallback"| node_mock_store
node_biometric_sync -->|"checks storage mode"| node_db_config
node_db_config -->|"connects"| node_mongodb
node_employee_model -.->|"persists"| node_mongodb
node_attendance_model -.->|"persists"| node_mongodb
node_rules_model -.->|"persists"| node_mongodb

click node_app "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/App.jsx"
click node_login "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Login.jsx"
click node_dashboard "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Dashboard.jsx"
click node_employees_ui "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Employees.jsx"
click node_attendance_ui "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Attendance.jsx"
click node_bulk_table "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/BulkAttendanceTable.jsx"
click node_individual_report "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/IndividualReport.jsx"
click node_monthly_report "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/MonthlyReportModal.jsx"
click node_late_tracker "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/MonthlyLateTracker.jsx"
click node_calculator "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Calculator.jsx"
click node_workforce_context "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/context/WorkforceContext.jsx"
click node_shared_context "https://github.com/vasanthpapa/smartsalary/blob/main/client/src/context/workforceShared.js"
click node_server "https://github.com/vasanthpapa/smartsalary/blob/main/server/index.js"
click node_auth_route "https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/auth.js"
click node_employee_route "https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/employees.js"
click node_attendance_route "https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/attendance.js"
click node_rules_route "https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/rules.js"
click node_system_route "https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/system.js"
click node_auth_middleware "https://github.com/vasanthpapa/smartsalary/blob/main/server/middlewares/auth.js"
click node_biometric_sync "https://github.com/vasanthpapa/smartsalary/blob/main/server/services/biometricSync.js"
click node_employee_model "https://github.com/vasanthpapa/smartsalary/blob/main/server/models/Employee.js"
click node_attendance_model "https://github.com/vasanthpapa/smartsalary/blob/main/server/models/Attendance.js"
click node_rules_model "https://github.com/vasanthpapa/smartsalary/blob/main/server/models/Rules.js"
click node_mock_store "https://github.com/vasanthpapa/smartsalary/blob/main/server/config/mockStore.js"
click node_db_config "https://github.com/vasanthpapa/smartsalary/blob/main/server/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_dashboard,node_employees_ui,node_attendance_ui,node_bulk_table,node_individual_report,node_monthly_report,node_late_tracker,node_calculator,node_workforce_context,node_shared_context toneBlue
class node_server,node_auth_route,node_employee_route,node_attendance_route,node_rules_route,node_system_route,node_auth_middleware,node_mongodb toneAmber
class node_biometric_sync toneMint
class node_employee_model,node_attendance_model,node_rules_model,node_mock_store,node_db_config toneRose
class node_admin,node_etimeoffice toneIndigo
```

## Components

### Workforce app

- [App shell](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Login](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Dashboard](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Employees](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Employees.jsx): `client/src/pages/Employees.jsx`
- [Attendance](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Attendance.jsx): `client/src/pages/Attendance.jsx`
- [Bulk attendance](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/BulkAttendanceTable.jsx): `client/src/components/BulkAttendanceTable.jsx`
- [Individual report](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/IndividualReport.jsx): `client/src/components/IndividualReport.jsx`
- [Monthly report](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/MonthlyReportModal.jsx): `client/src/components/MonthlyReportModal.jsx`
- [Late tracker](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/components/MonthlyLateTracker.jsx): `client/src/components/MonthlyLateTracker.jsx`
- [Salary calculator](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/pages/Calculator.jsx): `client/src/pages/Calculator.jsx`
- [Workforce state](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/context/WorkforceContext.jsx): `client/src/context/WorkforceContext.jsx`
- [Context interface](https://github.com/vasanthpapa/smartsalary/blob/main/client/src/context/workforceShared.js): `client/src/context/workforceShared.js`

### API and access

- [Express server](https://github.com/vasanthpapa/smartsalary/blob/main/server/index.js): `server/index.js`
- [Login API](https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Employee API](https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/employees.js): `server/routes/employees.js`
- [Attendance API](https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/attendance.js): `server/routes/attendance.js`
- [Rules API](https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/rules.js): `server/routes/rules.js`
- [System API](https://github.com/vasanthpapa/smartsalary/blob/main/server/routes/system.js): `server/routes/system.js`
- [Token verification](https://github.com/vasanthpapa/smartsalary/blob/main/server/middlewares/auth.js): `server/middlewares/auth.js`

### Workforce services

- [Biometric sync](https://github.com/vasanthpapa/smartsalary/blob/main/server/services/biometricSync.js): `server/services/biometricSync.js`

### Data storage

- [Employee records](https://github.com/vasanthpapa/smartsalary/blob/main/server/models/Employee.js): `server/models/Employee.js`
- [Attendance records](https://github.com/vasanthpapa/smartsalary/blob/main/server/models/Attendance.js): `server/models/Attendance.js`
- [Rules records](https://github.com/vasanthpapa/smartsalary/blob/main/server/models/Rules.js): `server/models/Rules.js`
- [Demo store](https://github.com/vasanthpapa/smartsalary/blob/main/server/config/mockStore.js): `server/config/mockStore.js`
- [Storage selection](https://github.com/vasanthpapa/smartsalary/blob/main/server/config/db.js): `server/config/db.js`

### Other components

- **Admin**
- **eTimeOffice**
- **MongoDB Atlas**

## Connections

- Admin → App shell: uses (evidence: `client/src/App.jsx`)
- App shell → Login: shows (evidence: `client/src/App.jsx`)
- App shell → Dashboard: routes to (evidence: `client/src/App.jsx`)
- App shell → Employees: routes to (evidence: `client/src/App.jsx`)
- App shell → Attendance: routes to (evidence: `client/src/App.jsx`)
- App shell → Salary calculator: routes to (evidence: `client/src/App.jsx`)
- App shell → Workforce state: reads state
- Workforce state → Context interface: uses interface (evidence: `client/src/context/WorkforceContext.jsx`)
- App shell → Context interface: uses hook (evidence: `client/src/App.jsx`)
- Attendance → Bulk attendance: renders (evidence: `client/src/pages/Attendance.jsx`)
- Attendance → Individual report: renders (evidence: `client/src/pages/Attendance.jsx`)
- Attendance → Monthly report: renders (evidence: `client/src/pages/Attendance.jsx`)
- Dashboard → Late tracker: renders (evidence: `client/src/pages/Dashboard.jsx`)
- Dashboard → Context interface: uses (evidence: `client/src/pages/Dashboard.jsx`)
- Employees → Context interface: uses (evidence: `client/src/pages/Employees.jsx`)
- Salary calculator → Context interface: uses (evidence: `client/src/pages/Calculator.jsx`)
- Express server → Storage selection: initializes (evidence: `server/index.js`)
- Express server → Login API: mounts (evidence: `server/index.js`)
- Express server → Employee API: mounts (evidence: `server/index.js`)
- Express server → Attendance API: mounts (evidence: `server/index.js`)
- Express server → Rules API: mounts (evidence: `server/index.js`)
- Express server → System API: mounts (evidence: `server/index.js`)
- Express server → Token verification: protects routes (evidence: `server/index.js`)
- Admin → Login API: submits credentials
- Employee API → Employee records: reads and writes (evidence: `server/routes/employees.js`)
- Employee API → Demo store: uses fallback (evidence: `server/routes/employees.js`)
- Employee API → Biometric sync: uses credentials (evidence: `server/routes/employees.js`)
- Attendance API → Attendance records: reads and writes (evidence: `server/routes/attendance.js`)
- Attendance API → Employee records: uses records (evidence: `server/routes/attendance.js`)
- Attendance API → Demo store: uses fallback (evidence: `server/routes/attendance.js`)
- Attendance API → Biometric sync: dispatches sync (evidence: `server/routes/attendance.js`)
- Rules API → Rules records: uses records (evidence: `server/routes/rules.js`)
- Rules API → Demo store: uses fallback (evidence: `server/routes/rules.js`)
- Biometric sync → eTimeOffice: fetches punches (evidence: `server/services/biometricSync.js`)
- Biometric sync → Employee records: loads employees (evidence: `server/services/biometricSync.js`)
- Biometric sync → Attendance records: loads and saves (evidence: `server/services/biometricSync.js`)
- Biometric sync → Demo store: uses fallback (evidence: `server/services/biometricSync.js`)
- Biometric sync → Storage selection: checks storage mode (evidence: `server/services/biometricSync.js`)
- Storage selection → MongoDB Atlas: connects (evidence: `server/config/db.js`)
- Employee records → MongoDB Atlas: persists
- Attendance records → MongoDB Atlas: persists
- Rules records → MongoDB Atlas: persists
