# sameergfhf/aegis architecture

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

- Interactive diagram: https://gitdiagram.com/sameergfhf/aegis
- Repository: https://github.com/sameergfhf/aegis

## Overview

AEGIS is a multi-tenant API security scanner and posture-management platform. Users submit API targets through the web app; backend routes validate targets, run security scans, score and visualize findings, and persist results for history and reporting. Separate product branches support authentication, workspace governance, scheduled scans, OpenAPI analysis, API discovery/comparison, and executive reports. Evidence is limited to the supplied excerpts, SOURCE INDEX references, and README; unsampled feature links are included only where documented there.

Main entry points: [`backend/app/api/routes.py`](https://github.com/sameergfhf/aegis/blob/main/backend/app/api/routes.py) (API routes), [`backend/app/services/scan_service.py`](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/scan_service.py) (Scan orchestration), [`frontend/src/App.tsx`](https://github.com/sameergfhf/aegis/blob/main/frontend/src/App.tsx) (Web router), [`backend/app/database.py`](https://github.com/sameergfhf/aegis/blob/main/backend/app/database.py) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Web router<br/>[App.tsx]"]
  node_scan_ui["Scan interface<br/>[ScanResults.tsx]"]
  node_scan_hook["Scan client hook<br/>[useScan.ts]"]
  node_api_client["HTTP API client<br/>[api.ts]"]
end

subgraph group_scan["Scanning and analysis"]
  node_api_routes["API routes<br/>[routes.py]"]
  node_url_guard["SSRF validation<br/>[url_validation.py]"]
  node_scan_service["Scan orchestration<br/>[scan_service.py]"]
  node_security_probes["Security probes"]
  node_scoring["Evidence scoring<br/>[scoring.py]"]
  node_visualization["Telemetry generation"]
  node_redaction["Secret redaction<br/>[redaction.py]"]
end

subgraph group_identity["Identity and workspaces"]
  node_auth_ui["Auth state<br/>[AuthContext.tsx]"]
  node_workspace_ui["Workspace state"]
  node_auth_routes["Auth endpoints<br/>[auth_routes.py]"]
  node_workspace_routes["Workspace endpoints"]
  node_authorization["Workspace permissions"]
end

subgraph group_operations["Operations and insights"]
  node_schedule["Scheduled scans"]
  node_discovery["API discovery"]
  node_openapi["OpenAPI analysis<br/>[openapi_service.py]"]
  node_reports["Audit reports<br/>[report_service.py]"]
end

subgraph group_persistence["Persistence"]
  node_database[("Database access<br/>[database.py]")]
  node_scan_records[("Scan and findings<br/>[scan.py]")]
  node_scheduled_records[("Schedule records<br/>[scheduled_scan.py]")]
end

node_user(("API user"))
node_neon[("PostgreSQL service")]
node_threat_intel["Threat intelligence"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_scan_ui
node_scan_ui -.->|"requests scans"| node_scan_hook
node_scan_hook -->|"calls"| node_api_client
node_api_client -.->|"HTTP requests"| node_api_routes
node_app -->|"provides auth"| node_auth_ui
node_app -->|"provides workspace"| node_workspace_ui
node_workspace_ui -->|"workspace requests"| node_api_client
node_api_routes -->|"validates target"| node_url_guard
node_api_routes -->|"starts scan"| node_scan_service
node_scan_service -->|"runs probes"| node_security_probes
node_scan_service -->|"scores findings"| node_scoring
node_scan_service -->|"builds telemetry"| node_visualization
node_scan_service -->|"sanitizes results"| node_redaction
node_security_probes -.->|"checks reputation"| node_threat_intel
node_api_routes -->|"generates report"| node_reports
node_api_routes -->|"discovers alternatives"| node_discovery
node_api_routes -->|"analyzes specs"| node_openapi
node_auth_ui -.->|"authenticates"| node_auth_routes
node_workspace_ui -->|"manages teams"| node_workspace_routes
node_workspace_routes -->|"checks permissions"| node_authorization
node_api_routes -->|"checks access"| node_authorization
node_schedule -->|"runs scheduled scans"| node_scan_service
node_database -->|"maps records"| node_scan_records
node_database -->|"maps records"| node_scheduled_records
node_scan_service -->|"persists results"| node_database
node_schedule -->|"stores schedules"| node_scheduled_records
node_database -.->|"connects to"| node_neon

click node_app "https://github.com/sameergfhf/aegis/blob/main/frontend/src/App.tsx"
click node_scan_ui "https://github.com/sameergfhf/aegis/blob/main/frontend/src/pages/ScanResults.tsx"
click node_scan_hook "https://github.com/sameergfhf/aegis/blob/main/frontend/src/hooks/useScan.ts"
click node_api_client "https://github.com/sameergfhf/aegis/blob/main/frontend/src/services/api.ts"
click node_auth_ui "https://github.com/sameergfhf/aegis/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_workspace_ui "https://github.com/sameergfhf/aegis/blob/main/frontend/src/contexts/WorkspaceContext.tsx"
click node_api_routes "https://github.com/sameergfhf/aegis/blob/main/backend/app/api/routes.py"
click node_url_guard "https://github.com/sameergfhf/aegis/blob/main/backend/app/security/url_validation.py"
click node_scan_service "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/scan_service.py"
click node_security_probes "https://github.com/sameergfhf/aegis/tree/main/backend/app/scanners"
click node_scoring "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/scoring.py"
click node_visualization "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/visualization_service.py"
click node_redaction "https://github.com/sameergfhf/aegis/blob/main/backend/app/security/redaction.py"
click node_auth_routes "https://github.com/sameergfhf/aegis/blob/main/backend/app/api/auth_routes.py"
click node_workspace_routes "https://github.com/sameergfhf/aegis/blob/main/backend/app/api/workspace_routes.py"
click node_authorization "https://github.com/sameergfhf/aegis/blob/main/backend/app/security/workspace_authorization.py"
click node_schedule "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/schedule_service.py"
click node_discovery "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/alternative_discovery_service.py"
click node_openapi "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/openapi_service.py"
click node_reports "https://github.com/sameergfhf/aegis/blob/main/backend/app/services/report_service.py"
click node_database "https://github.com/sameergfhf/aegis/blob/main/backend/app/database.py"
click node_scan_records "https://github.com/sameergfhf/aegis/blob/main/backend/app/models/scan.py"
click node_scheduled_records "https://github.com/sameergfhf/aegis/blob/main/backend/app/models/scheduled_scan.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_app,node_scan_ui,node_scan_hook,node_api_client,node_user toneBlue
class node_api_routes,node_url_guard,node_scan_service,node_security_probes,node_scoring,node_visualization,node_redaction,node_neon toneAmber
class node_auth_ui,node_workspace_ui,node_auth_routes,node_workspace_routes,node_authorization toneMint
class node_schedule,node_discovery,node_openapi,node_reports toneRose
class node_database,node_scan_records,node_scheduled_records,node_threat_intel toneIndigo
```

## Components

### Web application

- [Web router](https://github.com/sameergfhf/aegis/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Scan interface](https://github.com/sameergfhf/aegis/blob/main/frontend/src/pages/ScanResults.tsx): `frontend/src/pages/ScanResults.tsx`
- [Scan client hook](https://github.com/sameergfhf/aegis/blob/main/frontend/src/hooks/useScan.ts): `frontend/src/hooks/useScan.ts`
- [HTTP API client](https://github.com/sameergfhf/aegis/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Scanning and analysis

- [API routes](https://github.com/sameergfhf/aegis/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [SSRF validation](https://github.com/sameergfhf/aegis/blob/main/backend/app/security/url_validation.py): `backend/app/security/url_validation.py`
- [Scan orchestration](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/scan_service.py): `backend/app/services/scan_service.py`
- [Security probes](https://github.com/sameergfhf/aegis/tree/main/backend/app/scanners): `backend/app/scanners`
- [Evidence scoring](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/scoring.py): `backend/app/services/scoring.py`
- [Telemetry generation](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/visualization_service.py): `backend/app/services/visualization_service.py`
- [Secret redaction](https://github.com/sameergfhf/aegis/blob/main/backend/app/security/redaction.py): `backend/app/security/redaction.py`

### Identity and workspaces

- [Auth state](https://github.com/sameergfhf/aegis/blob/main/frontend/src/contexts/AuthContext.tsx): `frontend/src/contexts/AuthContext.tsx`
- [Workspace state](https://github.com/sameergfhf/aegis/blob/main/frontend/src/contexts/WorkspaceContext.tsx): `frontend/src/contexts/WorkspaceContext.tsx`
- [Auth endpoints](https://github.com/sameergfhf/aegis/blob/main/backend/app/api/auth_routes.py): `backend/app/api/auth_routes.py`
- [Workspace endpoints](https://github.com/sameergfhf/aegis/blob/main/backend/app/api/workspace_routes.py): `backend/app/api/workspace_routes.py`
- [Workspace permissions](https://github.com/sameergfhf/aegis/blob/main/backend/app/security/workspace_authorization.py): `backend/app/security/workspace_authorization.py`

### Operations and insights

- [Scheduled scans](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/schedule_service.py): `backend/app/services/schedule_service.py`
- [API discovery](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/alternative_discovery_service.py): `backend/app/services/alternative_discovery_service.py`
- [OpenAPI analysis](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/openapi_service.py): `backend/app/services/openapi_service.py`
- [Audit reports](https://github.com/sameergfhf/aegis/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`

### Persistence

- [Database access](https://github.com/sameergfhf/aegis/blob/main/backend/app/database.py): `backend/app/database.py`
- [Scan and findings](https://github.com/sameergfhf/aegis/blob/main/backend/app/models/scan.py): `backend/app/models/scan.py`
- [Schedule records](https://github.com/sameergfhf/aegis/blob/main/backend/app/models/scheduled_scan.py): `backend/app/models/scheduled_scan.py`

### Other components

- **API user**
- **PostgreSQL service**
- **Threat intelligence**

## Connections

- API user → Web router: uses (evidence: `frontend/src/App.tsx`)
- Web router → Scan interface: routes to (evidence: `frontend/src/App.tsx`)
- Scan interface → Scan client hook: requests scans
- Scan client hook → HTTP API client: calls (evidence: `frontend/src/hooks/useScan.ts`)
- HTTP API client → API routes: HTTP requests
- Web router → Auth state: provides auth (evidence: `frontend/src/App.tsx`)
- Web router → Workspace state: provides workspace (evidence: `frontend/src/App.tsx`)
- Workspace state → HTTP API client: workspace requests (evidence: `frontend/src/contexts/WorkspaceContext.tsx`)
- API routes → SSRF validation: validates target (evidence: `backend/app/api/routes.py`)
- API routes → Scan orchestration: starts scan (evidence: `backend/app/api/routes.py`)
- Scan orchestration → Security probes: runs probes (evidence: `backend/app/services/scan_service.py`)
- Scan orchestration → Evidence scoring: scores findings (evidence: `backend/app/services/scan_service.py`)
- Scan orchestration → Telemetry generation: builds telemetry (evidence: `backend/app/services/scan_service.py`)
- Scan orchestration → Secret redaction: sanitizes results (evidence: `backend/app/services/scan_service.py`)
- Security probes → Threat intelligence: checks reputation
- API routes → Audit reports: generates report (evidence: `backend/app/api/routes.py`)
- API routes → API discovery: discovers alternatives (evidence: `backend/app/api/routes.py`)
- API routes → OpenAPI analysis: analyzes specs (evidence: `backend/app/api/routes.py`)
- Auth state → Auth endpoints: authenticates
- Workspace state → Workspace endpoints: manages teams (evidence: `frontend/src/contexts/WorkspaceContext.tsx`)
- Workspace endpoints → Workspace permissions: checks permissions (evidence: `backend/app/api/workspace_routes.py`)
- API routes → Workspace permissions: checks access (evidence: `backend/app/api/routes.py`)
- Scheduled scans → Scan orchestration: runs scheduled scans (evidence: `backend/app/services/schedule_service.py`)
- Database access → Scan and findings: maps records (evidence: `backend/app/models/scan.py`)
- Database access → Schedule records: maps records (evidence: `backend/app/models/scheduled_scan.py`)
- Scan orchestration → Database access: persists results (evidence: `backend/app/services/scan_service.py`)
- Scheduled scans → Schedule records: stores schedules (evidence: `backend/app/services/schedule_service.py`)
- Database access → PostgreSQL service: connects to
