How akshatjoshi-afk/nyayachain works
NyayaChain is a legal-investigation case and evidence management prototype. Users authenticate, browse only cases they are authorized to access, and manage case documents; uploads are checked for duplicates or tampering, hash-chained, and may be enriched with OCR and AI-derived intelligence. Investigators can search and explore document text, entity relationships, timelines, and cited RAG answers; administrators manage access and audit ledger integrity. The graph includes documented integrations whose implementation was not sampled; those edges cite the README, and uncertain service wiring is omitted or marked optional.
Main entry points: cases.service.ts Case access · DocumentsPage.tsx Evidence workspace · documents.service.ts Document handling · prisma.service.ts Application database
Components 23
Web application
- Route shell
frontend/src/App.tsx - Tab session
frontend/src/context/AuthContext.tsx - Login screen
frontend/src/pages/LoginPage.tsx - Case workspace
frontend/src/pages/CasesPage.tsx - Evidence workspace
frontend/src/pages/DocumentsPage.tsx - Document text
frontend/src/components/DocumentTextPanel.tsx - Relationship graph
frontend/src/components/CaseGraphView.tsx - Event timeline
frontend/src/components/CaseTimelineView.tsx - Case Q&A
frontend/src/components/AskAiPanel.tsx
Backend API
- Authentication
backend/src/auth/auth.service.ts - Case access
backend/src/cases/cases.service.ts - Document handling
backend/src/documents/documents.service.ts - Audit verification
backend/src/audit/audit.service.ts - Statutory certificates
backend/src/certificate/certificate.service.ts - Application database
backend/src/prisma/prisma.service.ts
Document intelligence
- OCR extraction
ocr-service/main.py - AI service API
ai-service/main.py - Case document retrieval
ai-service/rag_engine.py - LLM processing
ai-service/llm.py
Evidence integrity
- Case hash chain
backend/src/documents/documents.service.ts - Root anchoring
backend/src/blockchain/blockchain.service.ts
Other components
- Investigator / admin
- Local blockchain
Connections 33
- Investigator / admin → Route shell: uses
frontend/src/App.tsx - Route shell → Login screen: routes to
frontend/src/App.tsx - Route shell → Case workspace: routes to
frontend/src/App.tsx - Route shell → Evidence workspace: routes to
frontend/src/App.tsx - Route shell → Tab session: checks session
frontend/src/App.tsx - Login screen → Tab session: sets session
frontend/src/pages/LoginPage.tsx - Tab session → Authentication: authenticates
- Case workspace → Case access: loads cases
- Evidence workspace → Case access: checks case access
frontend/src/pages/DocumentsPage.tsx - Evidence workspace → Document handling: uploads and searches
- Evidence workspace → Document text: renders text
frontend/src/pages/DocumentsPage.tsx - Evidence workspace → Relationship graph: renders graph
frontend/src/pages/DocumentsPage.tsx - Evidence workspace → Event timeline: renders timeline
frontend/src/pages/DocumentsPage.tsx - Evidence workspace → Case Q&A: renders Q&A
frontend/src/pages/DocumentsPage.tsx - Authentication → Application database: reads and writes
backend/src/auth/auth.service.ts - Case access → Application database: checks assignments
backend/src/cases/cases.service.ts - Case access → Application database: loads entities
backend/src/cases/cases.service.ts - Document handling → Application database: stores evidence
backend/src/documents/documents.service.ts - Document handling → Case access: validates access
backend/src/documents/documents.service.ts - Document handling → OCR extraction: requests extraction
- OCR extraction → Document handling: returns extracted text
- Document handling → Case hash chain: chains document hashes
backend/src/documents/documents.service.ts - Document handling → Root anchoring: anchors root
backend/src/documents/documents.service.ts - Root anchoring → Local blockchain: records root
- Audit verification → Application database: verifies ledger
backend/src/audit/audit.service.ts - Statutory certificates → Application database: reads evidence
backend/src/certificate/certificate.service.ts - Statutory certificates → Case access: checks case access
backend/src/certificate/certificate.service.ts - AI service API → Case document retrieval: queries documents
ai-service/main.py - Case document retrieval → AI service API: returns passages
ai-service/main.py - AI service API → LLM processing: processes questions
ai-service/main.py - Case Q&A → AI service API: asks case questions
- Relationship graph → Case access: loads case graph
- Event timeline → Case access: loads event timeline