# hemantsinghpoonia/crm-system architecture

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

- Interactive diagram: https://gitdiagram.com/hemantsinghpoonia/crm-system
- Repository: https://github.com/hemantsinghpoonia/crm-system

## Overview

This MERN CRM supports account registration/login, password recovery, authenticated ticket creation and management, and a React dashboard/list/detail workflow. The graph follows frontend route and feature orchestration into the API, then the backend routers into authentication helpers and persistence. Email, reset-PIN storage, and ticket detail interactions are included as documented or indexed capabilities; some links are omitted where the sampled source does not establish the caller. The README describes broader customer/contact management, but the tree exposes only user and ticket domains.

Main entry points: [`frontend/src/App.jsx`](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/App.jsx) (Application routes), [`client-api/src/routers/user.router.js`](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/user.router.js) (User routes), [`client-api/src/routers/ticket.router.js`](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/ticket.router.js) (Ticket routes), [`frontend/src/api/userApi.js`](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/api/userApi.js) (User API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["CRM frontend"]
  node_web["Application routes<br/>[App.jsx]"]
  node_layout["Page layout<br/>[DefaultLayout.jsx]"]
  node_entry["Sign-in and reset<br/>[Entry.page.jsx]"]
  node_login["Login form<br/>[Login.comp.jsx]"]
  node_session["Login state<br/>[loginSlice.js]"]
  node_userapi["User API client<br/>[userApi.js]"]
  node_dashboard["Dashboard<br/>[Dashboard.page.jsx]"]
  node_ticketlist["Ticket listing"]
  node_ticketform["Create ticket"]
  node_ticketdetail["Ticket detail<br/>[Ticket.page.jsx]"]
  node_ticketactions["Ticket actions<br/>[ticketActions.js]"]
  node_ticketapi["Ticket API client<br/>[ticketApi.js]"]
end

subgraph group_api["Express API"]
  node_server["HTTP application<br/>[app.js]"]
  node_users["User routes<br/>[user.router.js]"]
  node_tokens["Token refresh route<br/>[token.router.js]"]
  node_tickets["Ticket routes<br/>[ticket.router.js]"]
  node_validation["Request validation"]
end

subgraph group_identity["Identity and access"]
  node_authz["Authorization middleware"]
  node_jwt["JWT services<br/>[jwt.helper.js]"]
  node_redis[("Token cache<br/>[redis.helper.js]")]
  node_password["Password hashing<br/>[bcrypt.helper.js]"]
  node_email["Reset email<br/>[email.helper.js]"]
end

subgraph group_domain["CRM data"]
  node_userstore[("User records<br/>[User.model.js]")]
  node_resetstore[("Reset PIN records<br/>[resetPin.model.js]")]
  node_ticketstore[("Ticket records<br/>[ticket.model.js]")]
end

node_user(("CRM user"))

node_user -->|"uses"| node_web
node_web -->|"checks session"| node_userapi
node_web -->|"updates auth"| node_session
node_web -->|"renders routes"| node_layout
node_web -->|"routes to"| node_dashboard
node_web -->|"routes to"| node_entry
node_web -->|"routes to"| node_ticketlist
node_web -->|"routes to"| node_ticketdetail
node_entry -->|"renders"| node_login
node_login -->|"submits login"| node_userapi
node_login -->|"dispatches"| node_session
node_dashboard -->|"loads tickets"| node_ticketactions
node_ticketlist -->|"loads tickets"| node_ticketactions
node_ticketactions -->|"requests tickets"| node_ticketapi
node_ticketform -.->|"submits ticket"| node_ticketapi
node_ticketdetail -.->|"requests detail"| node_ticketapi
node_userapi -->|"calls HTTP"| node_users
node_userapi -->|"refreshes token"| node_tokens
node_ticketapi -.->|"calls HTTP"| node_tickets
node_server -->|"mounts route"| node_users
node_server -->|"mounts route"| node_tickets
node_server -->|"mounts route"| node_tokens
node_users -->|"validates input"| node_validation
node_tickets -->|"validates input"| node_validation
node_users -->|"guards requests"| node_authz
node_tickets -->|"guards requests"| node_authz
node_authz -->|"verifies token"| node_jwt
node_authz -->|"checks token"| node_redis
node_jwt -->|"stores access token"| node_redis
node_jwt -->|"stores refresh token"| node_userstore
node_users -->|"reads and updates"| node_userstore
node_tokens -->|"verifies and creates"| node_jwt
node_tokens -->|"loads user"| node_userstore
node_users -->|"hashes passwords"| node_password
node_users -->|"manages PIN"| node_resetstore
node_users -->|"sends reset mail"| node_email
node_tickets -->|"manages tickets"| node_ticketstore

click node_web "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/App.jsx"
click node_layout "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/layout/DefaultLayout.jsx"
click node_entry "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/entry/Entry.page.jsx"
click node_login "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/components/login/Login.comp.jsx"
click node_session "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/features/login/loginSlice.js"
click node_userapi "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/api/userApi.js"
click node_dashboard "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/dashboard/Dashboard.page.jsx"
click node_ticketlist "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/ticket-listing/TicketLists.page.jsx"
click node_ticketform "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/components/add-ticket-form/AddTicketForm.comp.jsx"
click node_ticketdetail "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/ticket/Ticket.page.jsx"
click node_ticketactions "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/features/ticket/ticketActions.js"
click node_ticketapi "https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/api/ticketApi.js"
click node_server "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/app.js"
click node_users "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/user.router.js"
click node_tokens "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/token.router.js"
click node_tickets "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/ticket.router.js"
click node_authz "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/middlewares/authorization.middleware.js"
click node_jwt "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/jwt.helper.js"
click node_redis "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/redis.helper.js"
click node_password "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/bcrypt.helper.js"
click node_email "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/email.helper.js"
click node_validation "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/middlewares/validation.middleware.js"
click node_userstore "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/model/user/User.model.js"
click node_resetstore "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/model/reset-pin/resetPin.model.js"
click node_ticketstore "https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/model/ticket/ticket.model.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_web,node_layout,node_entry,node_login,node_session,node_userapi,node_dashboard,node_ticketlist,node_ticketform,node_ticketdetail,node_ticketactions,node_ticketapi,node_user toneBlue
class node_server,node_users,node_tokens,node_tickets,node_validation toneAmber
class node_authz,node_jwt,node_redis,node_password,node_email toneMint
class node_userstore,node_resetstore,node_ticketstore toneRose
```

## Components

### CRM frontend

- [Application routes](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Page layout](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/layout/DefaultLayout.jsx): `frontend/src/layout/DefaultLayout.jsx`
- [Sign-in and reset](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/entry/Entry.page.jsx): `frontend/src/pages/entry/Entry.page.jsx`
- [Login form](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/components/login/Login.comp.jsx): `frontend/src/components/login/Login.comp.jsx`
- [Login state](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/features/login/loginSlice.js): `frontend/src/features/login/loginSlice.js`
- [User API client](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/api/userApi.js): `frontend/src/api/userApi.js`
- [Dashboard](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/dashboard/Dashboard.page.jsx): `frontend/src/pages/dashboard/Dashboard.page.jsx`
- [Ticket listing](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/ticket-listing/TicketLists.page.jsx): `frontend/src/pages/ticket-listing/TicketLists.page.jsx`
- [Create ticket](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/components/add-ticket-form/AddTicketForm.comp.jsx): `frontend/src/components/add-ticket-form/AddTicketForm.comp.jsx`
- [Ticket detail](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/pages/ticket/Ticket.page.jsx): `frontend/src/pages/ticket/Ticket.page.jsx`
- [Ticket actions](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/features/ticket/ticketActions.js): `frontend/src/features/ticket/ticketActions.js`
- [Ticket API client](https://github.com/hemantsinghpoonia/crm-system/blob/main/frontend/src/api/ticketApi.js): `frontend/src/api/ticketApi.js`

### Express API

- [HTTP application](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/app.js): `client-api/app.js`
- [User routes](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/user.router.js): `client-api/src/routers/user.router.js`
- [Token refresh route](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/token.router.js): `client-api/src/routers/token.router.js`
- [Ticket routes](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/routers/ticket.router.js): `client-api/src/routers/ticket.router.js`
- [Request validation](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/middlewares/validation.middleware.js): `client-api/src/middlewares/validation.middleware.js`

### Identity and access

- [Authorization middleware](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/middlewares/authorization.middleware.js): `client-api/src/middlewares/authorization.middleware.js`
- [JWT services](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/jwt.helper.js): `client-api/src/helper/jwt.helper.js`
- [Token cache](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/redis.helper.js): `client-api/src/helper/redis.helper.js`
- [Password hashing](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/bcrypt.helper.js): `client-api/src/helper/bcrypt.helper.js`
- [Reset email](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/helper/email.helper.js): `client-api/src/helper/email.helper.js`

### CRM data

- [User records](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/model/user/User.model.js): `client-api/src/model/user/User.model.js`
- [Reset PIN records](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/model/reset-pin/resetPin.model.js): `client-api/src/model/reset-pin/resetPin.model.js`
- [Ticket records](https://github.com/hemantsinghpoonia/crm-system/blob/main/client-api/src/model/ticket/ticket.model.js): `client-api/src/model/ticket/ticket.model.js`

### Other components

- **CRM user**

## Connections

- CRM user → Application routes: uses (evidence: `README.md`)
- Application routes → User API client: checks session (evidence: `frontend/src/App.jsx`)
- Application routes → Login state: updates auth (evidence: `frontend/src/App.jsx`)
- Application routes → Page layout: renders routes (evidence: `frontend/src/App.jsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Sign-in and reset: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Ticket listing: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Ticket detail: routes to (evidence: `frontend/src/App.jsx`)
- Sign-in and reset → Login form: renders (evidence: `frontend/src/pages/entry/Entry.page.jsx`)
- Login form → User API client: submits login (evidence: `frontend/src/components/login/Login.comp.jsx`)
- Login form → Login state: dispatches
- Dashboard → Ticket actions: loads tickets (evidence: `frontend/src/pages/dashboard/Dashboard.page.jsx`)
- Ticket listing → Ticket actions: loads tickets (evidence: `frontend/src/pages/ticket-listing/TicketLists.page.jsx`)
- Ticket actions → Ticket API client: requests tickets (evidence: `frontend/src/features/ticket/ticketActions.js`)
- Create ticket → Ticket API client: submits ticket
- Ticket detail → Ticket API client: requests detail
- User API client → User routes: calls HTTP (evidence: `frontend/src/api/userApi.js`)
- User API client → Token refresh route: refreshes token (evidence: `frontend/src/api/userApi.js`)
- Ticket API client → Ticket routes: calls HTTP
- HTTP application → User routes: mounts route (evidence: `client-api/app.js`)
- HTTP application → Ticket routes: mounts route (evidence: `client-api/app.js`)
- HTTP application → Token refresh route: mounts route (evidence: `client-api/app.js`)
- User routes → Request validation: validates input (evidence: `client-api/src/routers/user.router.js`)
- Ticket routes → Request validation: validates input (evidence: `client-api/src/routers/ticket.router.js`)
- User routes → Authorization middleware: guards requests (evidence: `client-api/src/routers/user.router.js`)
- Ticket routes → Authorization middleware: guards requests (evidence: `client-api/src/routers/ticket.router.js`)
- Authorization middleware → JWT services: verifies token (evidence: `client-api/src/middlewares/authorization.middleware.js`)
- Authorization middleware → Token cache: checks token (evidence: `client-api/src/middlewares/authorization.middleware.js`)
- JWT services → Token cache: stores access token (evidence: `client-api/src/helper/jwt.helper.js`)
- JWT services → User records: stores refresh token (evidence: `client-api/src/helper/jwt.helper.js`)
- User routes → User records: reads and updates (evidence: `client-api/src/routers/user.router.js`)
- Token refresh route → JWT services: verifies and creates (evidence: `client-api/src/routers/token.router.js`)
- Token refresh route → User records: loads user (evidence: `client-api/src/routers/token.router.js`)
- User routes → Password hashing: hashes passwords (evidence: `client-api/src/routers/user.router.js`)
- User routes → Reset PIN records: manages PIN (evidence: `client-api/src/routers/user.router.js`)
- User routes → Reset email: sends reset mail (evidence: `client-api/src/routers/user.router.js`)
- Ticket routes → Ticket records: manages tickets (evidence: `client-api/src/routers/ticket.router.js`)
