# avinaash076/task-management-system architecture

> Architecture diagram of the GitHub repository avinaash076/task-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avinaash076/task-management-system
- Repository: https://github.com/avinaash076/task-management-system

## Overview

1. **Overall shape**
   - This is a two-tier full-stack application: a **React + TypeScript frontend** talks to a **Node.js + Express backend**, which persists data in **MySQL**.
   - The main domain is **employee task management**: users authenticate, manage employees, manage tasks, and view reports.

2. **Frontend boundary**
   - The `frontend/` app is a **Vite-powered SPA** using **React**, **TypeScript**, **Redux Toolkit**, and **Tailwind CSS**.
   - It is organized around pages and feature modules rather than a monolithic UI, which makes the main architecture diagram split cleanly into app shell, auth state, API client, and screens.

3. **Frontend app shell and routing**
   - `main.tsx`, `App.tsx`, `Layout.tsx`, and `AuthBootstrap.tsx` form the top-level shell.
   - `Layout.tsx` likely provides the shared navigation and page frame, while `AuthBootstrap.tsx` restores or validates auth state before the rest of the UI renders.
   - The page layer is explicit: `DashboardPage`, `EmployeesPage`, `TasksPage`, `ReportsPage`, `LoginPage`, and `RegisterPage`.

4. **Frontend state and API access**
   - `src/store.ts` and `src/features/auth/authSlice.ts` show that **Redux Toolkit** is used for application state, at least for authentication.
   - `src/api/client.ts` is the main frontend-to-backend boundary; this is where HTTP requests are centralized and where auth tokens or headers are likely attached.
   - Most business data is fetched from the backend rather than stored locally in the browser.

5. **Backend service boundary**
   - The `backend/` app is an **Express API** exposed under `/api`.
   - `server.js` is the entry point, while `src/config/db.js` manages database connectivity and likely the fallback behavior described in the README.
   - The backend is the authoritative layer for validation, data access, and business rules.

6. **Backend route structure**
   - The API is split by domain into:
     - `authRoutes.js` for registration and login
     - `employeeRoutes.js` for employee CRUD
     - `taskRoutes.js` for task CRUD
     - `reportRoutes.js` for aggregated/reporting reads
     - `notificationRoutes.js` for notification-related operations
   - This indicates a resource-oriented architecture with separate modules per domain rather than a single generic controller.

7. **Auth and authorization**
   - `src/middleware/auth.js` is the key security boundary on the backend.
   - It likely verifies the caller’s identity and protects routes that should only be available to authenticated users, especially employee/task/report actions.
   - The README’s demo accounts imply the app supports role-aware behavior, at least for admin versus employee access.

8. **Data layer and persistence**
   - `backend/database/schema.sql` defines the MySQL schema for the core entities: employees, tasks, and notifications.
   - The README states that if MySQL is unavailable, the backend falls back to an **in-memory store**, which is an important architectural detail: the app can run locally without full infrastructure, but persistence semantics change in that mode.
   - This means the data layer has two implementations behind the same API contract.

9. **Cross-cutting utilities**
   - `src/utils/email.js`, `notifications.js`, `recipients.js`, and `upload.js` are supporting services around the core CRUD flow.
   - These appear to be **stubbed or lightweight integrations** rather than fully externalized infrastructure, especially for notifications and file uploads.
   - In an architecture diagram, they should be shown as auxiliary capabilities hanging off task/employee workflows, not as primary subsystems.

10. **Primary data flows**
   - **Login/register flow:** frontend auth pages → auth API → backend validation → user/session/token state in frontend Redux.
   - **Employee/task management flow:** page UI → shared API client → Express route → backend validation/auth middleware → MySQL or in-memory store → response back to UI.
   - **Reports flow:** reports page → report endpoint → backend aggregation over stored employee/task data → dashboard/report display.

11. **Operational/runtime boundaries**
   - The backend expects a `.env` file for database configuration, so environment-based configuration is part of the runtime architecture.
   - The frontend runs separately on Vite dev server (`localhost:5173` per README), so the system is split into independent frontend and backend processes during development.
   - The app is intended for local development first, with MySQL as the main persistence service and optional degraded-mode execution without it.

12. **What matters most for a diagram**
   - Draw three main boxes: **React SPA**, **Express API**, and **MySQL/in-memory data store**.
   - Inside the frontend, show **auth state**, **API client**, and **feature pages**.
   - Inside the backend, show **route modules**, **auth middleware**, **DB config**, and **utility integrations**.
   - The key architectural boundary is that the frontend never talks to the database directly; all domain logic and validation live behind the Express API.

