# vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens architecture

> Architecture diagram of the GitHub repository vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens
- Repository: https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens

## Overview

Nyaya Lens is a legal-literacy assistant for Indian citizens. The main journey is to enter or upload a document, request analysis, and review clause risks, plain-language explanations, statute citations, and remedies. The interface also exposes distinct supporting capabilities—authentication, scam warnings, fair-clause comparisons, consequence simulation, dispute timelines, checklists, and governance audits. The excerpts show the frontend’s analysis request and backend’s legal-engine dependency; some backend routes and AI-service behavior are unsampled, so those connections are omitted or marked unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/App.tsx) (Workspace), [`backend/server.js`](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/backend/server.js) (API gateway), [`frontend/src/components/LandingPage.tsx`](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/LandingPage.tsx) (Landing page), [`frontend/src/components/DocumentPane.tsx`](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/DocumentPane.tsx) (Document input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Citizen experience"]
  node_app["Workspace<br/>[App.tsx]"]
  node_document["Document input<br/>[DocumentPane.tsx]"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
  node_navbar["Workspace navigation<br/>[Navbar.tsx]"]
  node_linewaves["Animated backdrop<br/>[LineWaves.tsx]"]
  node_splitflap["Split-flap display<br/>[SplitFlapText.tsx]"]
end

subgraph group_analysis["Legal analysis"]
  node_risk["Risk review"]
  node_legalengine["Clause evaluator<br/>[legalEngine.js]"]
  node_knowledge["Statutes and templates"]
end

subgraph group_services["Backend services"]
  node_gateway["API gateway<br/>[server.js]"]
  node_apiconfig["API configuration<br/>[api.ts]"]
  node_auth["Authentication dialog<br/>[AuthModal.tsx]"]
  node_mongo[("MongoDB")]
  node_ai["AI service<br/>[main.py]"]
end

subgraph group_guidance["Additional guidance"]
  node_scam["Scam alert"]
  node_checklist["Action checklist"]
  node_simulator["Consequence simulator"]
  node_fair["Fair clause comparison"]
  node_timeline["Dispute timeline"]
  node_audit["Governance audit"]
end

node_citizen(("Citizen"))

node_citizen -->|"uses"| node_app
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_document
node_app -->|"renders"| node_risk
node_app -->|"renders"| node_scam
node_app -->|"renders"| node_checklist
node_app -->|"renders"| node_simulator
node_app -->|"renders"| node_fair
node_app -->|"renders"| node_timeline
node_app -->|"renders"| node_audit
node_landing -->|"renders"| node_linewaves
node_landing -->|"renders"| node_splitflap
node_app -->|"requests analysis"| node_gateway
node_document -->|"requests extraction"| node_gateway
node_auth -->|"submits credentials"| node_gateway
node_app -->|"opens"| node_auth
node_gateway -->|"dispatches analysis"| node_legalengine
node_legalengine -->|"loads knowledge"| node_knowledge
node_gateway -->|"syncs users"| node_mongo
node_gateway -->|"queries service"| node_ai
node_risk -.->|"shows results"| node_app

click node_app "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/App.tsx"
click node_document "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/DocumentPane.tsx"
click node_landing "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/LandingPage.tsx"
click node_navbar "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/Navbar.tsx"
click node_linewaves "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/LineWaves.tsx"
click node_splitflap "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/SplitFlapText.tsx"
click node_risk "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/RiskAnalysisPane.tsx"
click node_legalengine "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/backend/legalEngine.js"
click node_gateway "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/backend/server.js"
click node_apiconfig "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/config/api.ts"
click node_auth "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/AuthModal.tsx"
click node_knowledge "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/tree/main/backend/data"
click node_ai "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/ai-service/main.py"
click node_scam "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/ScamAlertBanner.tsx"
click node_checklist "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/ActionableChecklistDrawer.tsx"
click node_simulator "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/ConsequenceSimulatorModal.tsx"
click node_fair "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/FairClauseModal.tsx"
click node_timeline "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/DisputeTimelineModal.tsx"
click node_audit "https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/WatsonGovernanceAuditModal.tsx"

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_app,node_document,node_landing,node_navbar,node_linewaves,node_splitflap toneBlue
class node_risk,node_legalengine,node_knowledge toneAmber
class node_gateway,node_apiconfig,node_auth,node_mongo,node_ai toneMint
class node_scam,node_checklist,node_simulator,node_fair,node_timeline,node_audit toneRose
class node_citizen toneIndigo
```

## Components

### Citizen experience

- [Workspace](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Document input](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/DocumentPane.tsx): `frontend/src/components/DocumentPane.tsx`
- [Landing page](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/LandingPage.tsx): `frontend/src/components/LandingPage.tsx`
- [Workspace navigation](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/Navbar.tsx): `frontend/src/components/Navbar.tsx`
- [Animated backdrop](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/LineWaves.tsx): `frontend/src/components/LineWaves.tsx`
- [Split-flap display](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/SplitFlapText.tsx): `frontend/src/components/SplitFlapText.tsx`

### Legal analysis

- [Risk review](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/RiskAnalysisPane.tsx): `frontend/src/components/RiskAnalysisPane.tsx`
- [Clause evaluator](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/backend/legalEngine.js): `backend/legalEngine.js`
- [Statutes and templates](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/tree/main/backend/data): `backend/data`

### Backend services

- [API gateway](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/backend/server.js): `backend/server.js`
- [API configuration](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/config/api.ts): `frontend/src/config/api.ts`
- [Authentication dialog](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/AuthModal.tsx): `frontend/src/components/AuthModal.tsx`
- **MongoDB**
- [AI service](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/ai-service/main.py): `ai-service/main.py`

### Additional guidance

- [Scam alert](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/ScamAlertBanner.tsx): `frontend/src/components/ScamAlertBanner.tsx`
- [Action checklist](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/ActionableChecklistDrawer.tsx): `frontend/src/components/ActionableChecklistDrawer.tsx`
- [Consequence simulator](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/ConsequenceSimulatorModal.tsx): `frontend/src/components/ConsequenceSimulatorModal.tsx`
- [Fair clause comparison](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/FairClauseModal.tsx): `frontend/src/components/FairClauseModal.tsx`
- [Dispute timeline](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/DisputeTimelineModal.tsx): `frontend/src/components/DisputeTimelineModal.tsx`
- [Governance audit](https://github.com/vinayak2006tech/nyaya-lens-ai-legal-literacy-assistant-for-indian-citizens/blob/main/frontend/src/components/WatsonGovernanceAuditModal.tsx): `frontend/src/components/WatsonGovernanceAuditModal.tsx`

### Other components

- **Citizen**

## Connections

- Citizen → Workspace: uses
- Workspace → Landing page: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Workspace navigation: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Document input: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Risk review: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Scam alert: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Action checklist: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Consequence simulator: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Fair clause comparison: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Dispute timeline: renders (evidence: `frontend/src/App.tsx`)
- Workspace → Governance audit: renders (evidence: `frontend/src/App.tsx`)
- Landing page → Animated backdrop: renders (evidence: `frontend/src/components/LandingPage.tsx`)
- Landing page → Split-flap display: renders (evidence: `frontend/src/components/LandingPage.tsx`)
- Workspace → API gateway: requests analysis (evidence: `frontend/src/App.tsx`)
- Document input → API gateway: requests extraction (evidence: `frontend/src/components/DocumentPane.tsx`)
- Authentication dialog → API gateway: submits credentials (evidence: `frontend/src/components/AuthModal.tsx`)
- Workspace → Authentication dialog: opens (evidence: `frontend/src/App.tsx`)
- API gateway → Clause evaluator: dispatches analysis (evidence: `backend/server.js`)
- Clause evaluator → Statutes and templates: loads knowledge (evidence: `backend/legalEngine.js`)
- API gateway → MongoDB: syncs users (evidence: `backend/server.js`)
- API gateway → AI service: queries service (evidence: `backend/server.js`)
- Risk review → Workspace: shows results (evidence: `frontend/src/App.tsx`)
