# bhargav-sadineni/fullstack-ems architecture

> Architecture diagram of the GitHub repository bhargav-sadineni/fullstack-ems, 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/bhargav-sadineni/fullstack-ems
- Repository: https://github.com/bhargav-sadineni/fullstack-ems

## Overview

This is an employee-management system for administrators and employees. Users sign in, then use role-specific views to manage employee records, attendance, leave, payslips, profiles, and dashboard information; an assistant also answers questions using HR data. The client routes requests through a shared HTTP client to the Express API, whose protected routes delegate to domain controllers and MongoDB models. Scheduled and event-driven attendance and leave reminders are a separate capability. Edges reflect shown routes, imports, and calls; some backend route-to-controller links are supported by the source index rather than full excerpts.

Main entry points: [`server/server.js`](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/server.js) (Express API), [`client/src/App.jsx`](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/App.jsx) (Application routes), [`client/src/api/axios.js`](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/api/axios.js) (HTTP client), [`server/models/Employee.js`](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Employee.js) (Employee records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application routes<br/>[App.jsx]"]
  node_authctx["Session context<br/>[AuthContext.jsx]"]
  node_http["HTTP client<br/>[axios.js]"]
  node_login["Login form<br/>[LoginForm.jsx]"]
  node_layout["App layout<br/>[Layout.jsx]"]
  node_dashboardui["Dashboard view<br/>[Dashboard.jsx]"]
  node_employeesui["Employee management<br/>[Employees.jsx]"]
  node_attendanceui["Attendance view<br/>[Attendance.jsx]"]
  node_leaveui["Leave view<br/>[Leave.jsx]"]
  node_payslipsui["Payslip views<br/>[Payslips.jsx]"]
  node_chatui["Chat widget<br/>[ChatWidget.jsx]"]
end

subgraph group_api["API and workflows"]
  node_server["Express API<br/>[server.js]"]
  node_authmw["Auth middleware<br/>[auth.js]"]
  node_scheduler["Reminder workflows<br/>[index.js]"]
end

subgraph group_hr["HR domains"]
  node_auth["Authentication<br/>[authController.js]"]
  node_employees["Employee records"]
  node_attendance["Attendance operations"]
  node_leave["Leave applications<br/>[leaveController.js]"]
  node_payslips["Payslip operations"]
  node_dashboard["Dashboard data"]
  node_profile["Employee profile"]
  node_chatbot["HR assistant"]
end

subgraph group_data["Persistent data"]
  node_dbconn["MongoDB connection<br/>[db.js]"]
  node_users[("User records<br/>[User.js]")]
  node_employee[("Employee records<br/>[Employee.js]")]
  node_attendance_store[("Attendance records<br/>[Attendance.js]")]
  node_leave_store[("Leave records")]
  node_payslip_store[("Payslip records<br/>[Payslip.js]")]
end

node_user(("Administrator or employee"))
node_gemini{{"Google Gemini"}}

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_layout
node_app -->|"routes to"| node_dashboardui
node_app -->|"routes to"| node_employeesui
node_app -->|"routes to"| node_attendanceui
node_app -->|"routes to"| node_leaveui
node_app -->|"routes to"| node_payslipsui
node_login -->|"signs in through"| node_authctx
node_authctx -->|"requests session"| node_http
node_layout -->|"renders"| node_chatui
node_dashboardui -->|"requests data"| node_http
node_employeesui -->|"requests data"| node_http
node_attendanceui -->|"requests data"| node_http
node_leaveui -->|"requests data"| node_http
node_payslipsui -->|"requests data"| node_http
node_chatui -->|"sends chat"| node_http
node_http -.->|"calls API"| node_server
node_server -->|"protects routes"| node_authmw
node_server -->|"routes requests"| node_auth
node_server -->|"routes requests"| node_employees
node_server -->|"routes requests"| node_attendance
node_server -->|"routes requests"| node_leave
node_server -->|"routes requests"| node_payslips
node_server -->|"routes requests"| node_dashboard
node_server -->|"routes requests"| node_profile
node_server -->|"routes requests"| node_chatbot
node_employees -->|"creates and updates"| node_users
node_employees -->|"reads and writes"| node_employee
node_auth -->|"reads credentials"| node_users
node_attendance -->|"reads and writes"| node_attendance_store
node_attendance -->|"loads employee"| node_employee
node_leave -->|"loads employee"| node_employee
node_leave -->|"reads and writes"| node_leave_store
node_leave -->|"sends event"| node_scheduler
node_payslips -->|"reads and writes"| node_payslip_store
node_payslips -->|"loads employee"| node_employee
node_chatbot -->|"queries and updates"| node_employee
node_chatbot -->|"queries"| node_attendance_store
node_chatbot -->|"queries"| node_leave_store
node_chatbot -->|"sends interactions"| node_gemini
node_scheduler -->|"checks attendance"| node_attendance_store
node_scheduler -->|"loads employees"| node_employee
node_scheduler -->|"checks leave"| node_leave_store
node_server -->|"connects"| node_dbconn
node_employee -->|"references"| node_users

click node_app "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/App.jsx"
click node_authctx "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/context/AuthContext.jsx"
click node_http "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/api/axios.js"
click node_login "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/components/LoginForm.jsx"
click node_layout "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Layout.jsx"
click node_dashboardui "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Dashboard.jsx"
click node_employeesui "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Employees.jsx"
click node_attendanceui "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Attendance.jsx"
click node_leaveui "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Leave.jsx"
click node_payslipsui "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Payslips.jsx"
click node_chatui "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/components/ChatWidget.jsx"
click node_server "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/server.js"
click node_authmw "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/middleware/auth.js"
click node_auth "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/authController.js"
click node_employees "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/employeeController.js"
click node_attendance "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/attendanceController.js"
click node_leave "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/leaveController.js"
click node_payslips "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/payslipController.js"
click node_dashboard "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/dashboardController.js"
click node_profile "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/profileController.js"
click node_chatbot "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/chatbotController.js"
click node_scheduler "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/inngest/index.js"
click node_dbconn "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/config/db.js"
click node_users "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/User.js"
click node_employee "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Employee.js"
click node_attendance_store "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Attendance.js"
click node_leave_store "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/LeaveApplication.js"
click node_payslip_store "https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Payslip.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_authctx,node_http,node_login,node_layout,node_dashboardui,node_employeesui,node_attendanceui,node_leaveui,node_payslipsui,node_chatui toneBlue
class node_server,node_authmw,node_scheduler toneAmber
class node_auth,node_employees,node_attendance,node_leave,node_payslips,node_dashboard,node_profile,node_chatbot toneMint
class node_dbconn,node_users,node_employee,node_attendance_store,node_leave_store,node_payslip_store toneRose
class node_user,node_gemini toneIndigo
```

## Components

### Web client

- [Application routes](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session context](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [HTTP client](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/api/axios.js): `client/src/api/axios.js`
- [Login form](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/components/LoginForm.jsx): `client/src/components/LoginForm.jsx`
- [App layout](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Layout.jsx): `client/src/pages/Layout.jsx`
- [Dashboard view](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Employee management](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Employees.jsx): `client/src/pages/Employees.jsx`
- [Attendance view](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Attendance.jsx): `client/src/pages/Attendance.jsx`
- [Leave view](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Leave.jsx): `client/src/pages/Leave.jsx`
- [Payslip views](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/pages/Payslips.jsx): `client/src/pages/Payslips.jsx`
- [Chat widget](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/client/src/components/ChatWidget.jsx): `client/src/components/ChatWidget.jsx`

### API and workflows

- [Express API](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/server.js): `server/server.js`
- [Auth middleware](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [Reminder workflows](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/inngest/index.js): `server/inngest/index.js`

### HR domains

- [Authentication](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Employee records](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/employeeController.js): `server/controllers/employeeController.js`
- [Attendance operations](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/attendanceController.js): `server/controllers/attendanceController.js`
- [Leave applications](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/leaveController.js): `server/controllers/leaveController.js`
- [Payslip operations](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/payslipController.js): `server/controllers/payslipController.js`
- [Dashboard data](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/dashboardController.js): `server/controllers/dashboardController.js`
- [Employee profile](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/profileController.js): `server/controllers/profileController.js`
- [HR assistant](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/controllers/chatbotController.js): `server/controllers/chatbotController.js`

### Persistent data

- [MongoDB connection](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/config/db.js): `server/config/db.js`
- [User records](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/User.js): `server/models/User.js`
- [Employee records](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Employee.js): `server/models/Employee.js`
- [Attendance records](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Attendance.js): `server/models/Attendance.js`
- [Leave records](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/LeaveApplication.js): `server/models/LeaveApplication.js`
- [Payslip records](https://github.com/bhargav-sadineni/fullstack-ems/blob/main/server/models/Payslip.js): `server/models/Payslip.js`

### Other components

- **Administrator or employee**
- **Google Gemini**

## Connections

- Administrator or employee → Application routes: uses (evidence: `client/src/App.jsx`)
- Application routes → Login form: routes to (evidence: `client/src/App.jsx`)
- Application routes → App layout: routes to (evidence: `client/src/App.jsx`)
- Application routes → Dashboard view: routes to (evidence: `client/src/App.jsx`)
- Application routes → Employee management: routes to (evidence: `client/src/App.jsx`)
- Application routes → Attendance view: routes to (evidence: `client/src/App.jsx`)
- Application routes → Leave view: routes to (evidence: `client/src/App.jsx`)
- Application routes → Payslip views: routes to (evidence: `client/src/App.jsx`)
- Login form → Session context: signs in through (evidence: `client/src/components/LoginForm.jsx`)
- Session context → HTTP client: requests session (evidence: `client/src/context/AuthContext.jsx`)
- App layout → Chat widget: renders (evidence: `client/src/pages/Layout.jsx`)
- Dashboard view → HTTP client: requests data (evidence: `client/src/pages/Dashboard.jsx`)
- Employee management → HTTP client: requests data (evidence: `client/src/pages/Employees.jsx`)
- Attendance view → HTTP client: requests data (evidence: `client/src/pages/Attendance.jsx`)
- Leave view → HTTP client: requests data (evidence: `client/src/pages/Leave.jsx`)
- Payslip views → HTTP client: requests data (evidence: `client/src/pages/Payslips.jsx`)
- Chat widget → HTTP client: sends chat (evidence: `client/src/components/ChatWidget.jsx`)
- HTTP client → Express API: calls API
- Express API → Auth middleware: protects routes
- Express API → Authentication: routes requests
- Express API → Employee records: routes requests
- Express API → Attendance operations: routes requests
- Express API → Leave applications: routes requests
- Express API → Payslip operations: routes requests
- Express API → Dashboard data: routes requests (evidence: `server/server.js`)
- Express API → Employee profile: routes requests (evidence: `server/server.js`)
- Express API → HR assistant: routes requests (evidence: `server/server.js`)
- Employee records → User records: creates and updates (evidence: `server/controllers/employeeController.js`)
- Employee records → Employee records: reads and writes (evidence: `server/controllers/employeeController.js`)
- Authentication → User records: reads credentials (evidence: `server/controllers/authController.js`)
- Attendance operations → Attendance records: reads and writes (evidence: `server/controllers/attendanceController.js`)
- Attendance operations → Employee records: loads employee (evidence: `server/controllers/attendanceController.js`)
- Leave applications → Employee records: loads employee (evidence: `server/controllers/leaveController.js`)
- Leave applications → Leave records: reads and writes (evidence: `server/controllers/leaveController.js`)
- Leave applications → Reminder workflows: sends event (evidence: `server/controllers/leaveController.js`)
- Payslip operations → Payslip records: reads and writes (evidence: `server/controllers/payslipController.js`)
- Payslip operations → Employee records: loads employee (evidence: `server/controllers/payslipController.js`)
- HR assistant → Employee records: queries and updates (evidence: `server/controllers/chatbotController.js`)
- HR assistant → Attendance records: queries (evidence: `server/controllers/chatbotController.js`)
- HR assistant → Leave records: queries (evidence: `server/controllers/chatbotController.js`)
- HR assistant → Google Gemini: sends interactions (evidence: `server/controllers/chatbotController.js`)
- Reminder workflows → Attendance records: checks attendance (evidence: `server/inngest/index.js`)
- Reminder workflows → Employee records: loads employees (evidence: `server/inngest/index.js`)
- Reminder workflows → Leave records: checks leave (evidence: `server/inngest/index.js`)
- Express API → MongoDB connection: connects (evidence: `server/server.js`)
- Employee records → User records: references (evidence: `server/models/Employee.js`)
