How haridevex/elegance-it-geo-infotech works
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: utils Shared utils · controller Controllers · database.js PostgreSQL · index.js Server entry
Components 23
Frontend SPA
React browser application for employee, admin, and dashboard workflows.
- Pages · Route-level screens for login, recovery, and dashboards.
Frontend/src/pages - UI kit · Reusable buttons, dialogs, tables, inputs, tabs, and related primitives.
Frontend/src/components/ui - Workflows · Employee, attendance, leave, chat, announcements, notifications, and admin widgets.
Frontend/src/components - Charts · Attendance and summary visualizations used across admin views.
Frontend/src/components/charts - Auth state · SPA-wide authentication and session state.
Frontend/src/context/authContext.jsx - API client · Axios and API configuration for backend requests.
Frontend/src/config - Frontend tests · Component and utility tests for the SPA.
Frontend/src/tests
Backend API
Express API, realtime services, and business logic.
- Server entry · Main runtime wiring for app, routes, middleware, and realtime startup.
server/index.js - Routes · REST and websocket-related endpoint registration.
server/routes - Controllers · Request handling and business logic per capability.
server/controller - Middleware · Auth, validation, and centralized error handling.
server/middleware - Shared utils · Realtime, AI, email, cache, storage, security, and helper services.
server/utils - Auth & security · Authentication, tokens, sessions, password reset, MFA, OAuth, and lockout protections.
server/routes/auth.js - Employees · Employee CRUD, profiles, search, and exports.
server/routes/employee.js - Attendance · Check-in/out, attendance records, summaries, and calendars.
server/routes/attendance.js - Leaves · Leave requests, approvals, balances, overlap checks, and predictions.
server/routes/leave.js - Comms · Chat, announcements, and notifications delivered through API and sockets.
server/routes/chat.js - Docs & holidays · Document handling and holiday/calendar data.
server/routes/document.js - Activity log · Administrative audit trail and login history visibility.
server/routes/activityLog.js - AI services · Attendance insights, chatbot, leave prediction, search, and security helpers.
server/routes/ai.js
Data & services
Persistence, storage, and supporting external services.
- PostgreSQL · Managed PostgreSQL database accessed via Knex migrations and queries.
server/config/database.js - File storage · Local upload area and Supabase storage integration for documents and assets.
server/uploads - External services · Supporting services for mail, caching, observability, and third-party auth.
server/utils/emailService.js
Connections 22
- 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.