# rajat-wyrm/salesforge architecture

> Architecture diagram of the GitHub repository rajat-wyrm/salesforge, 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/rajat-wyrm/salesforge
- Repository: https://github.com/rajat-wyrm/salesforge

## Overview

SalesForge is a full-stack sales CRM and revenue operations workspace. Users authenticate, work in organization-scoped sales workflows—prospecting and managing leads, deals, and customer activity—and use reporting, automation, integrations, and billing capabilities. The frontend presents these workflows; its API client connects to an Express API that mounts feature routes, with PostgreSQL-backed account, subscription, and session operations evidenced in sampled controllers and services. The tree indicates additional product areas, but their internal call paths were not sampled, so those links are shown only at the mounted-route level.

Main entry points: [`backend/app.js`](https://github.com/rajat-wyrm/salesforge/blob/main/backend/app.js) (Express API), [`frontend/src/router/AppRouter.jsx`](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/router/AppRouter.jsx) (App router), [`frontend/src/lib/api.js`](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/lib/api.js) (API client), [`backend/config/postgres.js`](https://github.com/rajat-wyrm/salesforge/blob/main/backend/config/postgres.js) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web workspace"]
  node_frontend["SalesForge UI<br/>[App.jsx]"]
  node_router["App router<br/>[AppRouter.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_leads_ui["Lead workspace<br/>[Leads.jsx]"]
  node_deals_ui["Deals workspace<br/>[Deals.jsx]"]
  node_analytics_ui["Analytics workspace<br/>[Analytics.jsx]"]
  node_search_ui["Prospect search<br/>[DatabaseSearch.jsx]"]
end

subgraph group_api["API surface"]
  node_server["Express API<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_lead_routes["Lead routes<br/>[leadRoutes.js]"]
  node_deal_routes["Deal routes<br/>[dealRoutes.js]"]
  node_analytics_routes["Analytics routes<br/>[analyticsRoutes.js]"]
  node_team_routes["Team routes<br/>[teamRoutes.js]"]
  node_billing_routes["Billing routes<br/>[billingRoutes.js]"]
  node_workflow_routes["Workflow routes<br/>[workflowRoutes.js]"]
  node_integration_routes["Integration routes"]
  node_other_routes["Other feature routes"]
end

subgraph group_sales["Sales operations"]
end

subgraph group_platform["Workspace platform"]
  node_auth_controller["Account lifecycle<br/>[authController.js]"]
  node_team_controller["Organization and team<br/>[teamController.js]"]
  node_billing_controller["Plans and payments"]
  node_sessions["Session service<br/>[sessionService.js]"]
end

subgraph group_runtime["Runtime services"]
  node_postgres[("PostgreSQL<br/>[postgres.js]")]
  node_redis[("Redis<br/>[redis.js]")]
end

node_user(("Sales user"))
node_razorpay["Razorpay"]
node_google["Google OAuth"]

node_user -->|"uses"| node_frontend
node_frontend -->|"renders"| node_router
node_router -->|"routes to"| node_leads_ui
node_router -->|"routes to"| node_deals_ui
node_router -->|"routes to"| node_analytics_ui
node_router -->|"routes to"| node_search_ui
node_leads_ui -->|"requests data"| node_api_client
node_deals_ui -->|"requests data"| node_api_client
node_analytics_ui -->|"requests data"| node_api_client
node_search_ui -->|"searches leads"| node_api_client
node_api_client -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_lead_routes
node_server -->|"mounts"| node_deal_routes
node_server -->|"mounts"| node_analytics_routes
node_server -->|"mounts"| node_team_routes
node_server -->|"mounts"| node_billing_routes
node_server -->|"mounts"| node_workflow_routes
node_server -->|"mounts"| node_integration_routes
node_server -->|"mounts"| node_other_routes
node_team_routes -->|"dispatches"| node_team_controller
node_auth_controller -->|"reads and writes"| node_postgres
node_auth_controller -.->|"verifies credential"| node_google
node_auth_controller -->|"session operations"| node_sessions
node_sessions -->|"reads and writes"| node_postgres
node_team_controller -->|"organization data"| node_postgres
node_billing_controller -->|"subscription data"| node_postgres
node_billing_controller -.->|"creates and verifies payments"| node_razorpay
node_server -->|"connects at startup"| node_redis

click node_frontend "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/App.jsx"
click node_router "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/router/AppRouter.jsx"
click node_api_client "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/lib/api.js"
click node_leads_ui "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/pages/Dashboard/Leads.jsx"
click node_deals_ui "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/pages/Dashboard/Deals.jsx"
click node_analytics_ui "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/pages/Dashboard/Analytics.jsx"
click node_search_ui "https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/components/Tools/Database/DatabaseSearch.jsx"
click node_server "https://github.com/rajat-wyrm/salesforge/blob/main/backend/app.js"
click node_auth_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/authRoutes.js"
click node_lead_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/leadRoutes.js"
click node_deal_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/dealRoutes.js"
click node_analytics_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/analyticsRoutes.js"
click node_team_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/teamRoutes.js"
click node_billing_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/billingRoutes.js"
click node_workflow_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/workflowRoutes.js"
click node_integration_routes "https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/integrationRoutes.js"
click node_other_routes "https://github.com/rajat-wyrm/salesforge/tree/main/backend/routes"
click node_auth_controller "https://github.com/rajat-wyrm/salesforge/blob/main/backend/controllers/authController.js"
click node_team_controller "https://github.com/rajat-wyrm/salesforge/blob/main/backend/controllers/teamController.js"
click node_billing_controller "https://github.com/rajat-wyrm/salesforge/blob/main/backend/controllers/billingController.js"
click node_sessions "https://github.com/rajat-wyrm/salesforge/blob/main/backend/services/sessionService.js"
click node_postgres "https://github.com/rajat-wyrm/salesforge/blob/main/backend/config/postgres.js"
click node_redis "https://github.com/rajat-wyrm/salesforge/blob/main/backend/config/redis.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_frontend,node_router,node_api_client,node_leads_ui,node_deals_ui,node_analytics_ui,node_search_ui,node_user toneBlue
class node_server,node_auth_routes,node_lead_routes,node_deal_routes,node_analytics_routes,node_team_routes,node_billing_routes,node_workflow_routes,node_integration_routes,node_other_routes toneAmber
class node_auth_controller,node_team_controller,node_billing_controller,node_sessions toneRose
class node_postgres,node_redis,node_razorpay,node_google toneIndigo
```

## Components

### Web workspace

- [SalesForge UI](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [App router](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/router/AppRouter.jsx): `frontend/src/router/AppRouter.jsx`
- [API client](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Lead workspace](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/pages/Dashboard/Leads.jsx): `frontend/src/pages/Dashboard/Leads.jsx`
- [Deals workspace](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/pages/Dashboard/Deals.jsx): `frontend/src/pages/Dashboard/Deals.jsx`
- [Analytics workspace](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/pages/Dashboard/Analytics.jsx): `frontend/src/pages/Dashboard/Analytics.jsx`
- [Prospect search](https://github.com/rajat-wyrm/salesforge/blob/main/frontend/src/components/Tools/Database/DatabaseSearch.jsx): `frontend/src/components/Tools/Database/DatabaseSearch.jsx`

### API surface

- [Express API](https://github.com/rajat-wyrm/salesforge/blob/main/backend/app.js): `backend/app.js`
- [Authentication routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Lead routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/leadRoutes.js): `backend/routes/leadRoutes.js`
- [Deal routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/dealRoutes.js): `backend/routes/dealRoutes.js`
- [Analytics routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/analyticsRoutes.js): `backend/routes/analyticsRoutes.js`
- [Team routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/teamRoutes.js): `backend/routes/teamRoutes.js`
- [Billing routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/billingRoutes.js): `backend/routes/billingRoutes.js`
- [Workflow routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/workflowRoutes.js): `backend/routes/workflowRoutes.js`
- [Integration routes](https://github.com/rajat-wyrm/salesforge/blob/main/backend/routes/integrationRoutes.js): `backend/routes/integrationRoutes.js`
- [Other feature routes](https://github.com/rajat-wyrm/salesforge/tree/main/backend/routes): `backend/routes`

### Workspace platform

- [Account lifecycle](https://github.com/rajat-wyrm/salesforge/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Organization and team](https://github.com/rajat-wyrm/salesforge/blob/main/backend/controllers/teamController.js): `backend/controllers/teamController.js`
- [Plans and payments](https://github.com/rajat-wyrm/salesforge/blob/main/backend/controllers/billingController.js): `backend/controllers/billingController.js`
- [Session service](https://github.com/rajat-wyrm/salesforge/blob/main/backend/services/sessionService.js): `backend/services/sessionService.js`

### Runtime services

- [PostgreSQL](https://github.com/rajat-wyrm/salesforge/blob/main/backend/config/postgres.js): `backend/config/postgres.js`
- [Redis](https://github.com/rajat-wyrm/salesforge/blob/main/backend/config/redis.js): `backend/config/redis.js`

### Other components

- **Sales user**
- **Razorpay**
- **Google OAuth**

## Connections

- Sales user → SalesForge UI: uses
- SalesForge UI → App router: renders
- App router → Lead workspace: routes to
- App router → Deals workspace: routes to
- App router → Analytics workspace: routes to
- App router → Prospect search: routes to
- Lead workspace → API client: requests data
- Deals workspace → API client: requests data
- Analytics workspace → API client: requests data
- Prospect search → API client: searches leads
- API client → Express API: HTTP requests
- Express API → Authentication routes: mounts
- Express API → Lead routes: mounts
- Express API → Deal routes: mounts
- Express API → Analytics routes: mounts
- Express API → Team routes: mounts
- Express API → Billing routes: mounts
- Express API → Workflow routes: mounts
- Express API → Integration routes: mounts
- Express API → Other feature routes: mounts
- Team routes → Organization and team: dispatches
- Account lifecycle → PostgreSQL: reads and writes
- Account lifecycle → Google OAuth: verifies credential
- Account lifecycle → Session service: session operations
- Session service → PostgreSQL: reads and writes
- Organization and team → PostgreSQL: organization data
- Plans and payments → PostgreSQL: subscription data
- Plans and payments → Razorpay: creates and verifies payments
- Express API → Redis: connects at startup
