# shlok926/lattix-q architecture

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

- Interactive diagram: https://gitdiagram.com/shlok926/lattix-q
- Repository: https://github.com/shlok926/lattix-q

## Overview

Lattix-Q is an enterprise post-quantum migration and risk-assessment platform. Users enter through an authenticated dashboard to inspect cryptographic assets, scan code, explore classical/PQC algorithms, simulate quantum attacks, and review migration or compliance outputs. The API gateway exposes service routes; separate services implement cryptography, attacks, benchmarking, reports, scanning, and threat analysis. The analyst flow additionally manages conversational sessions and builds context-aware prompts. Service internals and several UI pages are unsampled, so their detailed calls are not inferred; README-documented service integrations are shown as dashed.

Main entry points: [`frontend/src/App.tsx`](https://github.com/shlok926/lattix-q/blob/main/frontend/src/App.tsx) (Dashboard and labs), [`services/api-gateway/app/api/router.py`](https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/api/router.py) (Versioned API routes), [`services/api-gateway/app/main.py`](https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/main.py) (API gateway), [`frontend/src/hooks/useSession.ts`](https://github.com/shlok926/lattix-q/blob/main/frontend/src/hooks/useSession.ts) (Analyst session hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Web Portal"]
  node_web["Dashboard and labs<br/>[App.tsx]"]
  node_auth_ui["Frontend authentication<br/>[AuthContext.tsx]"]
  node_inventory["Asset inventory<br/>[AssetInventory.tsx]"]
  node_migration_ui["Migration simulator"]
  node_scanner_ui["Batch scanner<br/>[BatchScanner.tsx]"]
  node_workbench["Crypto workbench"]
end

subgraph group_gateway["Gateway &amp; Access"]
  node_gateway_app["API gateway<br/>[main.py]"]
  node_gateway_routes["Versioned API routes<br/>[router.py]"]
  node_gateway_auth["Login and tokens<br/>[auth.py]"]
  node_gateway_config["Service configuration<br/>[config.py]"]
end

subgraph group_crypto["Crypto &amp; Quantum Labs"]
  node_quantum["Quantum attack lab<br/>[main.py]"]
  node_classical["Classical crypto APIs<br/>[main.py]"]
  node_pqc["PQC algorithms<br/>[main.py]"]
end

subgraph group_migration["Migration &amp; Assurance"]
  node_benchmark["Performance benchmarks<br/>[runner.py]"]
  node_report["Compliance reports<br/>[report.py]"]
  node_pdf["PDF export<br/>[pdf_export.py]"]
  node_ai_scan["Code scan and refactor<br/>[router.py]"]
end

subgraph group_analyst["AI Threat Analyst"]
  node_analyst_ui["Threat analyst UI<br/>[index.tsx]"]
  node_analyst_hook["Analyst session hook<br/>[useSession.ts]"]
  node_analyst_api["Analyst API client<br/>[analystApi.ts]"]
  node_analyst_state["Analyst state<br/>[analystStore.ts]"]
  node_analyst_service["Analyst API service<br/>[analyst.py]"]
  node_conversation["Conversation management"]
  node_prompt["Contextual prompt engine<br/>[prompt_engine.py]"]
  node_claude["Model client<br/>[claude_client.py]"]
  node_redis[("Session store<br/>[redis_store.py]")]
end

node_user(("Enterprise user"))

node_user -->|"uses"| node_web
node_web -->|"provides auth"| node_auth_ui
node_web -->|"routes to"| node_inventory
node_web -->|"routes to"| node_migration_ui
node_web -->|"routes to"| node_scanner_ui
node_web -->|"routes to"| node_workbench
node_web -->|"routes to"| node_analyst_ui
node_auth_ui -.->|"authenticates via"| node_gateway_auth
node_web -.->|"sends API requests"| node_gateway_app
node_gateway_app -->|"mounts routes"| node_gateway_routes
node_gateway_app -->|"configures"| node_gateway_config
node_gateway_routes -.->|"routes requests"| node_quantum
node_gateway_routes -.->|"routes requests"| node_classical
node_gateway_routes -.->|"routes requests"| node_pqc
node_gateway_routes -.->|"routes requests"| node_benchmark
node_gateway_routes -.->|"routes requests"| node_report
node_gateway_routes -.->|"routes requests"| node_ai_scan
node_analyst_ui -.->|"uses session"| node_analyst_hook
node_analyst_hook -->|"requests sessions"| node_analyst_api
node_analyst_hook -->|"updates state"| node_analyst_state
node_analyst_api -.->|"calls service"| node_analyst_service
node_analyst_service -.->|"delegates conversation"| node_conversation
node_conversation -->|"stores sessions"| node_redis
node_conversation -.->|"builds prompts"| node_prompt
node_prompt -.->|"supplies prompt"| node_claude
node_report -->|"exports PDF"| node_pdf

click node_web "https://github.com/shlok926/lattix-q/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/shlok926/lattix-q/blob/main/frontend/src/context/AuthContext.tsx"
click node_inventory "https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/AssetInventory.tsx"
click node_migration_ui "https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/MigrationSimulator.tsx"
click node_scanner_ui "https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/BatchScanner.tsx"
click node_workbench "https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/CryptoWorkbench.tsx"
click node_analyst_ui "https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/ThreatAnalyst/index.tsx"
click node_analyst_hook "https://github.com/shlok926/lattix-q/blob/main/frontend/src/hooks/useSession.ts"
click node_analyst_api "https://github.com/shlok926/lattix-q/blob/main/frontend/src/api/analystApi.ts"
click node_analyst_state "https://github.com/shlok926/lattix-q/blob/main/frontend/src/store/analystStore.ts"
click node_gateway_app "https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/main.py"
click node_gateway_routes "https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/api/router.py"
click node_gateway_auth "https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/api/v1/auth.py"
click node_gateway_config "https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/config.py"
click node_quantum "https://github.com/shlok926/lattix-q/blob/main/services/quantum-attack-service/app/main.py"
click node_classical "https://github.com/shlok926/lattix-q/blob/main/services/classical-crypto-service/app/main.py"
click node_pqc "https://github.com/shlok926/lattix-q/blob/main/services/pqc-service/app/main.py"
click node_benchmark "https://github.com/shlok926/lattix-q/blob/main/services/benchmark-service/app/core/runner.py"
click node_report "https://github.com/shlok926/lattix-q/blob/main/services/report-service/app/api/report.py"
click node_pdf "https://github.com/shlok926/lattix-q/blob/main/services/report-service/app/core/pdf_export.py"
click node_ai_scan "https://github.com/shlok926/lattix-q/blob/main/services/ai-service/app/api/v1/router.py"
click node_analyst_service "https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/api/analyst.py"
click node_conversation "https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/core/conversation_manager.py"
click node_prompt "https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/core/prompt_engine.py"
click node_claude "https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/core/claude_client.py"
click node_redis "https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/session/redis_store.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_web,node_auth_ui,node_inventory,node_migration_ui,node_scanner_ui,node_workbench,node_user toneBlue
class node_gateway_app,node_gateway_routes,node_gateway_auth,node_gateway_config toneAmber
class node_quantum,node_classical,node_pqc toneMint
class node_benchmark,node_report,node_pdf,node_ai_scan toneRose
class node_analyst_ui,node_analyst_hook,node_analyst_api,node_analyst_state,node_analyst_service,node_conversation,node_prompt,node_claude,node_redis toneIndigo
```

## Components

### Web Portal

- [Dashboard and labs](https://github.com/shlok926/lattix-q/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Frontend authentication](https://github.com/shlok926/lattix-q/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Asset inventory](https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/AssetInventory.tsx): `frontend/src/pages/AssetInventory.tsx`
- [Migration simulator](https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/MigrationSimulator.tsx): `frontend/src/pages/MigrationSimulator.tsx`
- [Batch scanner](https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/BatchScanner.tsx): `frontend/src/pages/BatchScanner.tsx`
- [Crypto workbench](https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/CryptoWorkbench.tsx): `frontend/src/pages/CryptoWorkbench.tsx`

### Gateway & Access

- [API gateway](https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/main.py): `services/api-gateway/app/main.py`
- [Versioned API routes](https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/api/router.py): `services/api-gateway/app/api/router.py`
- [Login and tokens](https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/api/v1/auth.py): `services/api-gateway/app/api/v1/auth.py`
- [Service configuration](https://github.com/shlok926/lattix-q/blob/main/services/api-gateway/app/config.py): `services/api-gateway/app/config.py`

### Crypto & Quantum Labs

- [Quantum attack lab](https://github.com/shlok926/lattix-q/blob/main/services/quantum-attack-service/app/main.py): `services/quantum-attack-service/app/main.py`
- [Classical crypto APIs](https://github.com/shlok926/lattix-q/blob/main/services/classical-crypto-service/app/main.py): `services/classical-crypto-service/app/main.py`
- [PQC algorithms](https://github.com/shlok926/lattix-q/blob/main/services/pqc-service/app/main.py): `services/pqc-service/app/main.py`

### Migration & Assurance

- [Performance benchmarks](https://github.com/shlok926/lattix-q/blob/main/services/benchmark-service/app/core/runner.py): `services/benchmark-service/app/core/runner.py`
- [Compliance reports](https://github.com/shlok926/lattix-q/blob/main/services/report-service/app/api/report.py): `services/report-service/app/api/report.py`
- [PDF export](https://github.com/shlok926/lattix-q/blob/main/services/report-service/app/core/pdf_export.py): `services/report-service/app/core/pdf_export.py`
- [Code scan and refactor](https://github.com/shlok926/lattix-q/blob/main/services/ai-service/app/api/v1/router.py): `services/ai-service/app/api/v1/router.py`

### AI Threat Analyst

- [Threat analyst UI](https://github.com/shlok926/lattix-q/blob/main/frontend/src/pages/ThreatAnalyst/index.tsx): `frontend/src/pages/ThreatAnalyst/index.tsx`
- [Analyst session hook](https://github.com/shlok926/lattix-q/blob/main/frontend/src/hooks/useSession.ts): `frontend/src/hooks/useSession.ts`
- [Analyst API client](https://github.com/shlok926/lattix-q/blob/main/frontend/src/api/analystApi.ts): `frontend/src/api/analystApi.ts`
- [Analyst state](https://github.com/shlok926/lattix-q/blob/main/frontend/src/store/analystStore.ts): `frontend/src/store/analystStore.ts`
- [Analyst API service](https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/api/analyst.py): `services/ai-analyst-service/app/api/analyst.py`
- [Conversation management](https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/core/conversation_manager.py): `services/ai-analyst-service/app/core/conversation_manager.py`
- [Contextual prompt engine](https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/core/prompt_engine.py): `services/ai-analyst-service/app/core/prompt_engine.py`
- [Model client](https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/core/claude_client.py): `services/ai-analyst-service/app/core/claude_client.py`
- [Session store](https://github.com/shlok926/lattix-q/blob/main/services/ai-analyst-service/app/session/redis_store.py): `services/ai-analyst-service/app/session/redis_store.py`

### Other components

- **Enterprise user**

## Connections

- Enterprise user → Dashboard and labs: uses (evidence: `README.md`)
- Dashboard and labs → Frontend authentication: provides auth (evidence: `frontend/src/App.tsx`)
- Dashboard and labs → Asset inventory: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard and labs → Migration simulator: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard and labs → Batch scanner: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard and labs → Crypto workbench: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard and labs → Threat analyst UI: routes to (evidence: `frontend/src/App.tsx`)
- Frontend authentication → Login and tokens: authenticates via
- Dashboard and labs → API gateway: sends API requests (evidence: `README.md`)
- API gateway → Versioned API routes: mounts routes (evidence: `services/api-gateway/app/main.py`)
- API gateway → Service configuration: configures (evidence: `services/api-gateway/app/main.py`)
- Versioned API routes → Quantum attack lab: routes requests (evidence: `README.md`)
- Versioned API routes → Classical crypto APIs: routes requests (evidence: `README.md`)
- Versioned API routes → PQC algorithms: routes requests (evidence: `README.md`)
- Versioned API routes → Performance benchmarks: routes requests (evidence: `README.md`)
- Versioned API routes → Compliance reports: routes requests (evidence: `README.md`)
- Versioned API routes → Code scan and refactor: routes requests (evidence: `README.md`)
- Threat analyst UI → Analyst session hook: uses session
- Analyst session hook → Analyst API client: requests sessions (evidence: `frontend/src/hooks/useSession.ts`)
- Analyst session hook → Analyst state: updates state (evidence: `frontend/src/hooks/useSession.ts`)
- Analyst API client → Analyst API service: calls service
- Analyst API service → Conversation management: delegates conversation
- Conversation management → Session store: stores sessions (evidence: `services/ai-analyst-service/app/core/conversation_manager.py`)
- Conversation management → Contextual prompt engine: builds prompts
- Contextual prompt engine → Model client: supplies prompt
- Compliance reports → PDF export: exports PDF (evidence: `services/report-service/app/api/report.py`)
