# hariomtechentrance/crm-tool architecture

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

- Interactive diagram: https://gitdiagram.com/hariomtechentrance/crm-tool
- Repository: https://github.com/hariomtechentrance/crm-tool

## Overview

BusinessOS is a multi-tenant CRM/ERP: organization members use a React app to manage business records and workflows, while public portals support selected customer-facing tasks. The documented request path is browser to Express API to Prisma/PostgreSQL; sampled routes show authentication, organization scoping, and module gating before controllers. The README identifies broad product areas not all represented in the sampled source, so those are grouped at their supported module directories rather than expanded into speculative controller-level flows.

Main entry points: [`backend/src/routes`](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/routes) (API routes), [`backend/src/lib/prisma.ts`](https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/lib/prisma.ts) (Prisma access), [`frontend/src/App.tsx`](https://github.com/hariomtechentrance/crm-tool/blob/main/frontend/src/App.tsx) (React app), [`frontend/src/lib/api.ts`](https://github.com/hariomtechentrance/crm-tool/blob/main/frontend/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_browser["React app<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_api_server["Express API<br/>[server.ts]"]
  node_route_dispatch["API routes"]
end

subgraph group_platform["Platform access"]
  node_auth_org["Auth and org scope"]
  node_org_admin["Organizations<br/>[org.controller.ts]"]
  node_prisma["Prisma access<br/>[prisma.ts]"]
  node_database[("PostgreSQL")]
end

subgraph group_operations["Core operations"]
  node_sales["Sales and finance"]
  node_inventory["Inventory and purchasing"]
  node_people["HR and payroll<br/>[hr.controller.ts]"]
  node_projects["Projects and work"]
  node_documents_reports["Documents and reports"]
end

subgraph group_engagement["Customer workflows"]
  node_crm["CRM and leads"]
  node_communications["Email and activities"]
  node_support_services["Support and services"]
end

subgraph group_industry["Industry modules"]
  node_industry_ops["Industry modules"]
  node_public_portals["Public portals"]
end

node_member(("Org member"))

node_member -->|"uses"| node_browser
node_browser -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_api_server
node_api_server -->|"mounts routes"| node_route_dispatch
node_route_dispatch -->|"guards requests"| node_auth_org
node_route_dispatch -->|"dispatches"| node_org_admin
node_route_dispatch -->|"dispatches"| node_crm
node_route_dispatch -->|"dispatches"| node_sales
node_route_dispatch -->|"dispatches"| node_inventory
node_route_dispatch -->|"dispatches"| node_people
node_route_dispatch -->|"dispatches"| node_projects
node_route_dispatch -->|"dispatches"| node_documents_reports
node_route_dispatch -->|"dispatches"| node_communications
node_route_dispatch -->|"dispatches"| node_support_services
node_route_dispatch -->|"dispatches"| node_industry_ops
node_org_admin -->|"queries"| node_prisma
node_people -->|"queries"| node_prisma
node_industry_ops -->|"queries"| node_prisma
node_prisma -->|"reads and writes"| node_database
node_browser -->|"routes to"| node_public_portals

click node_browser "https://github.com/hariomtechentrance/crm-tool/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/hariomtechentrance/crm-tool/blob/main/frontend/src/lib/api.ts"
click node_api_server "https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/server.ts"
click node_route_dispatch "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/routes"
click node_auth_org "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/middleware"
click node_org_admin "https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/controllers/org.controller.ts"
click node_crm "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_sales "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_inventory "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_people "https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/controllers/hr.controller.ts"
click node_projects "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_documents_reports "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_communications "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_support_services "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_industry_ops "https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers"
click node_public_portals "https://github.com/hariomtechentrance/crm-tool/tree/main/frontend/src/pages/public"
click node_prisma "https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/lib/prisma.ts"

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_browser,node_api_client,node_api_server,node_route_dispatch toneBlue
class node_auth_org,node_org_admin,node_prisma,node_database toneAmber
class node_sales,node_inventory,node_people,node_projects,node_documents_reports toneMint
class node_crm,node_communications,node_support_services toneRose
class node_industry_ops,node_public_portals,node_member toneIndigo
```

## Components

### App entry

- [React app](https://github.com/hariomtechentrance/crm-tool/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/hariomtechentrance/crm-tool/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Express API](https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [API routes](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/routes): `backend/src/routes`

### Platform access

- [Auth and org scope](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/middleware): `backend/src/middleware`
- [Organizations](https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/controllers/org.controller.ts): `backend/src/controllers/org.controller.ts`
- [Prisma access](https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- **PostgreSQL**

### Core operations

- [Sales and finance](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`
- [Inventory and purchasing](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`
- [HR and payroll](https://github.com/hariomtechentrance/crm-tool/blob/main/backend/src/controllers/hr.controller.ts): `backend/src/controllers/hr.controller.ts`
- [Projects and work](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`
- [Documents and reports](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`

### Customer workflows

- [CRM and leads](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`
- [Email and activities](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`
- [Support and services](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`

### Industry modules

- [Industry modules](https://github.com/hariomtechentrance/crm-tool/tree/main/backend/src/controllers): `backend/src/controllers`
- [Public portals](https://github.com/hariomtechentrance/crm-tool/tree/main/frontend/src/pages/public): `frontend/src/pages/public`

### Other components

- **Org member**

## Connections

- Org member → React app: uses
- React app → API client: requests data
- API client → Express API: calls API
- Express API → API routes: mounts routes
- API routes → Auth and org scope: guards requests
- API routes → Organizations: dispatches
- API routes → CRM and leads: dispatches
- API routes → Sales and finance: dispatches
- API routes → Inventory and purchasing: dispatches
- API routes → HR and payroll: dispatches
- API routes → Projects and work: dispatches
- API routes → Documents and reports: dispatches
- API routes → Email and activities: dispatches
- API routes → Support and services: dispatches
- API routes → Industry modules: dispatches
- Organizations → Prisma access: queries
- HR and payroll → Prisma access: queries
- Industry modules → Prisma access: queries
- Prisma access → PostgreSQL: reads and writes
- React app → Public portals: routes to
