# rahataid/rahat-platform architecture

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

- Interactive diagram: https://gitdiagram.com/rahataid/rahat-platform
- Repository: https://github.com/rahataid/rahat-platform

## Overview

Rahat is a modular platform backend for managing projects, beneficiaries, and related services, with shared SDK and wallet libraries plus blockchain indexing/contracts. A typical workflow enters through the Rahat API, reaches project orchestration, and invokes project actions; beneficiary operations are handled by a separate message-driven service. The tree and index show major capabilities such as grievances, communications, notifications, OTP, off-ramping, vendors, queues, and wallet management, but their internal links are not all sampled. Arrows below use shown calls or indexed references; unsampled subsystem links are omitted.

Main entry points: [`apps/beneficiary/src/beneficiary/beneficiary.controller.ts`](https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiary.controller.ts) (Beneficiary Handlers), [`apps/rahat/src/beneficiary/beneficiary.controller.ts`](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/beneficiary.controller.ts) (Beneficiary API), [`apps/rahat/src/projects/project.controller.ts`](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/projects/project.controller.ts) (Project API), [`apps/rahat/src/projects/project.service.ts`](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/projects/project.service.ts) (Project Orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Platform Core"]
  node_project_api["Project API"]
  node_project_service["Project Orchestration<br/>[project.service.ts]"]
  node_project_actions["Project Actions"]
  node_app_api["App API<br/>[app.controller.ts]"]
  node_app_service["App Settings<br/>[app.service.ts]"]
end

subgraph group_beneficiary["Beneficiary Management"]
  node_beneficiary_api["Beneficiary API"]
  node_beneficiary_parser["Import Parser<br/>[index.ts]"]
  node_beneficiary_service["Beneficiary Service"]
  node_beneficiary_worker["Beneficiary Handlers"]
  node_beneficiary_stats["Beneficiary Statistics"]
  node_verification["Verification"]
end

subgraph group_integrations["Platform Integrations"]
  node_wallet_interceptor["Wallet Interceptor"]
  node_wallet_service["Wallet Management<br/>[wallet.service.ts]"]
  node_grievance["Grievances"]
  node_vendors["Vendors<br/>[vendors.service.ts]"]
  node_communications["Communications<br/>[comms.service.ts]"]
  node_notifications["Notifications"]
  node_otp["OTP Claims"]
  node_offramp["Off-ramp"]
  node_queues["Queue Services<br/>[queue.service.ts]"]
  node_graph_index["Graph Indexers"]
  node_contracts["Token Contracts<br/>[contracts.ts]"]
end

subgraph group_shared["Shared Libraries"]
  node_wallet_lib["Wallet Library"]
  node_sdk_clients["API SDK Clients"]
  node_stats_lib["Statistics Library"]
  node_subgraph["Subgraph Queries"]
end

node_operator(("Project Operator"))

node_operator -->|"submits requests"| node_project_api
node_project_api -->|"delegates"| node_project_service
node_project_service -->|"dispatches actions"| node_project_actions
node_operator -.->|"manages beneficiaries"| node_beneficiary_api
node_beneficiary_api -->|"parses imports"| node_beneficiary_parser
node_beneficiary_api -->|"sends commands"| node_beneficiary_worker
node_beneficiary_worker -->|"delegates operations"| node_beneficiary_service
node_beneficiary_worker -->|"requests statistics"| node_beneficiary_stats
node_beneficiary_worker -->|"requests links"| node_verification
node_app_api -->|"delegates"| node_app_service
node_wallet_interceptor -->|"uses wallet service"| node_wallet_service
node_wallet_service -.->|"uses wallet library"| node_wallet_lib
node_sdk_clients -->|"calls app endpoints"| node_app_api
node_grievance -.->|"supports case handling"| node_operator
node_vendors -.->|"supports vendor workflows"| node_operator
node_communications -.->|"supports messaging"| node_operator

click node_project_api "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/projects/project.controller.ts"
click node_project_service "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/projects/project.service.ts"
click node_project_actions "https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/projects/actions"
click node_app_api "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/app/app.controller.ts"
click node_app_service "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/app/app.service.ts"
click node_beneficiary_api "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/beneficiary.controller.ts"
click node_beneficiary_parser "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/parser/index.ts"
click node_beneficiary_service "https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiary.service.ts"
click node_beneficiary_worker "https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiary.controller.ts"
click node_beneficiary_stats "https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiaryStat.service.ts"
click node_verification "https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/verification.service.ts"
click node_wallet_interceptor "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/interceptor/wallet.interceptor.ts"
click node_wallet_service "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/wallet/wallet.service.ts"
click node_wallet_lib "https://github.com/rahataid/rahat-platform/tree/main/libs/wallet/src"
click node_grievance "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/grievance/grievance.service.ts"
click node_vendors "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/vendors/vendors.service.ts"
click node_communications "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/comms/comms.service.ts"
click node_notifications "https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/notification"
click node_otp "https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/otp"
click node_offramp "https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/offramp"
click node_queues "https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/queue/queue.service.ts"
click node_sdk_clients "https://github.com/rahataid/rahat-platform/tree/main/libs/sdk/src/clients"
click node_stats_lib "https://github.com/rahataid/rahat-platform/tree/main/libs/stats/src"
click node_subgraph "https://github.com/rahataid/rahat-platform/tree/main/libs/subgraph/src/lib"
click node_graph_index "https://github.com/rahataid/rahat-platform/tree/main/apps/graph/src"
click node_contracts "https://github.com/rahataid/rahat-platform/blob/main/libs/contracts/src/lib/contracts.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_project_api,node_project_service,node_project_actions,node_app_api,node_app_service toneBlue
class node_beneficiary_api,node_beneficiary_parser,node_beneficiary_service,node_beneficiary_worker,node_beneficiary_stats,node_verification toneAmber
class node_wallet_interceptor,node_wallet_service,node_grievance,node_vendors,node_communications,node_notifications,node_otp,node_offramp,node_queues,node_graph_index,node_contracts toneMint
class node_wallet_lib,node_sdk_clients,node_stats_lib,node_subgraph toneRose
class node_operator toneIndigo
```

## Components

### Platform Core

- [Project API](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/projects/project.controller.ts): `apps/rahat/src/projects/project.controller.ts`
- [Project Orchestration](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/projects/project.service.ts): `apps/rahat/src/projects/project.service.ts`
- [Project Actions](https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/projects/actions): `apps/rahat/src/projects/actions`
- [App API](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/app/app.controller.ts): `apps/rahat/src/app/app.controller.ts`
- [App Settings](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/app/app.service.ts): `apps/rahat/src/app/app.service.ts`

### Beneficiary Management

- [Beneficiary API](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/beneficiary.controller.ts): `apps/rahat/src/beneficiary/beneficiary.controller.ts`
- [Import Parser](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/parser/index.ts): `apps/rahat/src/beneficiary/parser/index.ts`
- [Beneficiary Service](https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiary.service.ts): `apps/beneficiary/src/beneficiary/beneficiary.service.ts`
- [Beneficiary Handlers](https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiary.controller.ts): `apps/beneficiary/src/beneficiary/beneficiary.controller.ts`
- [Beneficiary Statistics](https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/beneficiaryStat.service.ts): `apps/beneficiary/src/beneficiary/beneficiaryStat.service.ts`
- [Verification](https://github.com/rahataid/rahat-platform/blob/main/apps/beneficiary/src/beneficiary/verification.service.ts): `apps/beneficiary/src/beneficiary/verification.service.ts`

### Platform Integrations

- [Wallet Interceptor](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/beneficiary/interceptor/wallet.interceptor.ts): `apps/rahat/src/beneficiary/interceptor/wallet.interceptor.ts`
- [Wallet Management](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/wallet/wallet.service.ts): `apps/rahat/src/wallet/wallet.service.ts`
- [Grievances](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/grievance/grievance.service.ts): `apps/rahat/src/grievance/grievance.service.ts`
- [Vendors](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/vendors/vendors.service.ts): `apps/rahat/src/vendors/vendors.service.ts`
- [Communications](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/comms/comms.service.ts): `apps/rahat/src/comms/comms.service.ts`
- [Notifications](https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/notification): `apps/rahat/src/notification`
- [OTP Claims](https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/otp): `apps/rahat/src/otp`
- [Off-ramp](https://github.com/rahataid/rahat-platform/tree/main/apps/rahat/src/offramp): `apps/rahat/src/offramp`
- [Queue Services](https://github.com/rahataid/rahat-platform/blob/main/apps/rahat/src/queue/queue.service.ts): `apps/rahat/src/queue/queue.service.ts`
- [Graph Indexers](https://github.com/rahataid/rahat-platform/tree/main/apps/graph/src): `apps/graph/src`
- [Token Contracts](https://github.com/rahataid/rahat-platform/blob/main/libs/contracts/src/lib/contracts.ts): `libs/contracts/src/lib/contracts.ts`

### Shared Libraries

- [Wallet Library](https://github.com/rahataid/rahat-platform/tree/main/libs/wallet/src): `libs/wallet/src`
- [API SDK Clients](https://github.com/rahataid/rahat-platform/tree/main/libs/sdk/src/clients): `libs/sdk/src/clients`
- [Statistics Library](https://github.com/rahataid/rahat-platform/tree/main/libs/stats/src): `libs/stats/src`
- [Subgraph Queries](https://github.com/rahataid/rahat-platform/tree/main/libs/subgraph/src/lib): `libs/subgraph/src/lib`

### Other components

- **Project Operator**

## Connections

- Project Operator → Project API: submits requests (evidence: `README.md`)
- Project API → Project Orchestration: delegates (evidence: `apps/rahat/src/projects/project.controller.ts`)
- Project Orchestration → Project Actions: dispatches actions (evidence: `apps/rahat/src/projects/project.service.ts`)
- Project Operator → Beneficiary API: manages beneficiaries
- Beneficiary API → Import Parser: parses imports (evidence: `apps/rahat/src/beneficiary/beneficiary.controller.ts`)
- Beneficiary API → Beneficiary Handlers: sends commands (evidence: `apps/rahat/src/beneficiary/beneficiary.controller.ts`)
- Beneficiary Handlers → Beneficiary Service: delegates operations (evidence: `apps/beneficiary/src/beneficiary/beneficiary.controller.ts`)
- Beneficiary Handlers → Beneficiary Statistics: requests statistics (evidence: `apps/beneficiary/src/beneficiary/beneficiary.controller.ts`)
- Beneficiary Handlers → Verification: requests links (evidence: `apps/beneficiary/src/beneficiary/beneficiary.controller.ts`)
- App API → App Settings: delegates (evidence: `apps/rahat/src/app/app.controller.ts`)
- Wallet Interceptor → Wallet Management: uses wallet service (evidence: `apps/rahat/src/beneficiary/interceptor/wallet.interceptor.ts`)
- Wallet Management → Wallet Library: uses wallet library
- API SDK Clients → App API: calls app endpoints (evidence: `libs/sdk/src/clients/app.client.ts`)
- Grievances → Project Operator: supports case handling
- Vendors → Project Operator: supports vendor workflows
- Communications → Project Operator: supports messaging
