# potlasrisharan/codebenders-project architecture

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

- Interactive diagram: https://gitdiagram.com/potlasrisharan/codebenders-project
- Repository: https://github.com/potlasrisharan/codebenders-project

## Overview

LabhSaathi is a local-first guidance app for navigating sample government benefit schemes, not an application or approval system. The main journey is profile intake, scheme matching, reviewing a scheme and its requirements, then tracking a claim; detail views also offer what-if simulations and sharing. Internally, a profile context, privacy shield, validated scheme repository, deterministic eligibility engine, and discovery service support these journeys. The tree and excerpts show a worker API surface, but not its clients or all routing behavior, so those links are limited.

Main entry points: [`src/core/data/repository.ts`](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/repository.ts) (Scheme repository), [`src/routes/Routes.tsx`](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/Routes.tsx) (App routes), [`src/routes/SchemeDetailPage.tsx`](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/SchemeDetailPage.tsx) (Scheme detail), [`worker/index.ts`](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/index.ts) (Worker dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_journey["Guidance journey"]
  node_routes["App routes<br/>[Routes.tsx]"]
  node_intake["Profile intake<br/>[IntakePage.tsx]"]
  node_matches["Scheme matches<br/>[MatchesPage.tsx]"]
  node_detail["Scheme detail"]
  node_checklist["Application checklist<br/>[ChecklistPage.tsx]"]
  node_tracker["Claim tracker<br/>[TrackerPage.tsx]"]
  node_admin["Scheme review"]
  node_actiongraph["Action graph"]
  node_share["WhatsApp sharing"]
end

subgraph group_domain["Eligibility services"]
  node_profile["Profile state<br/>[ProfileContext.tsx]"]
  node_profilemodel["Citizen profile<br/>[citizen-profile.ts]"]
  node_discovery["Scheme discovery"]
  node_eligibility["Eligibility engine"]
  node_simulator["What-if radar<br/>[what-if-service.ts]"]
  node_claim["Claim records<br/>[claim-tracker.ts]"]
end

subgraph group_data["Scheme data"]
  node_repo[("Scheme repository<br/>[repository.ts]")]
  node_schemes["Scheme catalog<br/>[schemes-dataset.ts]"]
  node_coverage["Coverage registry"]
  node_schema["Domain schemas<br/>[schema.ts]"]
end

subgraph group_privacy["Privacy boundary"]
  node_shield["Sensitive ID shield"]
  node_notice["Privacy notice"]
end

subgraph group_worker["Worker API"]
  node_worker["Worker dispatcher<br/>[index.ts]"]
  node_middleware["Shield middleware"]
  node_wintake["Intake endpoint<br/>[intake.ts]"]
  node_weligibility["Eligibility endpoint<br/>[eligibility.ts]"]
  node_wschemes["Schemes endpoint<br/>[schemes.ts]"]
  node_wsimulator["Simulator endpoint<br/>[simulator.ts]"]
end

node_citizen(("Citizen"))

node_citizen -->|"opens"| node_routes
node_routes -->|"routes to"| node_intake
node_routes -->|"routes to"| node_matches
node_routes -->|"routes to"| node_detail
node_routes -->|"routes to"| node_checklist
node_routes -->|"routes to"| node_tracker
node_routes -->|"routes to"| node_admin
node_routes -->|"provides context"| node_profile
node_intake -->|"updates"| node_profile
node_intake -->|"uses profile model"| node_profilemodel
node_intake -->|"checks identifiers"| node_shield
node_intake -->|"renders notice"| node_notice
node_matches -->|"reads profile"| node_profile
node_matches -->|"requests matches"| node_discovery
node_matches -->|"reads claims"| node_claim
node_detail -->|"reads profile"| node_profile
node_detail -->|"loads scheme"| node_repo
node_detail -->|"checks eligibility"| node_eligibility
node_detail -->|"reads claim state"| node_claim
node_detail -->|"runs simulation"| node_simulator
node_detail -->|"renders graph"| node_actiongraph
node_detail -->|"opens sharing"| node_share
node_checklist -->|"updates checklist"| node_claim
node_checklist -->|"loads scheme"| node_repo
node_checklist -->|"opens sharing"| node_share
node_tracker -->|"reads tracking"| node_claim
node_tracker -->|"loads scheme"| node_repo
node_tracker -->|"checks changes"| node_simulator
node_admin -->|"reviews schemes"| node_repo
node_admin -->|"reviews coverage"| node_coverage
node_profile -->|"stores profile"| node_profilemodel
node_profilemodel -->|"inspects text"| node_shield
node_discovery -->|"gets candidates"| node_repo
node_discovery -->|"evaluates candidates"| node_eligibility
node_repo -->|"loads catalog"| node_schemes
node_repo -->|"reads coverage"| node_coverage
node_repo -->|"validates records"| node_schema
node_simulator -->|"reevaluates profile"| node_eligibility
node_worker -->|"registers"| node_middleware
node_worker -->|"dispatches"| node_wintake
node_worker -->|"dispatches"| node_weligibility
node_worker -->|"dispatches"| node_wschemes
node_worker -->|"dispatches"| node_wsimulator
node_middleware -->|"uses inspection"| node_shield
node_wintake -->|"uses profile logic"| node_profilemodel
node_wintake -->|"checks identifiers"| node_shield
node_weligibility -->|"loads schemes"| node_repo
node_weligibility -->|"evaluates rules"| node_eligibility

click node_routes "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/Routes.tsx"
click node_intake "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/IntakePage.tsx"
click node_matches "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/MatchesPage.tsx"
click node_detail "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/SchemeDetailPage.tsx"
click node_checklist "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/ChecklistPage.tsx"
click node_tracker "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/TrackerPage.tsx"
click node_admin "https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/AdminReviewPage.tsx"
click node_profile "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/profile/ProfileContext.tsx"
click node_profilemodel "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/profile/citizen-profile.ts"
click node_discovery "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/discovery/discovery-service.ts"
click node_eligibility "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/engine/eligibility-engine.ts"
click node_simulator "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/simulator/what-if-service.ts"
click node_claim "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/tracker/claim-tracker.ts"
click node_actiongraph "https://github.com/potlasrisharan/codebenders-project/blob/main/src/components/graph/UnifiedActionGraph.tsx"
click node_share "https://github.com/potlasrisharan/codebenders-project/blob/main/src/components/share/WhatsAppShareModal.tsx"
click node_repo "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/repository.ts"
click node_schemes "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/schemes-dataset.ts"
click node_coverage "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/coverage-registry.ts"
click node_schema "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/schema.ts"
click node_shield "https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/privacy/sensitive-id-shield.ts"
click node_notice "https://github.com/potlasrisharan/codebenders-project/blob/main/src/components/privacy/SensitiveIdShieldNotice.tsx"
click node_worker "https://github.com/potlasrisharan/codebenders-project/blob/main/worker/index.ts"
click node_middleware "https://github.com/potlasrisharan/codebenders-project/blob/main/worker/middleware/sensitive-shield.ts"
click node_wintake "https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/intake.ts"
click node_weligibility "https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/eligibility.ts"
click node_wschemes "https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/schemes.ts"
click node_wsimulator "https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/simulator.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_routes,node_intake,node_matches,node_detail,node_checklist,node_tracker,node_admin,node_actiongraph,node_share toneBlue
class node_profile,node_profilemodel,node_discovery,node_eligibility,node_simulator,node_claim toneAmber
class node_repo,node_schemes,node_coverage,node_schema toneMint
class node_shield,node_notice toneRose
class node_worker,node_middleware,node_wintake,node_weligibility,node_wschemes,node_wsimulator,node_citizen toneIndigo
```

## Components

### Guidance journey

- [App routes](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/Routes.tsx): `src/routes/Routes.tsx`
- [Profile intake](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/IntakePage.tsx): `src/routes/IntakePage.tsx`
- [Scheme matches](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/MatchesPage.tsx): `src/routes/MatchesPage.tsx`
- [Scheme detail](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/SchemeDetailPage.tsx): `src/routes/SchemeDetailPage.tsx`
- [Application checklist](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/ChecklistPage.tsx): `src/routes/ChecklistPage.tsx`
- [Claim tracker](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/TrackerPage.tsx): `src/routes/TrackerPage.tsx`
- [Scheme review](https://github.com/potlasrisharan/codebenders-project/blob/main/src/routes/AdminReviewPage.tsx): `src/routes/AdminReviewPage.tsx`
- [Action graph](https://github.com/potlasrisharan/codebenders-project/blob/main/src/components/graph/UnifiedActionGraph.tsx): `src/components/graph/UnifiedActionGraph.tsx`
- [WhatsApp sharing](https://github.com/potlasrisharan/codebenders-project/blob/main/src/components/share/WhatsAppShareModal.tsx): `src/components/share/WhatsAppShareModal.tsx`

### Eligibility services

- [Profile state](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/profile/ProfileContext.tsx): `src/core/profile/ProfileContext.tsx`
- [Citizen profile](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/profile/citizen-profile.ts): `src/core/profile/citizen-profile.ts`
- [Scheme discovery](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/discovery/discovery-service.ts): `src/core/discovery/discovery-service.ts`
- [Eligibility engine](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/engine/eligibility-engine.ts): `src/core/engine/eligibility-engine.ts`
- [What-if radar](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/simulator/what-if-service.ts): `src/core/simulator/what-if-service.ts`
- [Claim records](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/tracker/claim-tracker.ts): `src/core/tracker/claim-tracker.ts`

### Scheme data

- [Scheme repository](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/repository.ts): `src/core/data/repository.ts`
- [Scheme catalog](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/schemes-dataset.ts): `src/core/data/schemes-dataset.ts`
- [Coverage registry](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/coverage-registry.ts): `src/core/data/coverage-registry.ts`
- [Domain schemas](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/data/schema.ts): `src/core/data/schema.ts`

### Privacy boundary

- [Sensitive ID shield](https://github.com/potlasrisharan/codebenders-project/blob/main/src/core/privacy/sensitive-id-shield.ts): `src/core/privacy/sensitive-id-shield.ts`
- [Privacy notice](https://github.com/potlasrisharan/codebenders-project/blob/main/src/components/privacy/SensitiveIdShieldNotice.tsx): `src/components/privacy/SensitiveIdShieldNotice.tsx`

### Worker API

- [Worker dispatcher](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/index.ts): `worker/index.ts`
- [Shield middleware](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/middleware/sensitive-shield.ts): `worker/middleware/sensitive-shield.ts`
- [Intake endpoint](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/intake.ts): `worker/routes/intake.ts`
- [Eligibility endpoint](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/eligibility.ts): `worker/routes/eligibility.ts`
- [Schemes endpoint](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/schemes.ts): `worker/routes/schemes.ts`
- [Simulator endpoint](https://github.com/potlasrisharan/codebenders-project/blob/main/worker/routes/simulator.ts): `worker/routes/simulator.ts`

### Other components

- **Citizen**

## Connections

- Citizen → App routes: opens (evidence: `src/routes/Routes.tsx`)
- App routes → Profile intake: routes to (evidence: `src/routes/Routes.tsx`)
- App routes → Scheme matches: routes to (evidence: `src/routes/Routes.tsx`)
- App routes → Scheme detail: routes to (evidence: `src/routes/Routes.tsx`)
- App routes → Application checklist: routes to (evidence: `src/routes/Routes.tsx`)
- App routes → Claim tracker: routes to (evidence: `src/routes/Routes.tsx`)
- App routes → Scheme review: routes to (evidence: `src/routes/Routes.tsx`)
- App routes → Profile state: provides context (evidence: `src/routes/Routes.tsx`)
- Profile intake → Profile state: updates (evidence: `src/routes/IntakePage.tsx`)
- Profile intake → Citizen profile: uses profile model (evidence: `src/routes/IntakePage.tsx`)
- Profile intake → Sensitive ID shield: checks identifiers (evidence: `src/routes/IntakePage.tsx`)
- Profile intake → Privacy notice: renders notice (evidence: `src/routes/IntakePage.tsx`)
- Scheme matches → Profile state: reads profile (evidence: `src/routes/MatchesPage.tsx`)
- Scheme matches → Scheme discovery: requests matches (evidence: `src/routes/MatchesPage.tsx`)
- Scheme matches → Claim records: reads claims (evidence: `src/routes/MatchesPage.tsx`)
- Scheme detail → Profile state: reads profile (evidence: `src/routes/SchemeDetailPage.tsx`)
- Scheme detail → Scheme repository: loads scheme (evidence: `src/routes/SchemeDetailPage.tsx`)
- Scheme detail → Eligibility engine: checks eligibility (evidence: `src/routes/SchemeDetailPage.tsx`)
- Scheme detail → Claim records: reads claim state (evidence: `src/routes/SchemeDetailPage.tsx`)
- Scheme detail → What-if radar: runs simulation (evidence: `src/routes/SchemeDetailPage.tsx`)
- Scheme detail → Action graph: renders graph (evidence: `src/routes/SchemeDetailPage.tsx`)
- Scheme detail → WhatsApp sharing: opens sharing (evidence: `src/routes/SchemeDetailPage.tsx`)
- Application checklist → Claim records: updates checklist (evidence: `src/routes/ChecklistPage.tsx`)
- Application checklist → Scheme repository: loads scheme (evidence: `src/routes/ChecklistPage.tsx`)
- Application checklist → WhatsApp sharing: opens sharing (evidence: `src/routes/ChecklistPage.tsx`)
- Claim tracker → Claim records: reads tracking (evidence: `src/routes/TrackerPage.tsx`)
- Claim tracker → Scheme repository: loads scheme (evidence: `src/routes/TrackerPage.tsx`)
- Claim tracker → What-if radar: checks changes (evidence: `src/routes/TrackerPage.tsx`)
- Scheme review → Scheme repository: reviews schemes (evidence: `src/routes/AdminReviewPage.tsx`)
- Scheme review → Coverage registry: reviews coverage (evidence: `src/routes/AdminReviewPage.tsx`)
- Profile state → Citizen profile: stores profile (evidence: `src/core/profile/ProfileContext.tsx`)
- Citizen profile → Sensitive ID shield: inspects text (evidence: `src/core/profile/citizen-profile.ts`)
- Scheme discovery → Scheme repository: gets candidates (evidence: `src/core/discovery/discovery-service.ts`)
- Scheme discovery → Eligibility engine: evaluates candidates (evidence: `src/core/discovery/discovery-service.ts`)
- Scheme repository → Scheme catalog: loads catalog (evidence: `src/core/data/repository.ts`)
- Scheme repository → Coverage registry: reads coverage (evidence: `src/core/data/repository.ts`)
- Scheme repository → Domain schemas: validates records (evidence: `src/core/data/repository.ts`)
- What-if radar → Eligibility engine: reevaluates profile (evidence: `src/core/simulator/what-if-service.ts`)
- Worker dispatcher → Shield middleware: registers (evidence: `worker/index.ts`)
- Worker dispatcher → Intake endpoint: dispatches (evidence: `worker/index.ts`)
- Worker dispatcher → Eligibility endpoint: dispatches (evidence: `worker/index.ts`)
- Worker dispatcher → Schemes endpoint: dispatches (evidence: `worker/index.ts`)
- Worker dispatcher → Simulator endpoint: dispatches (evidence: `worker/index.ts`)
- Shield middleware → Sensitive ID shield: uses inspection (evidence: `worker/middleware/sensitive-shield.ts`)
- Intake endpoint → Citizen profile: uses profile logic (evidence: `worker/routes/intake.ts`)
- Intake endpoint → Sensitive ID shield: checks identifiers (evidence: `worker/routes/intake.ts`)
- Eligibility endpoint → Scheme repository: loads schemes (evidence: `worker/routes/eligibility.ts`)
- Eligibility endpoint → Eligibility engine: evaluates rules (evidence: `worker/routes/eligibility.ts`)
