# techmiresolutions/tms_portal architecture

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

- Interactive diagram: https://gitdiagram.com/techmiresolutions/tms_portal
- Repository: https://github.com/techmiresolutions/tms_portal

## Overview

#### Purpose and entry points
This is a full-stack HR/payroll management application. The frontend is a Vite React SPA entered through `frontend/src/main.jsx` and composed by `frontend/src/App.jsx`. The backend is a Node.js HTTP API entered through `backend/index.js`, with deployment configuration in `backend/vercel.json`.

#### Backend API boundary
`backend/index.js` is the server composition point: it connects infrastructure, mounts route modules, and exposes the API runtime. Feature-specific route layers separate request endpoints by domain:
- Authentication: `backend/routes/authRoute.js`
- Employees/users: `backend/routes/userRoute.js`
- Payroll: `backend/routes/payrollRoute.js`
- Former employees and files: `backend/routes/exEmployeeRoute.js`, `backend/routes/fileRoute.js`

Routes form the public API boundary; controllers own request handling and domain orchestration.

#### Domain controllers and persistence
Controller modules implement the application’s operational domains:
- Access/authentication: `backend/controllers/authController.js`
- Current user/employee management: `backend/controllers/userController.js`
- Payroll management: `backend/controllers/payrollController.js`
- Former employee records and file operations: `backend/controllers/exEmployeeController.js`, `backend/controllers/fileController.js`

Persistence is accessed through `backend/DB/DBconnection.js` and domain model modules. Models define the stored entities and isolate database-facing representation from HTTP handling:
`backend/models/hrUsers.js`, `backend/models/userModel.js`, `backend/models/payrollModel.js`, `backend/models/exEmployeeModel.js`, and `backend/models/fileModel.js`.

#### Frontend application composition
The React UI provides workflow pages for login, registration, employee administration, payroll viewing, uploads, and profiles. Primary screen-level boundaries are:
`frontend/src/Pages/authPage.jsx`, `frontend/src/Pages/Allusers.jsx`, `frontend/src/Pages/RegisterUser.jsx`, `frontend/src/Pages/ViewDataPage.jsx`, `frontend/src/Pages/UploadPage.jsx`, and `frontend/src/Pages/ExEmployeePage.jsx`.

Shared application shell and reusable presentation elements live in `frontend/src/App.jsx`, `frontend/src/Components/Navbar.jsx`, and `frontend/src/Components/Footer.jsx`. `frontend/src/Components/UserPDF.jsx` indicates a client-side employee/PDF presentation or export capability.

#### Client state and API-driven flows
Feature-scoped stores coordinate UI state and backend interactions:
- Authentication/session state: `frontend/src/Store/authStore.js`
- User records: `frontend/src/Store/userStore.js`
- Payroll records: `frontend/src/Store/payrollStore.js`
- Former employees and uploaded files: `frontend/src/Store/exEmployeeStore.js`, `frontend/src/Store/useFileStore.js`

The primary flow is page action → feature store → backend route/controller → model/database → response → store/UI update. This keeps screen components separated from the API and persistence layers.

#### Validation and business-data boundaries
Frontend schema modules centralize validation or form-data rules before requests cross the API boundary:
`frontend/src/Scheema/authScheema.jsx`, `frontend/src/Scheema/userScheema.jsx`, and `frontend/src/Scheema/payrollScheema.jsx`. Backend controllers and models remain the authoritative boundary for persisted authentication, personnel, payroll, exit-employee, and file data.

#### Runtime and infrastructure
The frontend uses the Vite build/runtime setup in `frontend/vite.config.js` and package dependencies declared in `frontend/package.json`. The backend uses Node.js dependencies in `backend/package.json`, a database connection abstraction at `backend/DB/DBconnection.js`, and Vercel-oriented backend deployment configuration at `backend/vercel.json`. The database service type and any file-storage provider are not identifiable from the supplied tree.

