# ashish-netam011/secure-case architecture

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

- Interactive diagram: https://gitdiagram.com/ashish-netam011/secure-case
- Repository: https://github.com/ashish-netam011/secure-case

## Overview

Secure Case is a digital evidence management prototype. Its main workflow is officer sign-in, evidence upload with a client-side SHA-256 fingerprint, server-side storage and integrity checks, then controlled review, optional AI analysis, and audit visibility. The graph also retains the documented role-based access, access requests, PII handling, and Ollama-assisted review capabilities. Backend route excerpts and frontend component excerpts establish the principal calls; some storage and review links are documented or implied but not fully visible in the sampled source.

Main entry points: [`Frontend/src/pages/Dashboard.jsx`](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/pages/Dashboard.jsx) (Case dashboard), [`Backend/src/index.js`](https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/index.js) (Express API), [`Frontend/src/services/api.js`](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/services/api.js) (API client), [`Frontend/src/App.jsx`](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/App.jsx) (Session shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and interface"]
  node_app["Session shell<br/>[App.jsx]"]
  node_login["PIN login<br/>[Login.jsx]"]
  node_dashboard["Case dashboard<br/>[Dashboard.jsx]"]
  node_permissions["Role permissions<br/>[permission.js]"]
end

subgraph group_evidence["Evidence handling"]
  node_ingestion["Evidence intake"]
  node_crypto["SHA-256 fingerprint<br/>[crypto.js]"]
  node_storage_ui["Evidence storage"]
  node_vault["Evidence vault<br/>[EvidenceVault.jsx]"]
end

subgraph group_review["Review and analysis"]
  node_viewer["Evidence viewer<br/>[EvidenceViewer.jsx]"]
  node_pii_ui["PII redaction<br/>[PIIRedaction.jsx]"]
  node_pii["PII utilities<br/>[pii.js]"]
  node_audit_ui["Audit log<br/>[AuditLog.jsx]"]
end

subgraph group_backend["API and persistence"]
  node_api_client["API client<br/>[api.js]"]
  node_api["Express API<br/>[index.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_evidence_model[("Evidence records<br/>[Evidence.js]")]
  node_access_model[("Access requests<br/>[AccessRequest.js]")]
  node_audit_model[("Audit events<br/>[AuditEvent.js]")]
  node_ai["AI review service<br/>[aiService.js]"]
end

node_officer(("Case staff"))
node_mongo[("MongoDB")]
node_ollama["Ollama"]
node_gemini["Gemini"]

node_officer -->|"opens"| node_app
node_app -->|"shows signed out"| node_login
node_app -->|"shows signed in"| node_dashboard
node_login -->|"submits PIN"| node_api_client
node_dashboard -->|"checks roles"| node_permissions
node_dashboard -->|"renders intake"| node_ingestion
node_dashboard -->|"renders storage"| node_storage_ui
node_dashboard -->|"renders vault"| node_vault
node_dashboard -->|"renders redaction"| node_pii_ui
node_dashboard -->|"renders audit"| node_audit_ui
node_ingestion -->|"hashes file"| node_crypto
node_ingestion -->|"uploads file"| node_api_client
node_storage_ui -->|"loads and requests"| node_api_client
node_storage_ui -->|"opens evidence"| node_viewer
node_vault -->|"verifies file"| node_crypto
node_viewer -->|"requests analysis"| node_api_client
node_viewer -->|"redacts text"| node_pii
node_pii_ui -->|"uses utilities"| node_pii
node_api_client -.->|"sends API calls"| node_api
node_api -->|"authenticates and authorizes"| node_auth
node_api -->|"reads and updates"| node_evidence_model
node_api -.->|"reviews requests"| node_access_model
node_api -->|"reads audit events"| node_audit_model
node_api -->|"analyzes evidence"| node_ai
node_api -.->|"persists records"| node_mongo
node_ai -.->|"calls provider"| node_ollama
node_ai -.->|"calls provider"| node_gemini

click node_app "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/App.jsx"
click node_login "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/pages/Login.jsx"
click node_dashboard "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/pages/Dashboard.jsx"
click node_permissions "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/utils/permission.js"
click node_ingestion "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceIngestion.jsx"
click node_crypto "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/utils/crypto.js"
click node_storage_ui "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceStorage.jsx"
click node_vault "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceVault.jsx"
click node_viewer "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceViewer.jsx"
click node_pii_ui "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/PIIRedaction.jsx"
click node_pii "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/utils/pii.js"
click node_audit_ui "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/AuditLog.jsx"
click node_api_client "https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/services/api.js"
click node_api "https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/index.js"
click node_auth "https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/middleware/auth.js"
click node_evidence_model "https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/models/Evidence.js"
click node_access_model "https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/models/AccessRequest.js"
click node_audit_model "https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/models/AuditEvent.js"
click node_ai "https://github.com/ashish-netam011/secure-case/blob/main/Backend/services/aiService.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_login,node_dashboard,node_permissions toneBlue
class node_ingestion,node_crypto,node_storage_ui,node_vault,node_mongo toneAmber
class node_viewer,node_pii_ui,node_pii,node_audit_ui toneMint
class node_api_client,node_api,node_auth,node_evidence_model,node_access_model,node_audit_model,node_ai toneRose
class node_officer,node_ollama,node_gemini toneIndigo
```

## Components

### Access and interface

- [Session shell](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [PIN login](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/pages/Login.jsx): `Frontend/src/pages/Login.jsx`
- [Case dashboard](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/pages/Dashboard.jsx): `Frontend/src/pages/Dashboard.jsx`
- [Role permissions](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/utils/permission.js): `Frontend/src/utils/permission.js`

### Evidence handling

- [Evidence intake](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceIngestion.jsx): `Frontend/src/components/EvidenceIngestion.jsx`
- [SHA-256 fingerprint](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/utils/crypto.js): `Frontend/src/utils/crypto.js`
- [Evidence storage](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceStorage.jsx): `Frontend/src/components/EvidenceStorage.jsx`
- [Evidence vault](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceVault.jsx): `Frontend/src/components/EvidenceVault.jsx`

### Review and analysis

- [Evidence viewer](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/EvidenceViewer.jsx): `Frontend/src/components/EvidenceViewer.jsx`
- [PII redaction](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/PIIRedaction.jsx): `Frontend/src/components/PIIRedaction.jsx`
- [PII utilities](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/utils/pii.js): `Frontend/src/utils/pii.js`
- [Audit log](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/components/AuditLog.jsx): `Frontend/src/components/AuditLog.jsx`

### API and persistence

- [API client](https://github.com/ashish-netam011/secure-case/blob/main/Frontend/src/services/api.js): `Frontend/src/services/api.js`
- [Express API](https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/index.js): `Backend/src/index.js`
- [Authentication](https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/middleware/auth.js): `Backend/src/middleware/auth.js`
- [Evidence records](https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/models/Evidence.js): `Backend/src/models/Evidence.js`
- [Access requests](https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/models/AccessRequest.js): `Backend/src/models/AccessRequest.js`
- [Audit events](https://github.com/ashish-netam011/secure-case/blob/main/Backend/src/models/AuditEvent.js): `Backend/src/models/AuditEvent.js`
- [AI review service](https://github.com/ashish-netam011/secure-case/blob/main/Backend/services/aiService.js): `Backend/services/aiService.js`

### Other components

- **Case staff**
- **MongoDB**
- **Ollama**
- **Gemini**

## Connections

- Case staff → Session shell: opens (evidence: `Frontend/src/App.jsx`)
- Session shell → PIN login: shows signed out (evidence: `Frontend/src/App.jsx`)
- Session shell → Case dashboard: shows signed in (evidence: `Frontend/src/App.jsx`)
- PIN login → API client: submits PIN (evidence: `Frontend/src/pages/Login.jsx`)
- Case dashboard → Role permissions: checks roles (evidence: `Frontend/src/pages/Dashboard.jsx`)
- Case dashboard → Evidence intake: renders intake (evidence: `Frontend/src/pages/Dashboard.jsx`)
- Case dashboard → Evidence storage: renders storage (evidence: `Frontend/src/pages/Dashboard.jsx`)
- Case dashboard → Evidence vault: renders vault (evidence: `Frontend/src/pages/Dashboard.jsx`)
- Case dashboard → PII redaction: renders redaction (evidence: `Frontend/src/pages/Dashboard.jsx`)
- Case dashboard → Audit log: renders audit (evidence: `Frontend/src/pages/Dashboard.jsx`)
- Evidence intake → SHA-256 fingerprint: hashes file (evidence: `Frontend/src/components/EvidenceIngestion.jsx`)
- Evidence intake → API client: uploads file (evidence: `Frontend/src/components/EvidenceIngestion.jsx`)
- Evidence storage → API client: loads and requests (evidence: `Frontend/src/components/EvidenceStorage.jsx`)
- Evidence storage → Evidence viewer: opens evidence (evidence: `Frontend/src/components/EvidenceStorage.jsx`)
- Evidence vault → SHA-256 fingerprint: verifies file (evidence: `Frontend/src/components/EvidenceVault.jsx`)
- Evidence viewer → API client: requests analysis (evidence: `Frontend/src/components/EvidenceViewer.jsx`)
- Evidence viewer → PII utilities: redacts text (evidence: `Frontend/src/components/EvidenceViewer.jsx`)
- PII redaction → PII utilities: uses utilities (evidence: `Frontend/src/components/PIIRedaction.jsx`)
- API client → Express API: sends API calls (evidence: `Frontend/src/services/api.js`)
- Express API → Authentication: authenticates and authorizes (evidence: `Backend/src/index.js`)
- Express API → Evidence records: reads and updates (evidence: `Backend/src/index.js`)
- Express API → Access requests: reviews requests (evidence: `Backend/src/index.js`)
- Express API → Audit events: reads audit events (evidence: `Backend/src/index.js`)
- Express API → AI review service: analyzes evidence (evidence: `Backend/src/index.js`)
- Express API → MongoDB: persists records
- AI review service → Ollama: calls provider
- AI review service → Gemini: calls provider
