# swetha-006/cipher-x architecture

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

- Interactive diagram: https://gitdiagram.com/swetha-006/cipher-x
- Repository: https://github.com/swetha-006/cipher-x

## Overview

CIPHER-X is a local digital-evidence investigation prototype. Investigators sign in, work within cases, upload evidence, and use the interface to inspect correlated evidence and investigation outputs. The documented evidence workflow spans secure ingestion, parsing and entity extraction, timeline and semantic analysis, graph correlation, conflict detection, authorized retrieval, and explainable responses. The backend excerpt confirms authentication, case access, evidence upload, database operations, and graph construction; the README documents broader capabilities whose implementation is not shown in the excerpts.

Main entry points: [`backend/app/main.py`](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py) (API service), [`frontend/src/main.jsx`](https://github.com/swetha-006/cipher-x/blob/main/frontend/src/main.jsx) (Investigation UI), [`backend/app`](https://github.com/swetha-006/cipher-x/tree/main/backend/app) (Semantic retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Investigator interface"]
  node_ui["Investigation UI<br/>[main.jsx]"]
end

subgraph group_api["Backend and access"]
  node_api_service["API service<br/>[main.py]"]
  node_auth["Authentication and RBAC<br/>[main.py]"]
  node_case_access["Case management<br/>[main.py]"]
  node_database[("Case database<br/>[main.py]")]
  node_audit["Audit logging<br/>[main.py]"]
end

subgraph group_evidence["Evidence processing"]
  node_ingestion["Secure ingestion<br/>[main.py]"]
  node_vault[("Encrypted evidence vault<br/>[main.py]")]
  node_parsing["Parsing and OCR"]
  node_entities["Entity extraction<br/>[main.py]"]
end

subgraph group_analysis["Investigation intelligence"]
  node_timeline["Timeline reconstruction"]
  node_semantic["Semantic retrieval"]
  node_graph["Knowledge graph<br/>[main.py]"]
  node_conflicts["Conflict detection"]
  node_rag["Explainable RAG"]
end

node_investigator(("Investigator"))
node_clamav["ClamAV scanner"]

node_investigator -->|"uses"| node_ui
node_ui -->|"calls"| node_api_service
node_api_service -->|"checks identity"| node_auth
node_api_service -->|"checks case access"| node_case_access
node_auth -->|"reads users"| node_database
node_case_access -->|"reads membership"| node_database
node_api_service -->|"handles upload"| node_ingestion
node_ingestion -->|"stores encrypted"| node_vault
node_ingestion -->|"extracts text"| node_parsing
node_parsing -->|"extracts entities"| node_entities
node_ingestion -.->|"optionally scans"| node_clamav
node_api_service -->|"reads and writes"| node_database
node_entities -->|"supports reconstruction"| node_timeline
node_entities -->|"indexes evidence"| node_semantic
node_timeline -->|"correlates evidence"| node_graph
node_semantic -->|"correlates evidence"| node_graph
node_graph -->|"supports detection"| node_conflicts
node_conflicts -->|"informs responses"| node_rag
node_semantic -->|"retrieves evidence"| node_rag
node_api_service -->|"builds graph"| node_graph
node_api_service -->|"records actions"| node_audit
node_ui -->|"searches evidence"| node_semantic
node_ui -->|"loads audit log"| node_audit

click node_ui "https://github.com/swetha-006/cipher-x/blob/main/frontend/src/main.jsx"
click node_api_service "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_auth "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_case_access "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_database "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_ingestion "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_vault "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_parsing "https://github.com/swetha-006/cipher-x/tree/main/backend/app"
click node_entities "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_timeline "https://github.com/swetha-006/cipher-x/tree/main/backend/app"
click node_semantic "https://github.com/swetha-006/cipher-x/tree/main/backend/app"
click node_graph "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"
click node_conflicts "https://github.com/swetha-006/cipher-x/tree/main/backend/app"
click node_rag "https://github.com/swetha-006/cipher-x/tree/main/backend/app"
click node_audit "https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py"

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_ui toneBlue
class node_api_service,node_auth,node_case_access,node_database,node_audit toneAmber
class node_ingestion,node_vault,node_parsing,node_entities toneMint
class node_timeline,node_semantic,node_graph,node_conflicts,node_rag toneRose
class node_investigator,node_clamav toneIndigo
```

## Components

### Investigator interface

- [Investigation UI](https://github.com/swetha-006/cipher-x/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### Backend and access

- [API service](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication and RBAC](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Case management](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Case database](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Audit logging](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`

### Evidence processing

- [Secure ingestion](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Encrypted evidence vault](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Parsing and OCR](https://github.com/swetha-006/cipher-x/tree/main/backend/app): `backend/app`
- [Entity extraction](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`

### Investigation intelligence

- [Timeline reconstruction](https://github.com/swetha-006/cipher-x/tree/main/backend/app): `backend/app`
- [Semantic retrieval](https://github.com/swetha-006/cipher-x/tree/main/backend/app): `backend/app`
- [Knowledge graph](https://github.com/swetha-006/cipher-x/blob/main/backend/app/main.py): `backend/app/main.py`
- [Conflict detection](https://github.com/swetha-006/cipher-x/tree/main/backend/app): `backend/app`
- [Explainable RAG](https://github.com/swetha-006/cipher-x/tree/main/backend/app): `backend/app`

### Other components

- **Investigator**
- **ClamAV scanner**

## Connections

- Investigator → Investigation UI: uses (evidence: `README.md`)
- Investigation UI → API service: calls (evidence: `frontend/src/main.jsx`)
- API service → Authentication and RBAC: checks identity (evidence: `backend/app/main.py`)
- API service → Case management: checks case access (evidence: `backend/app/main.py`)
- Authentication and RBAC → Case database: reads users (evidence: `backend/app/main.py`)
- Case management → Case database: reads membership (evidence: `backend/app/main.py`)
- API service → Secure ingestion: handles upload (evidence: `backend/app/main.py`)
- Secure ingestion → Encrypted evidence vault: stores encrypted (evidence: `backend/app/main.py`)
- Secure ingestion → Parsing and OCR: extracts text (evidence: `backend/app/main.py`)
- Parsing and OCR → Entity extraction: extracts entities (evidence: `README.md`)
- Secure ingestion → ClamAV scanner: optionally scans (evidence: `backend/app/main.py`)
- API service → Case database: reads and writes (evidence: `backend/app/main.py`)
- Entity extraction → Timeline reconstruction: supports reconstruction (evidence: `README.md`)
- Entity extraction → Semantic retrieval: indexes evidence (evidence: `README.md`)
- Timeline reconstruction → Knowledge graph: correlates evidence (evidence: `README.md`)
- Semantic retrieval → Knowledge graph: correlates evidence (evidence: `README.md`)
- Knowledge graph → Conflict detection: supports detection (evidence: `README.md`)
- Conflict detection → Explainable RAG: informs responses (evidence: `README.md`)
- Semantic retrieval → Explainable RAG: retrieves evidence (evidence: `README.md`)
- API service → Knowledge graph: builds graph (evidence: `backend/app/main.py`)
- API service → Audit logging: records actions (evidence: `backend/app/main.py`)
- Investigation UI → Semantic retrieval: searches evidence (evidence: `frontend/src/main.jsx`)
- Investigation UI → Audit logging: loads audit log (evidence: `frontend/src/main.jsx`)
