# suresh-jangid/new_saf_foundation_backend architecture

> Architecture diagram of the GitHub repository suresh-jangid/new_saf_foundation_backend, 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/suresh-jangid/new_saf_foundation_backend
- Repository: https://github.com/suresh-jangid/new_saf_foundation_backend

## Overview

This is a TypeScript/Express backend for foundation operations: user and agent access, applicant and insurance records, programme benefits, E-PIN management, and financial transactions. The principal workflow is authenticated staff or customer requests through API endpoints into domain services, which read or update persistent records and return results. The tree also shows distinct benefit programmes, document handling, dashboards, and configuration. The README is empty, and source excerpts are partial; the graph therefore preserves documented-by-names capabilities but omits uncertain route wiring and integrations.

Main entry points: [`src/config/db.ts`](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/config/db.ts) (Prisma database), [`src/utils/legacy-payment-entry.ts`](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/utils/legacy-payment-entry.ts) (Legacy payment helper), [`src/modules/applications`](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/applications) (Applications), [`src/modules/schemes`](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/schemes) (Scheme benefits)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and access"]
  node_server["HTTP server<br/>[server.ts]"]
  node_app["Express application<br/>[app.ts]"]
  node_auth["Authentication"]
  node_agents["Agent management"]
  node_customer["Customer API"]
end

subgraph group_registry["People and applications"]
  node_applications["Applications"]
  node_documents["Documents"]
end

subgraph group_programmes["Benefits and schemes"]
  node_aawas["Aawas"]
  node_dhundhotsav["Dhundhotsav"]
  node_janni["Janni delivery"]
  node_lado["Lado Bahin"]
  node_mayra["Mayra"]
  node_shubh["Shubh Laxmi"]
  node_schemes["Scheme benefits"]
end

subgraph group_finance["Payments and inventory"]
  node_payments["Payments"]
  node_epins["E-PIN lifecycle"]
end

subgraph group_support["Operations"]
  node_configuration["Configuration / E-PIN"]
  node_dashboard["Dashboard"]
  node_db[("Prisma database<br/>[db.ts]")]
  node_compatibility["Compatibility API"]
  node_legacy["Legacy payment helper"]
end

node_staff(("Staff / agents"))
node_customers(("Customers"))

node_server -->|"starts"| node_app
node_staff -->|"signs in"| node_auth
node_staff -->|"manages agents"| node_agents
node_staff -->|"manages records"| node_applications
node_staff -->|"manages benefits"| node_schemes
node_staff -->|"records payments"| node_payments
node_staff -->|"manages PINs"| node_epins
node_customers -->|"uses customer API"| node_customer
node_customer -->|"reads and writes"| node_db
node_applications -->|"reads and writes"| node_db
node_applications -->|"records legacy payments"| node_legacy
node_schemes -->|"reads and writes"| node_db
node_schemes -->|"records legacy payments"| node_legacy
node_mayra -->|"reads and writes"| node_db
node_mayra -->|"records legacy payments"| node_legacy
node_compatibility -->|"reads and writes"| node_db
node_compatibility -->|"records legacy payments"| node_legacy
node_epins -->|"reads and writes"| node_db

click node_server "https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/server.ts"
click node_app "https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/app.ts"
click node_auth "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/auth"
click node_agents "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/agents"
click node_customer "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/customer"
click node_applications "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/applications"
click node_documents "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/documents"
click node_aawas "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/aawas"
click node_dhundhotsav "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/dhundhotsav"
click node_janni "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/janni-delivery"
click node_lado "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/lado-bahin"
click node_mayra "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/mayra"
click node_shubh "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/shubh-laxmi"
click node_schemes "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/schemes"
click node_payments "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/payments"
click node_epins "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/epins"
click node_configuration "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/configuration"
click node_dashboard "https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/dashboard"
click node_db "https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/config/db.ts"
click node_compatibility "https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/modules/compatibility/compatibility.routes.ts"
click node_legacy "https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/utils/legacy-payment-entry.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_server,node_app,node_auth,node_agents,node_customer toneBlue
class node_applications,node_documents toneAmber
class node_aawas,node_dhundhotsav,node_janni,node_lado,node_mayra,node_shubh,node_schemes toneMint
class node_payments,node_epins toneRose
class node_configuration,node_dashboard,node_db,node_compatibility,node_legacy,node_staff,node_customers toneIndigo
```

## Components

### API and access

- [HTTP server](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/server.ts): `src/server.ts`
- [Express application](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/app.ts): `src/app.ts`
- [Authentication](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/auth): `src/modules/auth`
- [Agent management](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/agents): `src/modules/agents`
- [Customer API](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/customer): `src/modules/customer`

### People and applications

- [Applications](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/applications): `src/modules/applications`
- [Documents](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/documents): `src/modules/documents`

### Benefits and schemes

- [Aawas](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/aawas): `src/modules/aawas`
- [Dhundhotsav](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/dhundhotsav): `src/modules/dhundhotsav`
- [Janni delivery](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/janni-delivery): `src/modules/janni-delivery`
- [Lado Bahin](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/lado-bahin): `src/modules/lado-bahin`
- [Mayra](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/mayra): `src/modules/mayra`
- [Shubh Laxmi](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/shubh-laxmi): `src/modules/shubh-laxmi`
- [Scheme benefits](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/schemes): `src/modules/schemes`

### Payments and inventory

- [Payments](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/payments): `src/modules/payments`
- [E-PIN lifecycle](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/epins): `src/modules/epins`

### Operations

- [Configuration / E-PIN](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/configuration): `src/modules/configuration`
- [Dashboard](https://github.com/suresh-jangid/new_saf_foundation_backend/tree/main/src/modules/dashboard): `src/modules/dashboard`
- [Prisma database](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/config/db.ts): `src/config/db.ts`
- [Compatibility API](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/modules/compatibility/compatibility.routes.ts): `src/modules/compatibility/compatibility.routes.ts`
- [Legacy payment helper](https://github.com/suresh-jangid/new_saf_foundation_backend/blob/main/src/utils/legacy-payment-entry.ts): `src/utils/legacy-payment-entry.ts`

### Other components

- **Staff / agents**
- **Customers**

## Connections

- HTTP server → Express application: starts
- Staff / agents → Authentication: signs in
- Staff / agents → Agent management: manages agents
- Staff / agents → Applications: manages records
- Staff / agents → Scheme benefits: manages benefits
- Staff / agents → Payments: records payments
- Staff / agents → E-PIN lifecycle: manages PINs
- Customers → Customer API: uses customer API
- Customer API → Prisma database: reads and writes
- Applications → Prisma database: reads and writes
- Applications → Legacy payment helper: records legacy payments
- Scheme benefits → Prisma database: reads and writes
- Scheme benefits → Legacy payment helper: records legacy payments
- Mayra → Prisma database: reads and writes
- Mayra → Legacy payment helper: records legacy payments
- Compatibility API → Prisma database: reads and writes
- Compatibility API → Legacy payment helper: records legacy payments
- E-PIN lifecycle → Prisma database: reads and writes
