# divdotdev/sumbit_safe_main architecture

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

- Interactive diagram: https://gitdiagram.com/divdotdev/sumbit_safe_main
- Repository: https://github.com/divdotdev/sumbit_safe_main

## Overview

SubmitSafe is a loan-readiness and application-preparation product with a React client and Express API. Users explore and compare loan products and schemes, prepare and analyze documents, review readiness, grant consent, and create or track applications; they can also request agent assistance. Admin and partner workflows support catalog and lead operations. The README documents mock and live provider modes and an application-aware Copilot. Several backend implementations were not sampled, so the graph shows documented capabilities and explicit route/provider wiring without asserting uncertain service-level calls.

Main entry points: [`server/routes/index.js`](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/routes/index.js) (API routes), [`client/src/main.jsx`](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/main.jsx) (SubmitSafe client), [`client/src/services/api.js`](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/services/api.js) (API client), [`server/services/store.js`](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/store.js) (Application store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User experience"]
  node_clientapp["SubmitSafe client<br/>[main.jsx]"]
  node_loanjourney["Loan discovery<br/>[Loans.jsx]"]
  node_documentsui["Document workspace<br/>[Documents.jsx]"]
  node_applicationui["Application journey<br/>[Applications.jsx]"]
  node_schemeui["Schemes and agents<br/>[Schemes.jsx]"]
  node_operationsui["Operations portal<br/>[Operations.jsx]"]
  node_copilotui["Copilot interface<br/>[Copilot.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
end

subgraph group_api["API and workflows"]
  node_expressapp["HTTP application<br/>[app.js]"]
  node_routes["API routes<br/>[index.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_catalog["Catalog workflows<br/>[catalog.js]"]
  node_documents["Document workflows<br/>[documents.js]"]
  node_workflows["Consent and applications<br/>[workflows.js]"]
  node_copilot["Copilot API<br/>[copilot.js]"]
  node_operations["Admin and partner API<br/>[operations.js]"]
end

subgraph group_domain["Domain capabilities"]
  node_readiness["Readiness and matching"]
  node_documentanalysis["Document analysis"]
  node_sarthi["Sarthi assistance<br/>[sarthi.js]"]
end

subgraph group_state["State and integrations"]
  node_store[("Application store<br/>[store.js]")]
  node_providers["Provider selection<br/>[index.js]"]
end

node_borrower(("Borrower"))
node_external{{"External providers"}}

node_borrower -->|"uses"| node_clientapp
node_clientapp -->|"routes to"| node_loanjourney
node_clientapp -->|"routes to"| node_documentsui
node_clientapp -->|"routes to"| node_applicationui
node_clientapp -->|"routes to"| node_schemeui
node_clientapp -->|"routes to"| node_operationsui
node_clientapp -->|"hosts"| node_copilotui
node_loanjourney -->|"requests"| node_clientapi
node_documentsui -->|"requests"| node_clientapi
node_applicationui -->|"requests"| node_clientapi
node_schemeui -->|"requests"| node_clientapi
node_operationsui -->|"requests"| node_clientapi
node_copilotui -->|"requests"| node_clientapi
node_clientapi -->|"calls API"| node_expressapp
node_expressapp -->|"mounts"| node_routes
node_routes -->|"dispatches"| node_auth
node_routes -->|"dispatches"| node_catalog
node_routes -->|"dispatches"| node_documents
node_routes -->|"dispatches"| node_workflows
node_routes -->|"dispatches"| node_copilot
node_routes -->|"mounts"| node_operations
node_routes -->|"provides"| node_store
node_catalog -->|"matches products"| node_readiness
node_documents -->|"analyzes documents"| node_documentanalysis
node_workflows -->|"persists records"| node_store
node_documents -->|"reads and writes"| node_store
node_auth -->|"reads and writes"| node_store
node_catalog -->|"reads catalog"| node_store
node_operations -->|"manages records"| node_store
node_copilot -->|"grounds assistance"| node_sarthi
node_copilot -->|"uses AI"| node_providers
node_documents -->|"uses verification"| node_providers
node_workflows -->|"uses lender"| node_providers
node_providers -.->|"selects live integrations"| node_external

click node_clientapp "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/main.jsx"
click node_loanjourney "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Loans.jsx"
click node_documentsui "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Documents.jsx"
click node_applicationui "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Applications.jsx"
click node_schemeui "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Schemes.jsx"
click node_operationsui "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Operations.jsx"
click node_copilotui "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/components/Copilot.jsx"
click node_clientapi "https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/services/api.js"
click node_expressapp "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/app.js"
click node_routes "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/routes/index.js"
click node_auth "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/auth.js"
click node_catalog "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/catalog.js"
click node_documents "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/documents.js"
click node_workflows "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/workflows.js"
click node_copilot "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/copilot.js"
click node_operations "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/routes/operations.js"
click node_readiness "https://github.com/divdotdev/sumbit_safe_main/tree/main/server/services"
click node_documentanalysis "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/documentAnalysis.js"
click node_sarthi "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/sarthi.js"
click node_store "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/store.js"
click node_providers "https://github.com/divdotdev/sumbit_safe_main/blob/main/server/providers/index.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_clientapp,node_loanjourney,node_documentsui,node_applicationui,node_schemeui,node_operationsui,node_copilotui,node_clientapi toneBlue
class node_expressapp,node_routes,node_auth,node_catalog,node_documents,node_workflows,node_copilot,node_operations toneAmber
class node_readiness,node_documentanalysis,node_sarthi toneMint
class node_store,node_providers toneRose
class node_borrower,node_external toneIndigo
```

## Components

### User experience

- [SubmitSafe client](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/main.jsx): `client/src/main.jsx`
- [Loan discovery](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Loans.jsx): `client/src/pages/Loans.jsx`
- [Document workspace](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Documents.jsx): `client/src/pages/Documents.jsx`
- [Application journey](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Applications.jsx): `client/src/pages/Applications.jsx`
- [Schemes and agents](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Schemes.jsx): `client/src/pages/Schemes.jsx`
- [Operations portal](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/pages/Operations.jsx): `client/src/pages/Operations.jsx`
- [Copilot interface](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/components/Copilot.jsx): `client/src/components/Copilot.jsx`
- [API client](https://github.com/divdotdev/sumbit_safe_main/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API and workflows

- [HTTP application](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/app.js): `server/app.js`
- [API routes](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/routes/index.js): `server/routes/index.js`
- [Authentication](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/auth.js): `server/controllers/auth.js`
- [Catalog workflows](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/catalog.js): `server/controllers/catalog.js`
- [Document workflows](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/documents.js): `server/controllers/documents.js`
- [Consent and applications](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/workflows.js): `server/controllers/workflows.js`
- [Copilot API](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/controllers/copilot.js): `server/controllers/copilot.js`
- [Admin and partner API](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/routes/operations.js): `server/routes/operations.js`

### Domain capabilities

- [Readiness and matching](https://github.com/divdotdev/sumbit_safe_main/tree/main/server/services): `server/services`
- [Document analysis](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/documentAnalysis.js): `server/services/documentAnalysis.js`
- [Sarthi assistance](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/sarthi.js): `server/services/sarthi.js`

### State and integrations

- [Application store](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/services/store.js): `server/services/store.js`
- [Provider selection](https://github.com/divdotdev/sumbit_safe_main/blob/main/server/providers/index.js): `server/providers/index.js`

### Other components

- **Borrower**
- **External providers**

## Connections

- Borrower → SubmitSafe client: uses
- SubmitSafe client → Loan discovery: routes to
- SubmitSafe client → Document workspace: routes to
- SubmitSafe client → Application journey: routes to
- SubmitSafe client → Schemes and agents: routes to
- SubmitSafe client → Operations portal: routes to
- SubmitSafe client → Copilot interface: hosts
- Loan discovery → API client: requests
- Document workspace → API client: requests
- Application journey → API client: requests
- Schemes and agents → API client: requests
- Operations portal → API client: requests
- Copilot interface → API client: requests
- API client → HTTP application: calls API
- HTTP application → API routes: mounts
- API routes → Authentication: dispatches
- API routes → Catalog workflows: dispatches
- API routes → Document workflows: dispatches
- API routes → Consent and applications: dispatches
- API routes → Copilot API: dispatches
- API routes → Admin and partner API: mounts
- API routes → Application store: provides
- Catalog workflows → Readiness and matching: matches products
- Document workflows → Document analysis: analyzes documents
- Consent and applications → Application store: persists records
- Document workflows → Application store: reads and writes
- Authentication → Application store: reads and writes
- Catalog workflows → Application store: reads catalog
- Admin and partner API → Application store: manages records
- Copilot API → Sarthi assistance: grounds assistance
- Copilot API → Provider selection: uses AI
- Document workflows → Provider selection: uses verification
- Consent and applications → Provider selection: uses lender
- Provider selection → External providers: selects live integrations