Main entry points: [`backend/index.js`](https://github.com/techmiresolutions/tms_portal/blob/master/backend/index.js) (HTTP API), [`backend/models/hrUsers.js`](https://github.com/techmiresolutions/tms_portal/blob/master/backend/models/hrUsers.js) (Domain models), [`frontend/src/App.jsx`](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/App.jsx) (App shell), [`frontend/src/Pages/authPage.jsx`](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Pages/authPage.jsx) (Workflow pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React frontend"]
  node_vite{{"Vite runtime<br/>build runtime<br/>[vite.config.js]"}}
  node_frontend_entry["SPA entry<br/>React entry<br/>[main.jsx]"]
  node_app_shell["App shell<br/>React composition<br/>[App.jsx]"]
  node_shared_ui["Shared UI<br/>React components<br/>[Navbar.jsx]"]
  node_workflow_pages["Workflow pages<br/>React pages<br/>[authPage.jsx]"]
  node_form_schemas["Form schemas<br/>client validation<br/>[authScheema.jsx]"]
  node_feature_stores["Feature stores<br/>client state<br/>[authStore.js]"]
end

subgraph group_backend["Node API"]
  node_api_server{{"HTTP API<br/>Node server<br/>[index.js]"}}
  node_auth_routes["Auth routes<br/>route module<br/>[authRoute.js]"]
  node_hr_routes["HR and payroll routes<br/>route modules<br/>[userRoute.js]"]
  node_exit_file_routes["Exit and file routes<br/>route modules<br/>[exEmployeeRoute.js]"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
  node_hr_controllers["HR and payroll controllers<br/>[userController.js]"]
  node_exit_file_controllers["Exit and file controllers"]
  node_vercel_deploy["Vercel deployment<br/>deployment config<br/>[vercel.json]"]
end

subgraph group_data["Persistence"]
  node_domain_models["Domain models<br/>data models<br/>[hrUsers.js]"]
  node_db_connection[("Database connection<br/>connection layer<br/>[DBconnection.js]")]
end

node_vite -->|"serves/builds"| node_frontend_entry
node_frontend_entry -->|"renders"| node_app_shell
node_app_shell -->|"composes"| node_shared_ui
node_app_shell -->|"hosts"| node_workflow_pages
node_workflow_pages -->|"validates input"| node_form_schemas
node_workflow_pages -->|"uses"| node_feature_stores
node_feature_stores -->|"HTTP requests"| node_api_server
node_api_server -->|"mounts"| node_auth_routes
node_api_server -->|"mounts"| node_hr_routes
node_api_server -->|"mounts"| node_exit_file_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_hr_routes -->|"dispatches"| node_hr_controllers
node_exit_file_routes -->|"dispatches"| node_exit_file_controllers
node_auth_controller -->|"persists through"| node_domain_models
node_hr_controllers -->|"persists through"| node_domain_models
node_exit_file_controllers -->|"persists through"| node_domain_models
node_domain_models -->|"uses"| node_db_connection
node_vercel_deploy -.->|"deploys"| node_api_server

click node_vite "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/vite.config.js"
click node_frontend_entry "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/main.jsx"
click node_app_shell "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/App.jsx"
click node_shared_ui "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Components/Navbar.jsx"
click node_workflow_pages "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Pages/authPage.jsx"
click node_form_schemas "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Scheema/authScheema.jsx"
click node_feature_stores "https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Store/authStore.js"
click node_api_server "https://github.com/techmiresolutions/tms_portal/blob/master/backend/index.js"
click node_auth_routes "https://github.com/techmiresolutions/tms_portal/blob/master/backend/routes/authRoute.js"
click node_hr_routes "https://github.com/techmiresolutions/tms_portal/blob/master/backend/routes/userRoute.js"
click node_exit_file_routes "https://github.com/techmiresolutions/tms_portal/blob/master/backend/routes/exEmployeeRoute.js"
click node_auth_controller "https://github.com/techmiresolutions/tms_portal/blob/master/backend/controllers/authController.js"
click node_hr_controllers "https://github.com/techmiresolutions/tms_portal/blob/master/backend/controllers/userController.js"
click node_exit_file_controllers "https://github.com/techmiresolutions/tms_portal/blob/master/backend/controllers/exEmployeeController.js"
click node_domain_models "https://github.com/techmiresolutions/tms_portal/blob/master/backend/models/hrUsers.js"
click node_db_connection "https://github.com/techmiresolutions/tms_portal/blob/master/backend/DB/DBconnection.js"
click node_vercel_deploy "https://github.com/techmiresolutions/tms_portal/blob/master/backend/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_vite,node_frontend_entry,node_app_shell,node_shared_ui,node_workflow_pages,node_form_schemas,node_feature_stores toneBlue
class node_api_server,node_auth_routes,node_hr_routes,node_exit_file_routes,node_auth_controller,node_hr_controllers,node_exit_file_controllers,node_vercel_deploy toneAmber
class node_domain_models,node_db_connection toneMint
```

## Components

### React frontend

- [Vite runtime](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/vite.config.js): build runtime · `frontend/vite.config.js`
- [SPA entry](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/main.jsx): React entry · `frontend/src/main.jsx`
- [App shell](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/App.jsx): React composition · `frontend/src/App.jsx`
- [Shared UI](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Components/Navbar.jsx): React components · Navigation and footer components. · `frontend/src/Components/Navbar.jsx`
- [Workflow pages](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Pages/authPage.jsx): React pages · Login, employee, payroll, upload, and former-employee screens. · `frontend/src/Pages/authPage.jsx`
- [Form schemas](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Scheema/authScheema.jsx): client validation · Validates auth, user, and payroll input before requests. · `frontend/src/Scheema/authScheema.jsx`
- [Feature stores](https://github.com/techmiresolutions/tms_portal/blob/master/frontend/src/Store/authStore.js): client state · Owns session, employee, payroll, former-employee, and file API flows. · `frontend/src/Store/authStore.js`

### Node API

- [HTTP API](https://github.com/techmiresolutions/tms_portal/blob/master/backend/index.js): Node server · Composes infrastructure and mounts domain routes. · `backend/index.js`
- [Auth routes](https://github.com/techmiresolutions/tms_portal/blob/master/backend/routes/authRoute.js): route module · `backend/routes/authRoute.js`
- [HR and payroll routes](https://github.com/techmiresolutions/tms_portal/blob/master/backend/routes/userRoute.js): route modules · Employee and payroll endpoints. · `backend/routes/userRoute.js`
- [Exit and file routes](https://github.com/techmiresolutions/tms_portal/blob/master/backend/routes/exEmployeeRoute.js): route modules · Former-employee and file endpoints. · `backend/routes/exEmployeeRoute.js`
- [Auth controller](https://github.com/techmiresolutions/tms_portal/blob/master/backend/controllers/authController.js): controller · `backend/controllers/authController.js`
- [HR and payroll controllers](https://github.com/techmiresolutions/tms_portal/blob/master/backend/controllers/userController.js): controllers · Orchestrates employee and payroll operations. · `backend/controllers/userController.js`
- [Exit and file controllers](https://github.com/techmiresolutions/tms_portal/blob/master/backend/controllers/exEmployeeController.js): controllers · Orchestrates former-employee records and file operations. · `backend/controllers/exEmployeeController.js`
- [Vercel deployment](https://github.com/techmiresolutions/tms_portal/blob/master/backend/vercel.json): deployment config · `backend/vercel.json`

### Persistence

- [Domain models](https://github.com/techmiresolutions/tms_portal/blob/master/backend/models/hrUsers.js): data models · Stored representations for users, payroll, former employees, and files. · `backend/models/hrUsers.js`
- [Database connection](https://github.com/techmiresolutions/tms_portal/blob/master/backend/DB/DBconnection.js): connection layer · Database service is unspecified. · `backend/DB/DBconnection.js`

## Connections

- Vite runtime → SPA entry: serves/builds
- SPA entry → App shell: renders
- App shell → Shared UI: composes
- App shell → Workflow pages: hosts
- Workflow pages → Form schemas: validates input
- Workflow pages → Feature stores: uses
- Feature stores → HTTP API: HTTP requests
- HTTP API → Auth routes: mounts
- HTTP API → HR and payroll routes: mounts
- HTTP API → Exit and file routes: mounts
- Auth routes → Auth controller: dispatches
- HR and payroll routes → HR and payroll controllers: dispatches
- Exit and file routes → Exit and file controllers: dispatches
- Auth controller → Domain models: persists through
- HR and payroll controllers → Domain models: persists through
- Exit and file controllers → Domain models: persists through
- Domain models → Database connection: uses
- Vercel deployment → HTTP API: deploys
