# mepravi25/attendence-emp-system architecture

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

- Interactive diagram: https://gitdiagram.com/mepravi25/attendence-emp-system
- Repository: https://github.com/mepravi25/attendence-emp-system

## Overview

#### Purpose and deployment shape
This is a full-stack employee attendance management application. A Vite/React single-page frontend provides authentication, employee administration, and attendance workflows; a Node.js backend exposes authentication and data APIs. Container deployment is supported through `docker-compose.yml`, `backend/Dockerfile`, and `frontend/Dockerfile`; the frontend also includes Vercel deployment configuration at `frontend/vercel.json`.

#### Backend API entry point
`backend/server.js` is the backend runtime entry point and HTTP composition boundary. It mounts route modules for identity and attendance/employee data:
- `backend/routes/auth.js`
- `backend/routes/data.js`

The backend package boundary is defined by `backend/package.json`. Routes are the primary server-side control surface consumed by the browser client.

#### Backend domain and persistence contract
`backend/models/schemas.js` centralizes the application’s data schemas, making it the persistence/domain contract for users, employees, and attendance-related records. `backend/routes/auth.js` operates on the authentication-facing portion of that model; `backend/routes/data.js` operates on protected business data and attendance mutations/queries.

The exact database provider is not visible in the supplied tree, but schema ownership is explicitly isolated under `backend/models/`, rather than embedded in route handlers.

#### Frontend bootstrap and application shell
`frontend/src/main.jsx` boots the React application, while `frontend/src/App.jsx` defines the top-level application composition. The authenticated application shell is in:
- `frontend/src/components/layout/Layout.jsx`
- `frontend/src/pages/Home.jsx`

This separates startup/routing-level composition from the post-login workspace layout.

#### Client state and API boundary
Cross-cutting client state is managed through React contexts:
- `frontend/src/context/AuthContext.jsx`
- `frontend/src/context/DataContext.jsx`
- `frontend/src/context/ThemeContext.jsx`

`AuthContext` represents session/identity state and works with `frontend/src/services/AuthService.js`. `DataContext` coordinates shared employee and attendance data. HTTP access is centralized in `frontend/src/utils/api.js`, creating the frontend/backend protocol boundary rather than allowing feature components to own transport details.

#### Authentication and access control flow
Authentication UI and access gating are grouped under `frontend/src/components/auth/`:
- `frontend/src/components/auth/AuthContainer.jsx`
- `frontend/src/components/auth/Login.jsx`
- `frontend/src/components/auth/ProtectedRoute.jsx`

The expected control flow is login/register/password recovery UI → `AuthService`/API utility → backend auth routes → authenticated state in `AuthContext` → `ProtectedRoute` permits access to the main layout. Server-side credential and user operations terminate in `backend/routes/auth.js`.

#### Employee and attendance feature stages
Employee administration is represented by list, registration, detail, history, editing, and aggregate-stat views:
- `frontend/src/components/employee/EmployeeList.jsx`
- `frontend/src/components/employee/RegisterEmployee.jsx`
- `frontend/src/components/employee/EmployeeDetails.jsx`

Attendance handling is a distinct feature area: users enter actions/times, inspect daily records and summaries, and view historical detail:
- `frontend/src/components/attendance/AttendanceAction.jsx`
- `frontend/src/components/attendance/DailyAttendanceTable.jsx`
- `frontend/src/components/attendance/DailyHistoryModal.jsx`

These components exchange shared state through `DataContext` and persist/retrieve business records through the backend data API in `backend/routes/data.js`. Time-specific normalization/calculation logic is isolated in `frontend/src/utils/timeHelpers.js`.

