How mepravi25/attendence-emp-system works
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: App.jsx App composition · Layout.jsx Authenticated workspace · server.js HTTP server · DataContext.jsx Data context
Components 18
React frontend
Browser SPA and feature workflows.
- React bootstrap
frontend/src/main.jsx - App composition
frontend/src/App.jsx - Auth UI and gate · Login, recovery, and protected-route flow.
frontend/src/components/auth/AuthContainer.jsx - Auth context · Holds session and identity state.
frontend/src/context/AuthContext.jsx - Auth service
frontend/src/services/AuthService.js - API client · Centralizes browser-to-server transport.
frontend/src/utils/api.js - Authenticated workspace
frontend/src/components/layout/Layout.jsx - Data context · Shared employee and attendance data.
frontend/src/context/DataContext.jsx - Employee administration · List, registration, and employee detail workflows.
frontend/src/components/employee/EmployeeList.jsx - Attendance workflows · Actions, daily records, and history views.
frontend/src/components/attendance/AttendanceAction.jsx - Time helpers
frontend/src/utils/timeHelpers.js - Theme context
frontend/src/context/ThemeContext.jsx
Node backend
HTTP API and domain contract.
- HTTP server · Composes authentication and data routes.
backend/server.js - Auth routes
backend/routes/auth.js - Data routes · Protected employee and attendance operations.
backend/routes/data.js - Domain schemas · Schemas for users, employees, and attendance records.
backend/models/schemas.js
Deployment
Container and frontend hosting definitions.
- Container deployment · Builds and runs frontend and backend containers.
docker-compose.yml - Vercel deployment
frontend/vercel.json
Connections 22
- 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