Main entry points: [`frontend/src/App.tsx`](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/App.tsx) (App shell), [`frontend/src/api/client.ts`](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/api/client.ts) (API client), [`backend/server.js`](https://github.com/avinaash076/task-management-system/blob/main/backend/server.js) (server.js), [`backend/src/config/db.js`](https://github.com/avinaash076/task-management-system/blob/main/backend/src/config/db.js) (DB config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend SPA"]
  node_frontend_main(("main.tsx<br/>entrypoint<br/>[main.tsx]"))
  node_frontend_app["App shell<br/>[App.tsx]"]
  node_frontend_layout["Layout<br/>[Layout.tsx]"]
  node_frontend_auth_bootstrap["Auth bootstrap<br/>[AuthBootstrap.tsx]"]
  node_frontend_store[("Redux store<br/>state store<br/>[store.ts]")]
  node_frontend_auth_slice["Auth state<br/>redux slice<br/>[authSlice.ts]"]
  node_frontend_api_client["API client<br/>http client<br/>[client.ts]"]
  node_frontend_login["Login page<br/>screen<br/>[LoginPage.tsx]"]
  node_frontend_register["Register page<br/>screen<br/>[RegisterPage.tsx]"]
  node_frontend_dashboard["Dashboard<br/>screen<br/>[DashboardPage.tsx]"]
  node_frontend_employees["Employees<br/>screen<br/>[EmployeesPage.tsx]"]
  node_frontend_tasks["Tasks<br/>screen<br/>[TasksPage.tsx]"]
  node_frontend_reports["Reports<br/>screen<br/>[ReportsPage.tsx]"]
end

subgraph group_backend["Backend API"]
  node_backend_server(("server.js<br/>api entrypoint<br/>[server.js]"))
  node_backend_routes_auth["Auth routes<br/>route module<br/>[authRoutes.js]"]
  node_backend_routes_employees["Employee routes<br/>route module<br/>[employeeRoutes.js]"]
  node_backend_routes_tasks["Task routes<br/>route module<br/>[taskRoutes.js]"]
  node_backend_routes_reports["Report routes<br/>route module<br/>[reportRoutes.js]"]
  node_backend_routes_notifications["Notify routes<br/>route module"]
  node_backend_auth_middleware{{"Auth middleware<br/>security middleware<br/>[auth.js]"}}
  node_backend_db_config[("DB config<br/>db connector<br/>[db.js]")]
  node_backend_utils["Utilities<br/>support services<br/>[email.js]"]
end

subgraph group_data["Data Layer"]
  node_data_schema["Schema<br/>[schema.sql]"]
  node_data_store[("MySQL / memory<br/>persistence")]
end

node_frontend_main -->|"bootstraps"| node_frontend_app
node_frontend_app -->|"uses"| node_frontend_layout
node_frontend_app -->|"initializes"| node_frontend_auth_bootstrap
node_frontend_app -->|"routes to"| node_frontend_login
node_frontend_app -->|"routes to"| node_frontend_register
node_frontend_app -->|"routes to"| node_frontend_dashboard
node_frontend_app -->|"routes to"| node_frontend_employees
node_frontend_app -->|"routes to"| node_frontend_tasks
node_frontend_app -->|"routes to"| node_frontend_reports
node_frontend_store -->|"contains"| node_frontend_auth_slice
node_frontend_auth_bootstrap -->|"reads"| node_frontend_store
node_frontend_login -->|"calls"| node_frontend_api_client
node_frontend_register -->|"calls"| node_frontend_api_client
node_frontend_dashboard -->|"fetches"| node_frontend_api_client
node_frontend_employees -->|"fetches"| node_frontend_api_client
node_frontend_tasks -->|"fetches"| node_frontend_api_client
node_frontend_reports -->|"fetches"| node_frontend_api_client
node_frontend_api_client -->|"requests"| node_backend_server
node_backend_server -->|"mounts"| node_backend_routes_auth
node_backend_server -->|"mounts"| node_backend_routes_employees
node_backend_server -->|"mounts"| node_backend_routes_tasks
node_backend_server -->|"mounts"| node_backend_routes_reports
node_backend_server -->|"mounts"| node_backend_routes_notifications
node_backend_routes_employees -->|"guards"| node_backend_auth_middleware
node_backend_routes_tasks -->|"guards"| node_backend_auth_middleware
node_backend_routes_reports -->|"guards"| node_backend_auth_middleware
node_backend_routes_notifications -->|"guards"| node_backend_auth_middleware
node_backend_routes_auth -->|"uses"| node_backend_db_config
node_backend_routes_employees -->|"uses"| node_backend_db_config
node_backend_routes_tasks -->|"uses"| node_backend_db_config
node_backend_routes_reports -->|"uses"| node_backend_db_config
node_backend_routes_notifications -->|"uses"| node_backend_utils
node_backend_db_config -->|"connects to"| node_data_store
node_data_schema -->|"defines"| node_data_store
node_backend_utils -.->|"supports"| node_backend_routes_tasks
node_backend_utils -.->|"supports"| node_backend_routes_notifications

click node_frontend_main "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/main.tsx"
click node_frontend_app "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/App.tsx"
click node_frontend_layout "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/components/Layout.tsx"
click node_frontend_auth_bootstrap "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/components/AuthBootstrap.tsx"
click node_frontend_store "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/store.ts"
click node_frontend_auth_slice "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/features/auth/authSlice.ts"
click node_frontend_api_client "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/api/client.ts"
click node_frontend_login "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/LoginPage.tsx"
click node_frontend_register "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/RegisterPage.tsx"
click node_frontend_dashboard "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_frontend_employees "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/EmployeesPage.tsx"
click node_frontend_tasks "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/TasksPage.tsx"
click node_frontend_reports "https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/ReportsPage.tsx"
click node_backend_server "https://github.com/avinaash076/task-management-system/blob/main/backend/server.js"
click node_backend_routes_auth "https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/authRoutes.js"
click node_backend_routes_employees "https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/employeeRoutes.js"
click node_backend_routes_tasks "https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/taskRoutes.js"
click node_backend_routes_reports "https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/reportRoutes.js"
click node_backend_routes_notifications "https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/notificationRoutes.js"
click node_backend_auth_middleware "https://github.com/avinaash076/task-management-system/blob/main/backend/src/middleware/auth.js"
click node_backend_db_config "https://github.com/avinaash076/task-management-system/blob/main/backend/src/config/db.js"
click node_backend_utils "https://github.com/avinaash076/task-management-system/blob/main/backend/src/utils/email.js"
click node_data_schema "https://github.com/avinaash076/task-management-system/blob/main/backend/database/schema.sql"

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_frontend_main,node_frontend_app,node_frontend_layout,node_frontend_auth_bootstrap,node_frontend_store,node_frontend_auth_slice,node_frontend_api_client,node_frontend_login,node_frontend_register,node_frontend_dashboard,node_frontend_employees,node_frontend_tasks,node_frontend_reports toneBlue
class node_backend_server,node_backend_routes_auth,node_backend_routes_employees,node_backend_routes_tasks,node_backend_routes_reports,node_backend_routes_notifications,node_backend_auth_middleware,node_backend_db_config,node_backend_utils toneAmber
class node_data_schema,node_data_store toneMint
```

## Components

### Frontend SPA

Vite + React client application

- [main.tsx](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/main.tsx): entrypoint · React bootstrap and app mount · `frontend/src/main.tsx`
- [App shell](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/App.tsx): shell · Top-level application composition and routing · `frontend/src/App.tsx`
- [Layout](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/components/Layout.tsx): layout · Shared navigation and page frame · `frontend/src/components/Layout.tsx`
- [Auth bootstrap](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/components/AuthBootstrap.tsx): auth bootstrap · Restores or validates auth before rendering · `frontend/src/components/AuthBootstrap.tsx`
- [Redux store](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/store.ts): state store · Central client state container · `frontend/src/store.ts`
- [Auth state](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/features/auth/authSlice.ts): redux slice · Authentication-related client state · `frontend/src/features/auth/authSlice.ts`
- [API client](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/api/client.ts): http client · Centralized frontend-to-backend requests · `frontend/src/api/client.ts`
- [Login page](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/LoginPage.tsx): screen · Authentication sign-in screen · `frontend/src/pages/LoginPage.tsx`
- [Register page](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/RegisterPage.tsx): screen · User registration screen · `frontend/src/pages/RegisterPage.tsx`
- [Dashboard](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/DashboardPage.tsx): screen · Overview and summary screen · `frontend/src/pages/DashboardPage.tsx`
- [Employees](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/EmployeesPage.tsx): screen · Employee management screen · `frontend/src/pages/EmployeesPage.tsx`
- [Tasks](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/TasksPage.tsx): screen · Task management screen · `frontend/src/pages/TasksPage.tsx`
- [Reports](https://github.com/avinaash076/task-management-system/blob/main/frontend/src/pages/ReportsPage.tsx): screen · Reporting and analytics screen · `frontend/src/pages/ReportsPage.tsx`

### Backend API

Express service layer and route modules

- [server.js](https://github.com/avinaash076/task-management-system/blob/main/backend/server.js): api entrypoint · Express server bootstrap and API mount · `backend/server.js`
- [Auth routes](https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/authRoutes.js): route module · Login and registration endpoints · `backend/src/routes/authRoutes.js`
- [Employee routes](https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/employeeRoutes.js): route module · Employee CRUD endpoints · `backend/src/routes/employeeRoutes.js`
- [Task routes](https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/taskRoutes.js): route module · Task CRUD endpoints · `backend/src/routes/taskRoutes.js`
- [Report routes](https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/reportRoutes.js): route module · Aggregated reporting endpoints · `backend/src/routes/reportRoutes.js`
- [Notify routes](https://github.com/avinaash076/task-management-system/blob/main/backend/src/routes/notificationRoutes.js): route module · Notification-related endpoints · `backend/src/routes/notificationRoutes.js`
- [Auth middleware](https://github.com/avinaash076/task-management-system/blob/main/backend/src/middleware/auth.js): security middleware · Verifies identity and protects routes · `backend/src/middleware/auth.js`
- [DB config](https://github.com/avinaash076/task-management-system/blob/main/backend/src/config/db.js): db connector · Database connection and fallback setup · `backend/src/config/db.js`
- [Utilities](https://github.com/avinaash076/task-management-system/blob/main/backend/src/utils/email.js): support services · Email, notifications, recipients, and upload helpers · `backend/src/utils/email.js`

### Data Layer

MySQL schema and fallback persistence

- [Schema](https://github.com/avinaash076/task-management-system/blob/main/backend/database/schema.sql): mysql schema · Core MySQL tables for employees, tasks, and notifications · `backend/database/schema.sql`
- **MySQL / memory**: persistence · Primary database with in-memory fallback

## Connections

- main.tsx → App shell: bootstraps · Mounts the application shell
- App shell → Layout: uses · Wraps screens in shared layout
- App shell → Auth bootstrap: initializes · Restores auth before protected UI
- App shell → Login page: routes to · Displays login screen
- App shell → Register page: routes to · Displays registration screen
- App shell → Dashboard: routes to · Displays dashboard screen
- App shell → Employees: routes to · Displays employee screen
- App shell → Tasks: routes to · Displays task screen
- App shell → Reports: routes to · Displays reporting screen
- Redux store → Auth state: contains · Registers auth state in the store
- Auth bootstrap → Redux store: reads · Checks persisted session state
- Login page → API client: calls · Submits credentials to backend
- Register page → API client: calls · Creates new user account
- Dashboard → API client: fetches · Loads overview data
- Employees → API client: fetches · Reads and updates employees
- Tasks → API client: fetches · Reads and updates tasks
- Reports → API client: fetches · Loads aggregated reports
- API client → server.js: requests · Sends HTTP API calls
- server.js → Auth routes: mounts · Exposes authentication endpoints
- server.js → Employee routes: mounts · Exposes employee endpoints
- server.js → Task routes: mounts · Exposes task endpoints
- server.js → Report routes: mounts · Exposes report endpoints
- server.js → Notify routes: mounts · Exposes notification endpoints
- Employee routes → Auth middleware: guards · Protects employee actions
- Task routes → Auth middleware: guards · Protects task actions
- Report routes → Auth middleware: guards · Protects reporting actions
- Notify routes → Auth middleware: guards · Protects notification actions
- Auth routes → DB config: uses · Persists and validates auth data
- Employee routes → DB config: uses · Reads and writes employee data
- Task routes → DB config: uses · Reads and writes task data
- Report routes → DB config: uses · Aggregates stored data
- Notify routes → Utilities: uses · Delegates notification helpers
- DB config → MySQL / memory: connects to · Uses MySQL when available or memory fallback
- Schema → MySQL / memory: defines · Describes core persisted entities
- Utilities → Task routes: supports · Assists task-driven workflows
- Utilities → Notify routes: supports · Assists notification workflows
