# haridevex/elegance-it-geo-infotech architecture

> Architecture diagram of the GitHub repository haridevex/elegance-it-geo-infotech, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haridevex/elegance-it-geo-infotech
- Repository: https://github.com/haridevex/elegance-it-geo-infotech

## Overview

1. **Overall shape**
   - This is a split-stack employee management system with a **React 19 frontend** in `Frontend/` and an **Express 5 / Node.js backend** in `server/`.
   - The frontend is a browser SPA; the backend is a JSON API plus real-time services. Persistence is in **Supabase-hosted PostgreSQL** via **Knex.js**.

2. **Frontend presentation layer**
   - `Frontend/src/pages` contains the route-level screens: login, password reset, admin dashboard, employee dashboard, root dashboard, and password change.
   - `Frontend/src/components` holds most of the UI and business-facing widgets: employee forms/lists, attendance views, leave management, announcements, chat, notifications, charts, accessibility, and loading/skeleton states.
   - `Frontend/src/components/ui` is a reusable design-system layer for buttons, dialogs, tables, inputs, tabs, etc.

3. **Frontend state and API boundary**
   - `Frontend/src/context/authContext.jsx` centralizes authentication state for the SPA.
   - `Frontend/src/config/api.js` and `Frontend/src/config/axios.js` define the HTTP client boundary to the backend API.
   - The frontend is built with **Vite**, styled with **Tailwind CSS**, and uses **React Router** and **Recharts** for navigation and dashboards.

4. **Backend API structure**
   - The backend follows a classic layered Express structure: `routes/` define endpoints, `controller/` contains request handling and domain logic, `middleware/` handles cross-cutting concerns, and `utils/` holds shared services.
   - `server/index.js` is the main runtime entry point, wiring the Express app, middleware, routes, and likely socket initialization.

5. **Domain subsystems**
   - The API is organized by business capability: **auth**, **employees**, **attendance/check-in**, **leaves**, **leave balance**, **announcements**, **chat**, **notifications**, **holidays**, **documents**, and **activity logs**.
   - Each domain has a route file and a matching controller, which makes the backend easy to diagram as a set of bounded modules behind one API surface.

6. **Authentication and security**
   - Security is a major subsystem, not a thin wrapper: JWT auth, refresh tokens, password reset tokens, password history, login sessions, login attempts, token blacklist, two-factor auth, and OAuth all have dedicated routes/utils/migrations.
   - `server/middleware/auth.js`, `validator.js`, and `errorHandler.js` provide protection and request validation.
   - The migrations show account lockout, password expiry, security columns on users, and session tracking, so the auth flow is more stateful than a simple token login.

7. **Real-time communication**
   - `server/utils/socket.js` and the chat/notification modules indicate **Socket.io-based realtime updates**.
   - This supports live chat, chat groups, and push-like UI updates for notifications or presence-related events.
   - For an architecture diagram, this is a separate event path alongside the normal REST request/response path.

8. **Attendance and leave workflow**
   - Attendance includes check-in/out, manual entries, calendars, charts, and summaries; the backend has dedicated attendance and check-in controllers/routes.
   - Leave management covers requests, approvals, balance tracking, overlap prevention, and prediction/forecasting utilities.
   - These are tightly connected domains but still separated in code: attendance records are operational time events, while leave records are approval/workflow entities.

9. **Employee and admin data management**
   - Employee CRUD, profile editing, search/filtering, and Excel export are supported on the frontend and backed by employee routes/controllers.
   - Admin-oriented screens such as dashboards, session management, login logs, password reset management, and activity logs suggest a strong back-office focus.
   - The architecture should show these as privileged admin workflows protected by auth/roles.

10. **AI-assisted features**
   - `server/utils/aiAttendance.js`, `aiChatbot.js`, `aiLeavePrediction.js`, `aiSearch.js`, and `aiSecurity.js` indicate multiple AI-assisted services behind `/api/ai/*`.
   - Frontend components like `AIAttendanceInsights`, `AIChatbot`, and `AISearch` consume those endpoints.
   - These are additive intelligence features, not the core system of record.

11. **Persistence, files, and external services**
   - Database schema is managed through many Knex migrations and seeds, with scripts for init/reset and admin bootstrap.
   - File handling is split between local uploads (`server/uploads/`) and a Supabase storage helper, so the diagram should include a file/document storage boundary.
   - `server/utils/emailService.js`, `redis.js`, `responseCache.js`, `sentry.js`, and `oauth.js` show supporting infrastructure for email, caching, observability, and third-party auth.

12. **Deployment and packaging**
   - The frontend includes a `Dockerfile`, Nginx configs, and Vercel deployment settings; the README says it is deployed to **Vercel**.
   - The backend is deployed separately on **Render**, and the database is **Supabase PostgreSQL**.
   - This makes the system a three-tier deployment: browser SPA → backend API/realtime service → managed database/storage/services.

13. **Testing and quality gates**
   - Frontend tests use **Vitest**; backend includes validator tests.
   - This repo also includes reusable skeleton/loading components and an error boundary, which are UX resilience layers rather than core business logic.

