# abhinavtie2008/rinavi architecture

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

- Interactive diagram: https://gitdiagram.com/abhinavtie2008/rinavi
- Repository: https://github.com/abhinavtie2008/rinavi

## Overview

RINAVI is a privacy-first citizen companion for preparing and managing government-service applications; it organizes and exports assistance packets but does not submit them. The main workflow is sign-in and purpose-scoped consent, upload and extract document evidence, review/promote values into a profile, prepare and preflight a catalog-based draft, then export or freeze it in the locker for journey tracking and re-application. The graph includes documented capabilities whose implementation was not sampled; their links are omitted where evidence is unavailable.

Main entry points: [`apps/web/src/lib/api.ts`](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/lib/api.ts) (API client), [`backend/app/api/router.py`](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/api/router.py) (API router), [`backend/app/modules/audit/service.py`](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/audit/service.py) (Redacted audit trail), [`backend/app/modules/applications/service.py`](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/applications/service.py) (Draft lifecycle and export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Citizen web app"]
  node_web["Web experience"]
  node_webapi["API client<br/>[api.ts]"]
  node_signin["Sign-in and passkeys<br/>[SignInArea.tsx]"]
  node_consentui["Consent controls<br/>[ConsentPage.tsx]"]
end

subgraph group_identity["Identity and consent"]
  node_identityapi["Identity routes<br/>[routes.py]"]
  node_consentapi["Consent routes<br/>[routes.py]"]
  node_consent["Consent policy<br/>[service.py]"]
  node_deps["Session and consent checks<br/>[deps.py]"]
end

subgraph group_evidence["Documents and profile"]
  node_vaultui["Document vault<br/>[VaultPage.tsx]"]
  node_vaultroutes["Vault endpoints<br/>[routes.py]"]
  node_vaultservice["Vault lifecycle<br/>[service.py]"]
  node_storage["File storage<br/>[storage.py]"]
  node_pipeline["Document processing<br/>[pipeline.py]"]
  node_profileui["Profile review<br/>[ProfilePage.tsx]"]
  node_profileroutes["Profile endpoints<br/>[routes.py]"]
  node_profileservice["Profile values<br/>[service.py]"]
end

subgraph group_prepare["Application preparation"]
  node_catalogui["Service catalog<br/>[ServicesPage.tsx]"]
  node_catalog["Catalog definitions<br/>[loader.py]"]
  node_applicationsui["Draft preparation<br/>[DraftDetail.tsx]"]
  node_applications["Draft lifecycle and export<br/>[service.py]"]
  node_applicationroutes["Draft endpoints<br/>[routes.py]"]
  node_lockerui["Application locker<br/>[CaseDetail.tsx]"]
  node_locker["Case tracking and reapply<br/>[service.py]"]
  node_lockerroutes["Locker endpoints<br/>[routes.py]"]
end

subgraph group_platform["Platform services"]
  node_audit["Redacted audit trail<br/>[service.py]"]
  node_database[("Application database<br/>[db.py]")]
  node_api["API router<br/>[router.py]"]
  node_main["Backend application<br/>[main.py]"]
end

node_citizen(("Citizen"))

node_citizen -->|"uses"| node_web
node_web -.->|"requests API"| node_webapi
node_signin -.->|"requests API"| node_webapi
node_consentui -.->|"requests API"| node_webapi
node_vaultui -.->|"requests API"| node_webapi
node_profileui -.->|"requests API"| node_webapi
node_catalogui -.->|"requests API"| node_webapi
node_applicationsui -.->|"requests API"| node_webapi
node_lockerui -.->|"requests API"| node_webapi
node_webapi -.->|"calls"| node_api
node_main -->|"mounts routes"| node_api
node_api -->|"registers"| node_identityapi
node_api -->|"registers"| node_consentapi
node_api -->|"registers"| node_vaultroutes
node_api -->|"registers"| node_profileroutes
node_api -->|"registers"| node_applicationroutes
node_api -->|"registers"| node_lockerroutes
node_identityapi -->|"uses session checks"| node_deps
node_deps -->|"checks consent"| node_consent
node_consentapi -->|"calls"| node_consent
node_identityapi -->|"records events"| node_audit
node_consentapi -->|"records events"| node_audit
node_catalogui -.->|"retrieves services"| node_catalog
node_applicationroutes -->|"calls"| node_applications
node_applications -->|"loads definitions"| node_catalog
node_applicationroutes -->|"creates case"| node_locker
node_lockerroutes -->|"calls"| node_locker
node_locker -->|"rebuilds draft"| node_applications
node_applicationroutes -->|"records events"| node_audit
node_lockerroutes -->|"records events"| node_audit
node_vaultroutes -->|"calls"| node_vaultservice
node_vaultroutes -->|"processes document"| node_pipeline
node_vaultservice -->|"reads and deletes"| node_storage
node_pipeline -->|"reads bytes"| node_storage
node_pipeline -->|"writes extracted fields"| node_database
node_vaultroutes -->|"marks sources stale"| node_profileservice
node_vaultroutes -->|"records events"| node_audit
node_profileroutes -->|"calls"| node_profileservice
node_profileroutes -->|"gets source document"| node_vaultservice
node_profileroutes -->|"records events"| node_audit
node_applications -.->|"reads confirmed values"| node_profileservice
node_applications -->|"checks linked documents"| node_vaultservice
node_audit -->|"stores events"| node_database
node_vaultservice -.->|"stores metadata"| node_database
node_applications -.->|"stores drafts"| node_database
node_locker -.->|"stores cases"| node_database

click node_web "https://github.com/abhinavtie2008/rinavi/tree/main/apps/web/src/features"
click node_webapi "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/lib/api.ts"
click node_signin "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/auth/SignInArea.tsx"
click node_consentui "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/consent/ConsentPage.tsx"
click node_identityapi "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/identity/routes.py"
click node_consentapi "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/consent/routes.py"
click node_consent "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/consent/service.py"
click node_deps "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/api/deps.py"
click node_catalogui "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/catalog/ServicesPage.tsx"
click node_catalog "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/catalog/loader.py"
click node_applicationsui "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/applications/DraftDetail.tsx"
click node_applications "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/applications/service.py"
click node_applicationroutes "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/applications/routes.py"
click node_lockerui "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/locker/CaseDetail.tsx"
click node_locker "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/locker/service.py"
click node_lockerroutes "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/locker/routes.py"
click node_vaultui "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/vault/VaultPage.tsx"
click node_vaultroutes "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/vault/routes.py"
click node_vaultservice "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/vault/service.py"
click node_storage "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/vault/storage.py"
click node_pipeline "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/documents/pipeline.py"
click node_profileui "https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/profile/ProfilePage.tsx"
click node_profileroutes "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/profile/routes.py"
click node_profileservice "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/profile/service.py"
click node_audit "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/audit/service.py"
click node_database "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/core/db.py"
click node_api "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/api/router.py"
click node_main "https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/main.py"

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_web,node_webapi,node_signin,node_consentui toneBlue
class node_identityapi,node_consentapi,node_consent,node_deps toneAmber
class node_vaultui,node_vaultroutes,node_vaultservice,node_storage,node_pipeline,node_profileui,node_profileroutes,node_profileservice toneMint
class node_catalogui,node_catalog,node_applicationsui,node_applications,node_applicationroutes,node_lockerui,node_locker,node_lockerroutes toneRose
class node_audit,node_database,node_api,node_main,node_citizen toneIndigo
```

## Components

### Citizen web app

- [Web experience](https://github.com/abhinavtie2008/rinavi/tree/main/apps/web/src/features): `apps/web/src/features`
- [API client](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/lib/api.ts): `apps/web/src/lib/api.ts`
- [Sign-in and passkeys](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/auth/SignInArea.tsx): `apps/web/src/features/auth/SignInArea.tsx`
- [Consent controls](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/consent/ConsentPage.tsx): `apps/web/src/features/consent/ConsentPage.tsx`

### Identity and consent

- [Identity routes](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/identity/routes.py): `backend/app/modules/identity/routes.py`
- [Consent routes](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/consent/routes.py): `backend/app/modules/consent/routes.py`
- [Consent policy](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/consent/service.py): `backend/app/modules/consent/service.py`
- [Session and consent checks](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`

### Documents and profile

- [Document vault](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/vault/VaultPage.tsx): `apps/web/src/features/vault/VaultPage.tsx`
- [Vault endpoints](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/vault/routes.py): `backend/app/modules/vault/routes.py`
- [Vault lifecycle](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/vault/service.py): `backend/app/modules/vault/service.py`
- [File storage](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/vault/storage.py): `backend/app/modules/vault/storage.py`
- [Document processing](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/documents/pipeline.py): `backend/app/modules/documents/pipeline.py`
- [Profile review](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/profile/ProfilePage.tsx): `apps/web/src/features/profile/ProfilePage.tsx`
- [Profile endpoints](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/profile/routes.py): `backend/app/modules/profile/routes.py`
- [Profile values](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/profile/service.py): `backend/app/modules/profile/service.py`

### Application preparation

- [Service catalog](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/catalog/ServicesPage.tsx): `apps/web/src/features/catalog/ServicesPage.tsx`
- [Catalog definitions](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/catalog/loader.py): `backend/app/modules/catalog/loader.py`
- [Draft preparation](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/applications/DraftDetail.tsx): `apps/web/src/features/applications/DraftDetail.tsx`
- [Draft lifecycle and export](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/applications/service.py): `backend/app/modules/applications/service.py`
- [Draft endpoints](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/applications/routes.py): `backend/app/modules/applications/routes.py`
- [Application locker](https://github.com/abhinavtie2008/rinavi/blob/main/apps/web/src/features/locker/CaseDetail.tsx): `apps/web/src/features/locker/CaseDetail.tsx`
- [Case tracking and reapply](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/locker/service.py): `backend/app/modules/locker/service.py`
- [Locker endpoints](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/locker/routes.py): `backend/app/modules/locker/routes.py`

### Platform services

- [Redacted audit trail](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/modules/audit/service.py): `backend/app/modules/audit/service.py`
- [Application database](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [API router](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Backend application](https://github.com/abhinavtie2008/rinavi/blob/main/backend/app/main.py): `backend/app/main.py`

### Other components

- **Citizen**

## Connections

- Citizen → Web experience: uses
- Web experience → API client: requests API
- Sign-in and passkeys → API client: requests API
- Consent controls → API client: requests API
- Document vault → API client: requests API
- Profile review → API client: requests API
- Service catalog → API client: requests API
- Draft preparation → API client: requests API
- Application locker → API client: requests API
- API client → API router: calls
- Backend application → API router: mounts routes (evidence: `backend/app/main.py`)
- API router → Identity routes: registers (evidence: `backend/app/api/router.py`)
- API router → Consent routes: registers (evidence: `backend/app/api/router.py`)
- API router → Vault endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Profile endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Draft endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Locker endpoints: registers (evidence: `backend/app/api/router.py`)
- Identity routes → Session and consent checks: uses session checks (evidence: `backend/app/modules/identity/routes.py`)
- Session and consent checks → Consent policy: checks consent (evidence: `backend/app/api/deps.py`)
- Consent routes → Consent policy: calls (evidence: `backend/app/modules/consent/routes.py`)
- Identity routes → Redacted audit trail: records events (evidence: `backend/app/modules/identity/routes.py`)
- Consent routes → Redacted audit trail: records events (evidence: `backend/app/modules/consent/routes.py`)
- Service catalog → Catalog definitions: retrieves services
- Draft endpoints → Draft lifecycle and export: calls (evidence: `backend/app/modules/applications/routes.py`)
- Draft lifecycle and export → Catalog definitions: loads definitions (evidence: `backend/app/modules/applications/service.py`)
- Draft endpoints → Case tracking and reapply: creates case (evidence: `backend/app/modules/applications/routes.py`)
- Locker endpoints → Case tracking and reapply: calls (evidence: `backend/app/modules/locker/routes.py`)
- Case tracking and reapply → Draft lifecycle and export: rebuilds draft (evidence: `backend/app/modules/locker/service.py`)
- Draft endpoints → Redacted audit trail: records events (evidence: `backend/app/modules/applications/routes.py`)
- Locker endpoints → Redacted audit trail: records events (evidence: `backend/app/modules/locker/routes.py`)
- Vault endpoints → Vault lifecycle: calls (evidence: `backend/app/modules/vault/routes.py`)
- Vault endpoints → Document processing: processes document (evidence: `backend/app/modules/vault/routes.py`)
- Vault lifecycle → File storage: reads and deletes (evidence: `backend/app/modules/vault/service.py`)
- Document processing → File storage: reads bytes (evidence: `backend/app/modules/documents/pipeline.py`)
- Document processing → Application database: writes extracted fields (evidence: `backend/app/modules/documents/pipeline.py`)
- Vault endpoints → Profile values: marks sources stale (evidence: `backend/app/modules/vault/routes.py`)
- Vault endpoints → Redacted audit trail: records events (evidence: `backend/app/modules/vault/routes.py`)
- Profile endpoints → Profile values: calls (evidence: `backend/app/modules/profile/routes.py`)
- Profile endpoints → Vault lifecycle: gets source document (evidence: `backend/app/modules/profile/routes.py`)
- Profile endpoints → Redacted audit trail: records events (evidence: `backend/app/modules/profile/routes.py`)
- Draft lifecycle and export → Profile values: reads confirmed values
- Draft lifecycle and export → Vault lifecycle: checks linked documents (evidence: `backend/app/modules/applications/service.py`)
- Redacted audit trail → Application database: stores events (evidence: `backend/app/modules/audit/service.py`)
- Vault lifecycle → Application database: stores metadata
- Draft lifecycle and export → Application database: stores drafts
- Case tracking and reapply → Application database: stores cases
