# soumashree-das/sakshyachain-team-criminallyonline architecture

> Architecture diagram of the GitHub repository soumashree-das/sakshyachain-team-criminallyonline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/soumashree-das/sakshyachain-team-criminallyonline
- Repository: https://github.com/soumashree-das/sakshyachain-team-criminallyonline

## Overview

SākshyaChain is a multi-tenant legal evidence vault. Users authenticate through role- and clearance-aware portals, work with cases and evidence, then access controlled document operations, audit and integrity views, and specialist tools. The backend stores encrypted evidence and records custody events; separate capabilities cover emergency access, signatures, sharing, knowledge graphs, and AI-assisted retrieval. The map reflects README capabilities and the sampled client routes and server excerpts; unsampled route wiring and some service internals are not inferred.

Main entry points: [`server/src/server.js`](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/server.js) (REST API), [`server/src/routes/documentRoutes.js`](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/documentRoutes.js) (Document operations), [`client/src/services/api.js`](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/services/api.js) (API client), [`client/src/App.jsx`](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/App.jsx) (Portal routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Portal experience"]
  node_app["Portal routes<br/>[App.jsx]"]
  node_casepages["Case workspace<br/>[CaseDetailPage.jsx]"]
  node_docpages["Document views"]
  node_uploadpage["Evidence upload<br/>[UploadPage.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
  node_server["REST API<br/>[server.js]"]
end

subgraph group_access["Identity and access"]
  node_login["Login and MFA<br/>[LoginPage.jsx]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_authservice["Auth service<br/>[authService.js]"]
  node_middleware["Token middleware<br/>[auth.js]"]
  node_accessroutes["Access requests"]
  node_accesspolicy["Document access policy"]
end

subgraph group_evidence["Evidence lifecycle"]
  node_documentroutes["Document operations<br/>[documentRoutes.js]"]
  node_storage["Encrypted file vault<br/>[storageService.js]"]
  node_crypto["Encryption and hashing<br/>[cryptoService.js]"]
  node_kms["Key management<br/>[KMSFactory.js]"]
  node_versions["Document versions<br/>[versionService.js]"]
  node_db[("Application records<br/>[dbService.js]")]
end

subgraph group_assurance["Integrity and oversight"]
  node_auditpages["Audit and integrity views<br/>[AuditTrailPage.jsx]"]
  node_auditroutes["Audit endpoints<br/>[auditRoutes.js]"]
  node_ledger[("Custody ledger<br/>[ledgerService.js]")]
  node_signature["Digital signatures"]
  node_emergency["Break-glass access"]
end

subgraph group_specialist["Specialist capabilities"]
  node_ragpage["Legal AI assistant"]
  node_ragengine["Permission-aware RAG<br/>[ragEngine.js]"]
  node_graph["Knowledge graph"]
  node_sharing["Evidence sharing<br/>[sharingService.js]"]
end

node_user(("Agency user"))

node_user -->|"opens portal"| node_app
node_app -->|"routes login"| node_login
node_app -->|"routes cases"| node_casepages
node_app -->|"routes documents"| node_docpages
node_app -->|"routes upload"| node_uploadpage
node_casepages -->|"requests data"| node_clientapi
node_docpages -->|"requests documents"| node_clientapi
node_uploadpage -->|"submits evidence"| node_clientapi
node_login -->|"submits credentials"| node_clientapi
node_clientapi -->|"calls REST API"| node_server
node_server -->|"dispatches auth"| node_authroutes
node_authroutes -->|"authenticates"| node_authservice
node_server -->|"dispatches documents"| node_documentroutes
node_documentroutes -->|"requires token"| node_middleware
node_authroutes -->|"uses token checks"| node_middleware
node_documentroutes -->|"checks permissions"| node_accesspolicy
node_accessroutes -->|"checks eligibility"| node_accesspolicy
node_documentroutes -->|"stores and reads files"| node_storage
node_storage -->|"encrypts and verifies"| node_crypto
node_storage -->|"requests key operations"| node_kms
node_documentroutes -->|"reads and writes records"| node_db
node_documentroutes -->|"manages revisions"| node_versions
node_documentroutes -->|"records evidence events"| node_ledger
node_auditpages -->|"requests audit data"| node_clientapi
node_server -->|"dispatches audit"| node_auditroutes
node_auditroutes -->|"verifies and appends"| node_ledger
node_auditroutes -->|"reads alerts"| node_db
node_auditroutes -->|"checks vault integrity"| node_storage
node_documentroutes -->|"handles signatures"| node_signature
node_server -->|"dispatches access requests"| node_accessroutes
node_server -->|"supports emergency access"| node_emergency
node_ragpage -.->|"queries evidence"| node_ragengine
node_ragengine -->|"filters document access"| node_accesspolicy
node_ragengine -->|"reads document records"| node_db
node_server -.->|"provides graph capability"| node_graph
node_server -.->|"provides sharing capability"| node_sharing

click node_app "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/App.jsx"
click node_casepages "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/CaseDetailPage.jsx"
click node_docpages "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/DocumentViewerPage.jsx"
click node_uploadpage "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/UploadPage.jsx"
click node_clientapi "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/services/api.js"
click node_server "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/server.js"
click node_login "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/LoginPage.jsx"
click node_authroutes "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/authRoutes.js"
click node_authservice "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/authService.js"
click node_middleware "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/middleware/auth.js"
click node_accessroutes "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/accessRequestRoutes.js"
click node_accesspolicy "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/documentAccessService.js"
click node_documentroutes "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/documentRoutes.js"
click node_storage "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/storageService.js"
click node_crypto "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/cryptoService.js"
click node_kms "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/kms/KMSFactory.js"
click node_versions "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/versionService.js"
click node_db "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/dbService.js"
click node_auditpages "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/AuditTrailPage.jsx"
click node_auditroutes "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/auditRoutes.js"
click node_ledger "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/ledgerService.js"
click node_signature "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/signatureService.js"
click node_emergency "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/breakGlassService.js"
click node_ragpage "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/RAGAssistantPage.jsx"
click node_ragengine "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/ragEngine.js"
click node_graph "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/knowledgeGraphService.js"
click node_sharing "https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/sharingService.js"

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_casepages,node_docpages,node_uploadpage,node_clientapi,node_server,node_user toneBlue
class node_login,node_authroutes,node_authservice,node_middleware,node_accessroutes,node_accesspolicy toneAmber
class node_documentroutes,node_storage,node_crypto,node_kms,node_versions,node_db toneMint
class node_auditpages,node_auditroutes,node_ledger,node_signature,node_emergency toneRose
class node_ragpage,node_ragengine,node_graph,node_sharing toneIndigo
```

## Components

### Portal experience

- [Portal routes](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Case workspace](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/CaseDetailPage.jsx): `client/src/pages/CaseDetailPage.jsx`
- [Document views](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/DocumentViewerPage.jsx): `client/src/pages/DocumentViewerPage.jsx`
- [Evidence upload](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/UploadPage.jsx): `client/src/pages/UploadPage.jsx`
- [API client](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [REST API](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/server.js): `server/src/server.js`

### Identity and access

- [Login and MFA](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/LoginPage.jsx): `client/src/pages/LoginPage.jsx`
- [Authentication routes](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/authRoutes.js): `server/src/routes/authRoutes.js`
- [Auth service](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/authService.js): `server/src/services/authService.js`
- [Token middleware](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Access requests](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/accessRequestRoutes.js): `server/src/routes/accessRequestRoutes.js`
- [Document access policy](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/documentAccessService.js): `server/src/services/documentAccessService.js`

### Evidence lifecycle

- [Document operations](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/documentRoutes.js): `server/src/routes/documentRoutes.js`
- [Encrypted file vault](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/storageService.js): `server/src/services/storageService.js`
- [Encryption and hashing](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/cryptoService.js): `server/src/services/cryptoService.js`
- [Key management](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/kms/KMSFactory.js): `server/src/kms/KMSFactory.js`
- [Document versions](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/versionService.js): `server/src/services/versionService.js`
- [Application records](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/dbService.js): `server/src/services/dbService.js`

### Integrity and oversight

- [Audit and integrity views](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/AuditTrailPage.jsx): `client/src/pages/AuditTrailPage.jsx`
- [Audit endpoints](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/routes/auditRoutes.js): `server/src/routes/auditRoutes.js`
- [Custody ledger](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/ledgerService.js): `server/src/services/ledgerService.js`
- [Digital signatures](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/signatureService.js): `server/src/services/signatureService.js`
- [Break-glass access](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/breakGlassService.js): `server/src/services/breakGlassService.js`

### Specialist capabilities

- [Legal AI assistant](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/client/src/pages/RAGAssistantPage.jsx): `client/src/pages/RAGAssistantPage.jsx`
- [Permission-aware RAG](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/ragEngine.js): `server/src/services/ragEngine.js`
- [Knowledge graph](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/knowledgeGraphService.js): `server/src/services/knowledgeGraphService.js`
- [Evidence sharing](https://github.com/soumashree-das/sakshyachain-team-criminallyonline/blob/main/server/src/services/sharingService.js): `server/src/services/sharingService.js`

### Other components

- **Agency user**

## Connections

- Agency user → Portal routes: opens portal
- Portal routes → Login and MFA: routes login
- Portal routes → Case workspace: routes cases
- Portal routes → Document views: routes documents
- Portal routes → Evidence upload: routes upload
- Case workspace → API client: requests data
- Document views → API client: requests documents
- Evidence upload → API client: submits evidence
- Login and MFA → API client: submits credentials
- API client → REST API: calls REST API
- REST API → Authentication routes: dispatches auth
- Authentication routes → Auth service: authenticates
- REST API → Document operations: dispatches documents
- Document operations → Token middleware: requires token
- Authentication routes → Token middleware: uses token checks
- Document operations → Document access policy: checks permissions
- Access requests → Document access policy: checks eligibility
- Document operations → Encrypted file vault: stores and reads files
- Encrypted file vault → Encryption and hashing: encrypts and verifies
- Encrypted file vault → Key management: requests key operations
- Document operations → Application records: reads and writes records
- Document operations → Document versions: manages revisions
- Document operations → Custody ledger: records evidence events
- Audit and integrity views → API client: requests audit data
- REST API → Audit endpoints: dispatches audit
- Audit endpoints → Custody ledger: verifies and appends
- Audit endpoints → Application records: reads alerts
- Audit endpoints → Encrypted file vault: checks vault integrity
- Document operations → Digital signatures: handles signatures
- REST API → Access requests: dispatches access requests
- REST API → Break-glass access: supports emergency access
- Legal AI assistant → Permission-aware RAG: queries evidence
- Permission-aware RAG → Document access policy: filters document access
- Permission-aware RAG → Application records: reads document records
- REST API → Knowledge graph: provides graph capability
- REST API → Evidence sharing: provides sharing capability
