How khushiidalal/janmitra works
JanMitra is a law-enforcement case and evidence management portal. Personnel register and authenticate, create and track cases, attach documents for OCR-assisted review, and inspect audit and security activity. The graph follows documented UI/API and API/data boundaries, with sampled route evidence for key flows. Several feature routes and OCR internals were not sampled, so their detailed call relationships are omitted; README-documented capabilities are retained at subsystem level.
Main entry points: auth Authentication API · cases Case endpoints · documents Document endpoints · db.ts DB connector
Components 32
Officer portal
- Portal pages
src/app/(dashboard) - Registration flow
src/app/register - Login and 2FA
src/app/2fa-login - Dashboard
src/app/(dashboard)/dashboard/page.tsx - Security alerts
src/components/dashboard/SecurityAlertsCard.tsx
Identity and access
- Authentication API
src/app/api/auth - Auth and RBAC
src/lib/server/auth.ts - User and sessions
src/models/User.ts - OTP verification
src/app/api/otp - Email delivery
src/lib/server/mailer.ts
Case and evidence
- Case workflow
src/app/(dashboard)/cases - Case endpoints
src/app/api/cases - Case identifiers
src/lib/server/caseId.ts - Case records
src/models/Case.ts - Document vault
src/app/(dashboard)/documents/page.tsx - Document endpoints
src/app/api/documents - OCR endpoints
src/app/api/documents/[id]/ocr/route.ts - OCR processing
src/lib/server/ocr.ts - Document records
src/models/Document.ts - File storage and hashes
src/lib/server/storage.ts - Draft autosave
src/app/api/draft/route.ts - Draft records
src/models/Draft.ts
Audit and monitoring
- Audit trail
src/app/(dashboard)/audit-trail/page.tsx - Audit endpoints
src/app/api/audit/route.ts - Security events
src/lib/server/security.ts - Audit records
src/models/Audit.ts
Data and services
- API client
src/lib/api.ts - MongoDB
- DB connector
src/lib/db.ts
Other components
- Personnel
- Email and SMS providers
- OCR engines
Connections 33
- Personnel → Portal pages: uses
- Personnel → Registration flow: registers through
- Personnel → Login and 2FA: signs in through
- Portal pages → API client: requests data
- Registration flow → Authentication API: submits registration
- Login and 2FA → Authentication API: submits credentials
- Security alerts → API client: polls alerts
src/components/dashboard/SecurityAlertsCard.tsx - Authentication API → Auth and RBAC: uses auth helpers
src/app/api/auth/login/route.ts - Authentication API → User and sessions: reads and updates
src/app/api/auth/login/route.ts - Authentication API → Security events: records login events
src/app/api/auth/login/route.ts - Authentication API → Email delivery: sends verification
src/app/api/auth/login/route.ts - OTP verification → Email delivery: sends email OTP
src/app/api/otp/send/route.ts - OTP verification → Email and SMS providers: delivers OTP
- Case workflow → Case endpoints: manages cases
- Case endpoints → Auth and RBAC: authenticates user
src/app/api/cases/route.ts - Case endpoints → Case identifiers: generates identifiers
src/app/api/cases/route.ts - Case endpoints → Case records: queries and creates
src/app/api/cases/route.ts - Document vault → Document endpoints: uploads and retrieves
- Document endpoints → File storage and hashes: stores uploaded files
src/app/api/documents/route.ts - Document endpoints → Document records: creates document records
src/app/api/documents/route.ts - Document endpoints → Case records: finds parent case
src/app/api/documents/route.ts - OCR endpoints → OCR processing: processes documents
- OCR endpoints → OCR engines: extracts text
- Audit trail → Audit endpoints: filters audit records
- Audit endpoints → Auth and RBAC: authenticates user
src/app/api/audit/route.ts - Audit endpoints → Audit records: queries records
src/app/api/audit/route.ts - Security events → Audit records: writes security events
src/lib/server/security.ts - Draft autosave → Draft records: reads and writes drafts
src/app/api/draft/route.ts - Authentication API → DB connector: connects database
src/app/api/auth/login/route.ts - Case endpoints → DB connector: connects database
src/app/api/cases/route.ts - Document endpoints → DB connector: connects database
src/app/api/documents/route.ts - Audit endpoints → DB connector: connects database
src/app/api/audit/route.ts - DB connector → MongoDB: connects to
src/lib/db.ts