# ajay-yv/active-cyber-deception architecture

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

- Interactive diagram: https://gitdiagram.com/ajay-yv/active-cyber-deception
- Repository: https://github.com/ajay-yv/active-cyber-deception

## Overview

This is a healthcare cyber-deception platform: users access role-specific dashboards and patient workflows, while the backend exposes healthcare and security APIs, routes requests through gateway policy, and supports synthetic twins, analytics, and forensic monitoring. The README documents Google patient sign-in and authenticated realtime alerts. Some subsystems are represented from the tree and README without sampled implementation; those links are omitted or marked unverified rather than inferred.

Main entry points: [`backend/app/main.py`](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/api/patients.py`](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/patients.py) (Patient endpoints), [`frontend/src/api.ts`](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/api.ts) (API client), [`frontend/src/App.tsx`](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/App.tsx) (App routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Role-based frontend"]
  node_frontend["App routing<br/>[App.tsx]"]
  node_user_ui["Patient and admin UI<br/>[AppUser.tsx]"]
  node_doctor_ui["Doctor dashboard"]
  node_hacker_ui["Hacker dashboard<br/>[AppHacker.tsx]"]
  node_client_api["API client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_patient_api["Patient endpoints<br/>[patients.py]"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_security_api["Security endpoints<br/>[security.py]"]
  node_realtime_api["Realtime endpoint<br/>[realtime.py]"]
end

subgraph group_domain["Healthcare and AI"]
  node_patients["Patient services<br/>[patients.py]"]
  node_twin["Twin generation<br/>[twin.py]"]
  node_ai_engine["AI twin engine<br/>[twin_generator.py]"]
  node_analytics["Analytics<br/>[analytics.py]"]
end

subgraph group_security["Security and persistence"]
  node_gateway["Gateway policy<br/>[gateway.py]"]
  node_ai_proxy["AI engine proxy<br/>[ai_engine_proxy.py]"]
  node_patient_repo["Patient repository"]
  node_synthetic_repo["Twin repository"]
  node_security_repo["Security repository"]
  node_databases[("Application databases<br/>[engines.py]")]
end

node_users(("Patients and staff"))
node_gateway_service["AI security gateway<br/>[app.py]"]
node_firebase["Firebase Authentication"]

node_users -->|"use dashboards"| node_frontend
node_frontend -->|"routes to"| node_user_ui
node_frontend -->|"routes to"| node_hacker_ui
node_user_ui -->|"requests data"| node_client_api
node_doctor_ui -->|"requests data"| node_client_api
node_hacker_ui -->|"requests data"| node_client_api
node_client_api -.->|"calls API"| node_backend
node_backend -->|"registers routes"| node_auth_api
node_backend -->|"registers routes"| node_patient_api
node_backend -->|"registers routes"| node_security_api
node_backend -->|"registers routes"| node_realtime_api
node_backend -->|"evaluates requests"| node_gateway
node_patient_api -->|"calls services"| node_patients
node_patient_api -->|"checks requests"| node_gateway
node_patient_api -->|"requests twins"| node_twin
node_patient_api -.->|"persists patients"| node_patient_repo
node_twin -.->|"stores twins"| node_synthetic_repo
node_auth_api -.->|"verifies sign-in"| node_firebase
node_auth_api -->|"matches patient"| node_patients
node_backend -->|"routes analytics"| node_analytics
node_backend -.->|"provides AI proxy"| node_ai_proxy
node_ai_proxy -.->|"connects to engine"| node_ai_engine
node_gateway -->|"requests decision"| node_gateway_service
node_patient_repo -->|"reads and writes"| node_databases
node_synthetic_repo -->|"reads and writes"| node_databases
node_security_repo -->|"reads and writes"| node_databases
node_security_api -->|"uses repository"| node_security_repo

click node_frontend "https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/App.tsx"
click node_user_ui "https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/user/AppUser.tsx"
click node_doctor_ui "https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/components/DoctorDashboard.tsx"
click node_hacker_ui "https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/hacker/AppHacker.tsx"
click node_client_api "https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/api.ts"
click node_backend "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/main.py"
click node_patient_api "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/patients.py"
click node_auth_api "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/auth.py"
click node_security_api "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/security.py"
click node_realtime_api "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/realtime.py"
click node_patients "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/patients.py"
click node_twin "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/twin.py"
click node_ai_engine "https://github.com/ajay-yv/active-cyber-deception/blob/main/ai-engine/app/twin_generator.py"
click node_analytics "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/analytics.py"
click node_gateway "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/gateway.py"
click node_ai_proxy "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/ai_engine_proxy.py"
click node_patient_repo "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/repositories/patient_repository.py"
click node_synthetic_repo "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/repositories/synthetic_repository.py"
click node_security_repo "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/repositories/security_repository.py"
click node_databases "https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/db/engines.py"
click node_gateway_service "https://github.com/ajay-yv/active-cyber-deception/blob/main/gateway/app.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_frontend,node_user_ui,node_doctor_ui,node_hacker_ui,node_client_api toneBlue
class node_backend,node_patient_api,node_auth_api,node_security_api,node_realtime_api toneAmber
class node_patients,node_twin,node_ai_engine,node_analytics toneMint
class node_gateway,node_ai_proxy,node_patient_repo,node_synthetic_repo,node_security_repo,node_databases toneRose
class node_users,node_firebase toneIndigo
class node_gateway_service toneTeal
```

## Components

### Role-based frontend

- [App routing](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Patient and admin UI](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/user/AppUser.tsx): `frontend/src/user/AppUser.tsx`
- [Doctor dashboard](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/components/DoctorDashboard.tsx): `frontend/src/components/DoctorDashboard.tsx`
- [Hacker dashboard](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/hacker/AppHacker.tsx): `frontend/src/hacker/AppHacker.tsx`
- [API client](https://github.com/ajay-yv/active-cyber-deception/blob/main/frontend/src/api.ts): `frontend/src/api.ts`

### Backend API

- [FastAPI application](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/main.py): `backend/app/main.py`
- [Patient endpoints](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/patients.py): `backend/app/api/patients.py`
- [Authentication](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Security endpoints](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/security.py): `backend/app/api/security.py`
- [Realtime endpoint](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/api/realtime.py): `backend/app/api/realtime.py`

### Healthcare and AI

- [Patient services](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/patients.py): `backend/app/services/patients.py`
- [Twin generation](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/twin.py): `backend/app/services/twin.py`
- [AI twin engine](https://github.com/ajay-yv/active-cyber-deception/blob/main/ai-engine/app/twin_generator.py): `ai-engine/app/twin_generator.py`
- [Analytics](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/analytics.py): `backend/app/services/analytics.py`

### Security and persistence

- [Gateway policy](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/gateway.py): `backend/app/services/gateway.py`
- [AI engine proxy](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/services/ai_engine_proxy.py): `backend/app/services/ai_engine_proxy.py`
- [Patient repository](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/repositories/patient_repository.py): `backend/app/repositories/patient_repository.py`
- [Twin repository](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/repositories/synthetic_repository.py): `backend/app/repositories/synthetic_repository.py`
- [Security repository](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/repositories/security_repository.py): `backend/app/repositories/security_repository.py`
- [Application databases](https://github.com/ajay-yv/active-cyber-deception/blob/main/backend/app/db/engines.py): `backend/app/db/engines.py`

### Other components

- **Patients and staff**
- [AI security gateway](https://github.com/ajay-yv/active-cyber-deception/blob/main/gateway/app.py): `gateway/app.py`
- **Firebase Authentication**

## Connections

- Patients and staff → App routing: use dashboards (evidence: `frontend/src/App.tsx`)
- App routing → Patient and admin UI: routes to
- App routing → Hacker dashboard: routes to
- Patient and admin UI → API client: requests data (evidence: `frontend/src/user/AppUser.tsx`)
- Doctor dashboard → API client: requests data (evidence: `frontend/src/components/DoctorDashboard.tsx`)
- Hacker dashboard → API client: requests data (evidence: `frontend/src/hacker/AppHacker.tsx`)
- API client → FastAPI application: calls API (evidence: `README.md`)
- FastAPI application → Authentication: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Patient endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Security endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Realtime endpoint: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Gateway policy: evaluates requests (evidence: `backend/app/main.py`)
- Patient endpoints → Patient services: calls services (evidence: `backend/app/api/patients.py`)
- Patient endpoints → Gateway policy: checks requests (evidence: `backend/app/api/patients.py`)
- Patient endpoints → Twin generation: requests twins (evidence: `backend/app/api/patients.py`)
- Patient endpoints → Patient repository: persists patients
- Twin generation → Twin repository: stores twins
- Authentication → Firebase Authentication: verifies sign-in (evidence: `README.md`)
- Authentication → Patient services: matches patient (evidence: `backend/app/api/auth.py`)
- FastAPI application → Analytics: routes analytics (evidence: `backend/app/main.py`)
- FastAPI application → AI engine proxy: provides AI proxy
- AI engine proxy → AI twin engine: connects to engine
- Gateway policy → AI security gateway: requests decision (evidence: `backend/app/services/gateway.py`)
- Patient repository → Application databases: reads and writes (evidence: `backend/app/repositories/patient_repository.py`)
- Twin repository → Application databases: reads and writes (evidence: `backend/app/repositories/synthetic_repository.py`)
- Security repository → Application databases: reads and writes (evidence: `backend/app/repositories/security_repository.py`)
- Security endpoints → Security repository: uses repository