Main entry points: [`server/utils`](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/utils) (Shared utils), [`server/controller`](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/controller) (Controllers), [`server/config/database.js`](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/config/database.js) (PostgreSQL), [`server/index.js`](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/index.js) (Server entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend SPA"]
  node_pages["Pages<br/>React routes"]
  node_ui["UI kit<br/>Design system"]
  node_workflows["Workflows<br/>Feature components"]
  node_charts["Charts<br/>Dashboards"]
  node_auth_ctx["Auth state<br/>React context<br/>[authContext.jsx]"]
  node_api_client["API client<br/>HTTP boundary"]
  node_frontend_tests["Frontend tests<br/>Vitest"]
end

subgraph group_backend["Backend API"]
  node_entry["Server entry<br/>Express bootstrap<br/>[index.js]"]
  node_routes["Routes<br/>HTTP routing"]
  node_controllers["Controllers<br/>Domain logic"]
  node_middleware["Middleware<br/>Cross-cutting"]
  node_backend_utils["Shared utils<br/>Services"]
  node_auth_domain{{"Auth & security<br/>Security domain<br/>[auth.js]"}}
  node_people_domain{{"Employees<br/>HR domain<br/>[employee.js]"}}
  node_time_domain{{"Attendance<br/>Timekeeping domain<br/>[attendance.js]"}}
  node_leave_domain{{"Leaves<br/>Workflow domain<br/>[leave.js]"}}
  node_comms_domain{{"Comms<br/>Realtime domain<br/>[chat.js]"}}
  node_docs_domain{{"Docs & holidays<br/>Support domain<br/>[document.js]"}}
  node_activity_domain{{"Activity log<br/>Audit domain<br/>[activityLog.js]"}}
  node_ai_domain{{"AI services<br/>Assistive domain<br/>[ai.js]"}}
end

subgraph group_infra["Data & services"]
  node_db[("PostgreSQL<br/>Supabase DB<br/>[database.js]")]
  node_storage["File storage<br/>Uploads & Supabase"]
  node_services(("External services<br/>Email/Redis/Sentry/OAuth<br/>[emailService.js]"))
end

node_pages -->|"reads session"| node_auth_ctx
node_pages -->|"calls API"| node_api_client
node_workflows -->|"uses API"| node_api_client
node_charts -->|"visualizes"| node_workflows
node_frontend_tests -.->|"covers"| node_pages
node_entry -->|"mounts"| node_routes
node_entry -->|"applies"| node_middleware
node_entry -->|"initializes"| node_backend_utils
node_routes -->|"delegates"| node_controllers
node_controllers -->|"validated by"| node_middleware
node_controllers -->|"queries"| node_db
node_controllers -->|"uses services"| node_backend_utils
node_auth_domain -->|"tokens/mfa"| node_services
node_people_domain -->|"exports/files"| node_storage
node_time_domain -->|"stores records"| node_db
node_leave_domain -->|"stores requests"| node_db
node_comms_domain -->|"realtime"| node_backend_utils
node_docs_domain -->|"uploads"| node_storage
node_activity_domain -->|"audits"| node_db
node_ai_domain -->|"models/helpers"| node_backend_utils
node_backend_utils -->|"integrates"| node_services
node_api_client -->|"HTTP requests"| node_routes

click node_pages "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/pages"
click node_ui "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/components/ui"
click node_workflows "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/components"
click node_charts "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/components/charts"
click node_auth_ctx "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/Frontend/src/context/authContext.jsx"
click node_api_client "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/config"
click node_frontend_tests "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/tests"
click node_entry "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/index.js"
click node_routes "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/routes"
click node_controllers "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/controller"
click node_middleware "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/middleware"
click node_backend_utils "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/utils"
click node_auth_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/auth.js"
click node_people_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/employee.js"
click node_time_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/attendance.js"
click node_leave_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/leave.js"
click node_comms_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/chat.js"
click node_docs_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/document.js"
click node_activity_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/activityLog.js"
click node_ai_domain "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/ai.js"
click node_db "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/config/database.js"
click node_storage "https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/uploads"
click node_services "https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/utils/emailService.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_pages,node_ui,node_workflows,node_charts,node_auth_ctx,node_api_client,node_frontend_tests toneBlue
class node_entry,node_routes,node_controllers,node_middleware,node_backend_utils,node_auth_domain,node_people_domain,node_time_domain,node_leave_domain,node_comms_domain,node_docs_domain,node_activity_domain,node_ai_domain toneAmber
class node_db,node_storage,node_services toneMint
```

## Components

### Frontend SPA

React browser application for employee, admin, and dashboard workflows.

- [Pages](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/pages): React routes · Route-level screens for login, recovery, and dashboards. · `Frontend/src/pages`
- [UI kit](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/components/ui): Design system · Reusable buttons, dialogs, tables, inputs, tabs, and related primitives. · `Frontend/src/components/ui`
- [Workflows](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/components): Feature components · Employee, attendance, leave, chat, announcements, notifications, and admin widgets. · `Frontend/src/components`
- [Charts](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/components/charts): Dashboards · Attendance and summary visualizations used across admin views. · `Frontend/src/components/charts`
- [Auth state](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/Frontend/src/context/authContext.jsx): React context · SPA-wide authentication and session state. · `Frontend/src/context/authContext.jsx`
- [API client](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/config): HTTP boundary · Axios and API configuration for backend requests. · `Frontend/src/config`
- [Frontend tests](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/Frontend/src/tests): Vitest · Component and utility tests for the SPA. · `Frontend/src/tests`

### Backend API

Express API, realtime services, and business logic.

- [Server entry](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/index.js): Express bootstrap · Main runtime wiring for app, routes, middleware, and realtime startup. · `server/index.js`
- [Routes](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/routes): HTTP routing · REST and websocket-related endpoint registration. · `server/routes`
- [Controllers](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/controller): Domain logic · Request handling and business logic per capability. · `server/controller`
- [Middleware](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/middleware): Cross-cutting · Auth, validation, and centralized error handling. · `server/middleware`
- [Shared utils](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/utils): Services · Realtime, AI, email, cache, storage, security, and helper services. · `server/utils`
- [Auth & security](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/auth.js): Security domain · Authentication, tokens, sessions, password reset, MFA, OAuth, and lockout protections. · `server/routes/auth.js`
- [Employees](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/employee.js): HR domain · Employee CRUD, profiles, search, and exports. · `server/routes/employee.js`
- [Attendance](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/attendance.js): Timekeeping domain · Check-in/out, attendance records, summaries, and calendars. · `server/routes/attendance.js`
- [Leaves](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/leave.js): Workflow domain · Leave requests, approvals, balances, overlap checks, and predictions. · `server/routes/leave.js`
- [Comms](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/chat.js): Realtime domain · Chat, announcements, and notifications delivered through API and sockets. · `server/routes/chat.js`
- [Docs & holidays](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/document.js): Support domain · Document handling and holiday/calendar data. · `server/routes/document.js`
- [Activity log](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/activityLog.js): Audit domain · Administrative audit trail and login history visibility. · `server/routes/activityLog.js`
- [AI services](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/routes/ai.js): Assistive domain · Attendance insights, chatbot, leave prediction, search, and security helpers. · `server/routes/ai.js`

### Data & services

Persistence, storage, and supporting external services.

- [PostgreSQL](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/config/database.js): Supabase DB · Managed PostgreSQL database accessed via Knex migrations and queries. · `server/config/database.js`
- [File storage](https://github.com/haridevex/elegance-it-geo-infotech/tree/main/server/uploads): Uploads & Supabase · Local upload area and Supabase storage integration for documents and assets. · `server/uploads`
- [External services](https://github.com/haridevex/elegance-it-geo-infotech/blob/main/server/utils/emailService.js): Email/Redis/Sentry/OAuth · Supporting services for mail, caching, observability, and third-party auth. · `server/utils/emailService.js`

## Connections

- Pages → Auth state: reads session · Pages render based on SPA authentication state.
- Pages → API client: calls API · Route screens fetch and mutate data through the backend boundary.
- Workflows → API client: uses API · Feature widgets interact with backend endpoints for business operations.
- Charts → Workflows: visualizes · Dashboard charts present attendance and summary data from feature modules.
- Frontend tests → Pages: covers · Tests validate core UI behavior.
- Server entry → Routes: mounts · Express bootstrap registers the route surface.
- Server entry → Middleware: applies · Central app wiring installs auth, validation, and error handling.
- Server entry → Shared utils: initializes · Runtime startup wires realtime and supporting services.
- Routes → Controllers: delegates · Endpoints forward business actions to controllers.
- Controllers → Middleware: validated by · Requests are protected by authentication and input validation.
- Controllers → PostgreSQL: queries · Controllers persist and read system-of-record data via Knex/PostgreSQL.
- Controllers → Shared utils: uses services · Domain logic depends on shared helpers for sockets, AI, email, cache, and storage.
- Auth & security → External services: tokens/mfa · Authentication relies on security helpers and external auth support.
- Employees → File storage: exports/files · Employee workflows can involve file and export handling.
- Attendance → PostgreSQL: stores records · Attendance and check-in events are persisted in the database.
- Leaves → PostgreSQL: stores requests · Leave and balance workflows persist approval state and history.
- Comms → Shared utils: realtime · Chat and notifications depend on socket and messaging utilities.
- Docs & holidays → File storage: uploads · Document workflows use local and Supabase-backed file storage.
- Activity log → PostgreSQL: audits · Activity and login history are sourced from persistent records.
- AI services → Shared utils: models/helpers · AI endpoints are implemented by dedicated utility modules.
- Shared utils → External services: integrates · Utilities connect to email, Redis, Sentry, OAuth, and storage services.
- API client → Routes: HTTP requests · The SPA communicates with the Express route surface through the API client.