Main entry points: [`frontend/src/App.jsx`](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/App.jsx) (App composition), [`frontend/src/components/layout/Layout.jsx`](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/layout/Layout.jsx) (Authenticated workspace), [`backend/server.js`](https://github.com/mepravi25/attendence-emp-system/blob/main/backend/server.js) (HTTP server), [`frontend/src/context/DataContext.jsx`](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/DataContext.jsx) (Data context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React frontend"]
  node_frontend_main(("React bootstrap<br/>entry point<br/>[main.jsx]"))
  node_frontend_app["App composition<br/>application shell<br/>[App.jsx]"]
  node_auth_ui["Auth UI and gate<br/>access control<br/>[AuthContainer.jsx]"]
  node_auth_context["Auth context<br/>client state<br/>[AuthContext.jsx]"]
  node_auth_service["Auth service<br/>client service<br/>[AuthService.js]"]
  node_api_client{{"API client<br/>HTTP boundary<br/>[api.js]"}}
  node_workspace["Authenticated workspace<br/>layout and home<br/>[Layout.jsx]"]
  node_data_context["Data context<br/>client state<br/>[DataContext.jsx]"]
  node_employee_features["Employee administration<br/>feature views<br/>[EmployeeList.jsx]"]
  node_attendance_features["Attendance workflows<br/>feature views"]
  node_time_helpers["Time helpers<br/>time logic<br/>[timeHelpers.js]"]
  node_theme_context["Theme context<br/>client state<br/>[ThemeContext.jsx]"]
end

subgraph group_backend["Node backend"]
  node_server{{"HTTP server<br/>API entry point<br/>[server.js]"}}
  node_auth_routes["Auth routes<br/>identity API<br/>[auth.js]"]
  node_data_routes["Data routes<br/>business data API<br/>[data.js]"]
  node_schemas[("Domain schemas<br/>persistence contract<br/>[schemas.js]")]
end

subgraph group_deployment["Deployment"]
  node_containers["Container deployment<br/>Docker Compose<br/>[docker-compose.yml]"]
  node_vercel["Vercel deployment<br/>frontend hosting<br/>[vercel.json]"]
end

node_frontend_main -->|"boots"| node_frontend_app
node_frontend_app -->|"composes"| node_auth_ui
node_frontend_app -->|"renders after access"| node_workspace
node_auth_ui -->|"submits identity actions"| node_auth_service
node_auth_ui -->|"uses access state"| node_auth_context
node_auth_service -->|"uses"| node_api_client
node_api_client -->|"HTTP"| node_server
node_auth_routes -->|"user operations"| node_schemas
node_data_routes -->|"employee and attendance records"| node_schemas
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_data_routes
node_workspace -->|"provides shared data"| node_data_context
node_workspace -->|"hosts"| node_employee_features
node_workspace -->|"hosts"| node_attendance_features
node_data_context -->|"loads and persists"| node_api_client
node_employee_features -->|"reads and updates"| node_data_context
node_attendance_features -->|"reads and updates"| node_data_context
node_attendance_features -->|"normalizes times"| node_time_helpers
node_frontend_app -->|"uses"| node_theme_context
node_containers -.->|"deploys"| node_server
node_containers -.->|"deploys frontend"| node_frontend_main
node_vercel -.->|"hosts frontend"| node_frontend_main

click node_frontend_main "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/main.jsx"
click node_frontend_app "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/auth/AuthContainer.jsx"
click node_auth_context "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_service "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/services/AuthService.js"
click node_api_client "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/utils/api.js"
click node_workspace "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/layout/Layout.jsx"
click node_data_context "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/DataContext.jsx"
click node_employee_features "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/employee/EmployeeList.jsx"
click node_attendance_features "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/attendance/AttendanceAction.jsx"
click node_time_helpers "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/utils/timeHelpers.js"
click node_theme_context "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/ThemeContext.jsx"
click node_server "https://github.com/mepravi25/attendence-emp-system/blob/main/backend/server.js"
click node_auth_routes "https://github.com/mepravi25/attendence-emp-system/blob/main/backend/routes/auth.js"
click node_data_routes "https://github.com/mepravi25/attendence-emp-system/blob/main/backend/routes/data.js"
click node_schemas "https://github.com/mepravi25/attendence-emp-system/blob/main/backend/models/schemas.js"
click node_containers "https://github.com/mepravi25/attendence-emp-system/blob/main/docker-compose.yml"
click node_vercel "https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/vercel.json"

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_frontend_main,node_frontend_app,node_auth_ui,node_auth_context,node_auth_service,node_api_client,node_workspace,node_data_context,node_employee_features,node_attendance_features,node_time_helpers,node_theme_context toneBlue
class node_server,node_auth_routes,node_data_routes,node_schemas toneAmber
class node_containers,node_vercel toneMint
```

## Components

### React frontend

Browser SPA and feature workflows.

- [React bootstrap](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/main.jsx): entry point · `frontend/src/main.jsx`
- [App composition](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/App.jsx): application shell · `frontend/src/App.jsx`
- [Auth UI and gate](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/auth/AuthContainer.jsx): access control · Login, recovery, and protected-route flow. · `frontend/src/components/auth/AuthContainer.jsx`
- [Auth context](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/AuthContext.jsx): client state · Holds session and identity state. · `frontend/src/context/AuthContext.jsx`
- [Auth service](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/services/AuthService.js): client service · `frontend/src/services/AuthService.js`
- [API client](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/utils/api.js): HTTP boundary · Centralizes browser-to-server transport. · `frontend/src/utils/api.js`
- [Authenticated workspace](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/layout/Layout.jsx): layout and home · `frontend/src/components/layout/Layout.jsx`
- [Data context](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/DataContext.jsx): client state · Shared employee and attendance data. · `frontend/src/context/DataContext.jsx`
- [Employee administration](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/employee/EmployeeList.jsx): feature views · List, registration, and employee detail workflows. · `frontend/src/components/employee/EmployeeList.jsx`
- [Attendance workflows](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/components/attendance/AttendanceAction.jsx): feature views · Actions, daily records, and history views. · `frontend/src/components/attendance/AttendanceAction.jsx`
- [Time helpers](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/utils/timeHelpers.js): time logic · `frontend/src/utils/timeHelpers.js`
- [Theme context](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/src/context/ThemeContext.jsx): client state · `frontend/src/context/ThemeContext.jsx`

### Node backend

HTTP API and domain contract.

- [HTTP server](https://github.com/mepravi25/attendence-emp-system/blob/main/backend/server.js): API entry point · Composes authentication and data routes. · `backend/server.js`
- [Auth routes](https://github.com/mepravi25/attendence-emp-system/blob/main/backend/routes/auth.js): identity API · `backend/routes/auth.js`
- [Data routes](https://github.com/mepravi25/attendence-emp-system/blob/main/backend/routes/data.js): business data API · Protected employee and attendance operations. · `backend/routes/data.js`
- [Domain schemas](https://github.com/mepravi25/attendence-emp-system/blob/main/backend/models/schemas.js): persistence contract · Schemas for users, employees, and attendance records. · `backend/models/schemas.js`

### Deployment

Container and frontend hosting definitions.

- [Container deployment](https://github.com/mepravi25/attendence-emp-system/blob/main/docker-compose.yml): Docker Compose · Builds and runs frontend and backend containers. · `docker-compose.yml`
- [Vercel deployment](https://github.com/mepravi25/attendence-emp-system/blob/main/frontend/vercel.json): frontend hosting · `frontend/vercel.json`

## Connections

- React bootstrap → App composition: boots
- App composition → Auth UI and gate: composes
- App composition → Authenticated workspace: renders after access
- Auth UI and gate → Auth service: submits identity actions
- Auth UI and gate → Auth context: uses access state
- Auth service → API client: uses
- API client → HTTP server: HTTP
- Auth routes → Domain schemas: user operations
- Data routes → Domain schemas: employee and attendance records
- HTTP server → Auth routes: mounts
- HTTP server → Data routes: mounts
- Authenticated workspace → Data context: provides shared data
- Authenticated workspace → Employee administration: hosts
- Authenticated workspace → Attendance workflows: hosts
- Data context → API client: loads and persists
- Employee administration → Data context: reads and updates
- Attendance workflows → Data context: reads and updates
- Attendance workflows → Time helpers: normalizes times
- App composition → Theme context: uses
- Container deployment → HTTP server: deploys
- Container deployment → React bootstrap: deploys frontend
- Vercel deployment → React bootstrap: hosts frontend
