# fatimatanveer76/devflow-crm architecture

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

- Interactive diagram: https://gitdiagram.com/fatimatanveer76/devflow-crm
- Repository: https://github.com/fatimatanveer76/devflow-crm

## Overview

DevFlow CRM is a role-aware CRM for managing leads, deals, projects, tasks, users, notes, and activity, with dashboard analytics. Users enter through the web app, authenticate or restore a session, then use protected pages that dispatch client state actions to an API; server routes authorize and validate requests before controllers and services perform domain operations against PostgreSQL. The graph preserves the documented CRM domains and analytics, but several links are based on the SOURCE INDEX rather than inspected implementations; those links are limited to references it explicitly records.

Main entry points: [`client/src/routes/AppRoutes.jsx`](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/routes/AppRoutes.jsx) (Page routing), [`client/src/App.jsx`](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/App.jsx) (App startup), [`client/src/pages/TasksPage.jsx`](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/TasksPage.jsx) (Task workspace), [`server/src/routes/index.js`](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/index.js) (API route registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App startup<br/>[App.jsx]"]
  node_routes["Page routing<br/>[AppRoutes.jsx]"]
  node_dashboard["Analytics dashboard<br/>[DashboardPage.jsx]"]
  node_leadpage["Lead workspace<br/>[LeadsPage.jsx]"]
  node_dealpage["Deal workspace<br/>[DealsPage.jsx]"]
  node_projectpage["Project workspace<br/>[ProjectsPage.jsx]"]
  node_taskpage["Task workspace<br/>[TasksPage.jsx]"]
  node_userpage["User management<br/>[UsersPage.jsx]"]
end

subgraph group_clientdata["Client state and API"]
  node_authstate["Session state<br/>[authSlice.js]"]
  node_leadsstate["Lead state<br/>[leadsSlice.js]"]
  node_dealsstate["Deal state<br/>[dealsSlice.js]"]
  node_projectsstate["Project state<br/>[projectsSlice.js]"]
  node_tasksstate["Task state<br/>[tasksSlice.js]"]
  node_usersstate["User state<br/>[usersSlice.js]"]
  node_api["HTTP client<br/>[axiosClient.js]"]
end

subgraph group_server["API and security"]
  node_serverapp["API application<br/>[app.js]"]
  node_apiroot["API route registry<br/>[index.js]"]
  node_authservice["Authentication service<br/>[auth.service.js]"]
  node_jwt["JWT operations<br/>[jwt.service.js]"]
  node_authmw["Request authentication<br/>[auth.middleware.js]"]
  node_rbac["Role permissions<br/>[rbac.middleware.js]"]
  node_roles["Role definitions<br/>[roles.js]"]
end

subgraph group_domains["CRM domains"]
  node_leadapi["Lead endpoints<br/>[lead.routes.js]"]
  node_leadcontroller["Lead requests<br/>[lead.controller.js]"]
  node_leadservice["Lead operations<br/>[lead.service.js]"]
  node_dealapi["Deal endpoints<br/>[deal.routes.js]"]
  node_dealcontroller["Deal requests<br/>[deal.controller.js]"]
  node_dealservice["Deal operations<br/>[deal.service.js]"]
  node_projectcontroller["Project requests"]
  node_projectservice["Project operations<br/>[project.service.js]"]
  node_taskdomain["Task management<br/>[task.service.js]"]
  node_userdomain["User management<br/>[user.service.js]"]
  node_analytics["Dashboard analytics"]
end

subgraph group_storage["Persistence"]
end

node_user(("CRM user"))

node_user -->|"opens"| node_app
node_app -->|"restores session"| node_authstate
node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_leadpage
node_routes -->|"routes to"| node_dealpage
node_routes -->|"routes to"| node_projectpage
node_routes -->|"routes to"| node_taskpage
node_routes -->|"role-gates"| node_userpage
node_authstate -->|"sets token"| node_api
node_leadpage -->|"dispatches"| node_leadsstate
node_dealpage -->|"dispatches"| node_dealsstate
node_taskpage -->|"dispatches"| node_tasksstate
node_taskpage -->|"loads users"| node_usersstate
node_serverapp -->|"mounts API"| node_apiroot
node_apiroot -.->|"registers"| node_leadapi
node_leadapi -->|"routes requests"| node_leadcontroller
node_leadcontroller -->|"calls"| node_leadservice
node_dealapi -->|"routes requests"| node_dealcontroller
node_dealcontroller -->|"calls"| node_dealservice
node_apiroot -.->|"registers"| node_dealapi
node_authmw -->|"verifies token"| node_jwt
node_authmw -.->|"loads identity"| node_roles
node_rbac -->|"checks permissions"| node_roles
node_authservice -->|"issues tokens"| node_jwt
node_authservice -->|"uses roles"| node_roles
node_leadservice -.->|"validates lead references"| node_dealservice
node_projectcontroller -->|"calls"| node_projectservice
node_dealservice -.->|"references projects"| node_projectservice
node_taskdomain -.->|"references leads"| node_leadservice
node_analytics -.->|"serves dashboard API"| node_serverapp

click node_app "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/App.jsx"
click node_routes "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/routes/AppRoutes.jsx"
click node_dashboard "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/DashboardPage.jsx"
click node_leadpage "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/LeadsPage.jsx"
click node_dealpage "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/DealsPage.jsx"
click node_projectpage "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/ProjectsPage.jsx"
click node_taskpage "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/TasksPage.jsx"
click node_userpage "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/UsersPage.jsx"
click node_authstate "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/auth/authSlice.js"
click node_leadsstate "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/leads/leadsSlice.js"
click node_dealsstate "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/deals/dealsSlice.js"
click node_projectsstate "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/projects/projectsSlice.js"
click node_tasksstate "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/tasks/tasksSlice.js"
click node_usersstate "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/users/usersSlice.js"
click node_api "https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/api/axiosClient.js"
click node_serverapp "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/app.js"
click node_apiroot "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/index.js"
click node_authservice "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/auth.service.js"
click node_jwt "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/jwt.service.js"
click node_authmw "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/middleware/auth.middleware.js"
click node_rbac "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/middleware/rbac.middleware.js"
click node_roles "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/config/roles.js"
click node_leadapi "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/lead.routes.js"
click node_leadcontroller "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/controllers/lead.controller.js"
click node_leadservice "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/lead.service.js"
click node_dealapi "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/deal.routes.js"
click node_dealcontroller "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/controllers/deal.controller.js"
click node_dealservice "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/deal.service.js"
click node_projectcontroller "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/controllers/project.controller.js"
click node_projectservice "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/project.service.js"
click node_taskdomain "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/task.service.js"
click node_userdomain "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/user.service.js"
click node_analytics "https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/dashboard.service.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_routes,node_dashboard,node_leadpage,node_dealpage,node_projectpage,node_taskpage,node_userpage,node_user toneBlue
class node_authstate,node_leadsstate,node_dealsstate,node_projectsstate,node_tasksstate,node_usersstate,node_api toneAmber
class node_serverapp,node_apiroot,node_authservice,node_jwt,node_authmw,node_rbac,node_roles toneMint
class node_leadapi,node_leadcontroller,node_leadservice,node_dealapi,node_dealcontroller,node_dealservice,node_projectcontroller,node_projectservice,node_taskdomain,node_userdomain,node_analytics toneRose
```

## Components

### Web application

- [App startup](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Page routing](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/routes/AppRoutes.jsx): `client/src/routes/AppRoutes.jsx`
- [Analytics dashboard](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/DashboardPage.jsx): `client/src/pages/DashboardPage.jsx`
- [Lead workspace](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/LeadsPage.jsx): `client/src/pages/LeadsPage.jsx`
- [Deal workspace](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/DealsPage.jsx): `client/src/pages/DealsPage.jsx`
- [Project workspace](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/ProjectsPage.jsx): `client/src/pages/ProjectsPage.jsx`
- [Task workspace](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/TasksPage.jsx): `client/src/pages/TasksPage.jsx`
- [User management](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/pages/UsersPage.jsx): `client/src/pages/UsersPage.jsx`

### Client state and API

- [Session state](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/auth/authSlice.js): `client/src/features/auth/authSlice.js`
- [Lead state](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/leads/leadsSlice.js): `client/src/features/leads/leadsSlice.js`
- [Deal state](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/deals/dealsSlice.js): `client/src/features/deals/dealsSlice.js`
- [Project state](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/projects/projectsSlice.js): `client/src/features/projects/projectsSlice.js`
- [Task state](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/tasks/tasksSlice.js): `client/src/features/tasks/tasksSlice.js`
- [User state](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/features/users/usersSlice.js): `client/src/features/users/usersSlice.js`
- [HTTP client](https://github.com/fatimatanveer76/devflow-crm/blob/main/client/src/api/axiosClient.js): `client/src/api/axiosClient.js`

### API and security

- [API application](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/app.js): `server/src/app.js`
- [API route registry](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/index.js): `server/src/routes/index.js`
- [Authentication service](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/auth.service.js): `server/src/services/auth.service.js`
- [JWT operations](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/jwt.service.js): `server/src/services/jwt.service.js`
- [Request authentication](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/middleware/auth.middleware.js): `server/src/middleware/auth.middleware.js`
- [Role permissions](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/middleware/rbac.middleware.js): `server/src/middleware/rbac.middleware.js`
- [Role definitions](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/config/roles.js): `server/src/config/roles.js`

### CRM domains

- [Lead endpoints](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/lead.routes.js): `server/src/routes/lead.routes.js`
- [Lead requests](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/controllers/lead.controller.js): `server/src/controllers/lead.controller.js`
- [Lead operations](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/lead.service.js): `server/src/services/lead.service.js`
- [Deal endpoints](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/routes/deal.routes.js): `server/src/routes/deal.routes.js`
- [Deal requests](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/controllers/deal.controller.js): `server/src/controllers/deal.controller.js`
- [Deal operations](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/deal.service.js): `server/src/services/deal.service.js`
- [Project requests](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/controllers/project.controller.js): `server/src/controllers/project.controller.js`
- [Project operations](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/project.service.js): `server/src/services/project.service.js`
- [Task management](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/task.service.js): `server/src/services/task.service.js`
- [User management](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/user.service.js): `server/src/services/user.service.js`
- [Dashboard analytics](https://github.com/fatimatanveer76/devflow-crm/blob/main/server/src/services/dashboard.service.js): `server/src/services/dashboard.service.js`

### Other components

- **CRM user**

## Connections

- CRM user → App startup: opens (evidence: `client/src/App.jsx`)
- App startup → Session state: restores session (evidence: `client/src/App.jsx`)
- App startup → Page routing: renders (evidence: `client/src/App.jsx`)
- Page routing → Analytics dashboard: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Page routing → Lead workspace: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Page routing → Deal workspace: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Page routing → Project workspace: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Page routing → Task workspace: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Page routing → User management: role-gates (evidence: `client/src/routes/AppRoutes.jsx`)
- Session state → HTTP client: sets token (evidence: `client/src/features/auth/authSlice.js`)
- Lead workspace → Lead state: dispatches
- Deal workspace → Deal state: dispatches (evidence: `client/src/pages/DealsPage.jsx`)
- Task workspace → Task state: dispatches (evidence: `client/src/pages/TasksPage.jsx`)
- Task workspace → User state: loads users (evidence: `client/src/pages/TasksPage.jsx`)
- API application → API route registry: mounts API (evidence: `server/src/app.js`)
- API route registry → Lead endpoints: registers
- Lead endpoints → Lead requests: routes requests (evidence: `server/src/routes/lead.routes.js`)
- Lead requests → Lead operations: calls (evidence: `server/src/controllers/lead.controller.js`)
- Deal endpoints → Deal requests: routes requests (evidence: `server/src/routes/deal.routes.js`)
- Deal requests → Deal operations: calls (evidence: `server/src/controllers/deal.controller.js`)
- API route registry → Deal endpoints: registers
- Request authentication → JWT operations: verifies token (evidence: `server/src/middleware/auth.middleware.js`)
- Request authentication → Role definitions: loads identity
- Role permissions → Role definitions: checks permissions (evidence: `server/src/middleware/rbac.middleware.js`)
- Authentication service → JWT operations: issues tokens (evidence: `server/src/services/auth.service.js`)
- Authentication service → Role definitions: uses roles (evidence: `server/src/services/auth.service.js`)
- Lead operations → Deal operations: validates lead references
- Project requests → Project operations: calls (evidence: `server/src/controllers/project.controller.js`)
- Deal operations → Project operations: references projects
- Task management → Lead operations: references leads
- Dashboard analytics → API application: serves dashboard API
