# r3ix0/cspm-saas architecture

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

- Interactive diagram: https://gitdiagram.com/r3ix0/cspm-saas
- Repository: https://github.com/r3ix0/cspm-saas

## Overview

Cleave is an Azure-first cloud security posture management product. A user connects a cloud account and starts a scan; the API coordinates collection, preserves raw evidence, normalizes resources, evaluates deterministic rules, scores findings as business risks, and presents attack paths and fixes. Subsequent scans verify whether fixes took effect. The graph also includes compliance, reporting, and notifications documented in the README. Several implementation links are inferred only from product documentation or the tree because their source was not sampled.

Main entry points: [`apps/api/app/services/scan/pipeline.py`](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/scan/pipeline.py) (Scan pipeline), [`apps/api/app/services/orchestrator.py`](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/orchestrator.py) (Scan orchestrator), [`apps/web/src/App.tsx`](https://github.com/r3ix0/cspm-saas/blob/main/apps/web/src/App.tsx) (Web application), [`apps/api/app/api/router.py`](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/api/router.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product experience"]
  node_web["Web application<br/>[App.tsx]"]
  node_api["HTTP API<br/>[router.py]"]
end

subgraph group_scanning["Collection and scans"]
  node_orchestrator["Scan orchestrator<br/>[orchestrator.py]"]
  node_worker["Scan worker<br/>[scan_tasks.py]"]
  node_pipeline["Scan pipeline<br/>[pipeline.py]"]
  node_connectors["Cloud connectors"]
  node_capture["Raw capture<br/>[capture.py]"]
  node_normalization["Resource model<br/>[resource.py]"]
end

subgraph group_analysis["Security analysis"]
  node_rules["Rule engine<br/>[engine.py]"]
  node_rule_catalog["Rule catalog<br/>[registry.py]"]
  node_risk["Risk scoring<br/>[scorer.py]"]
  node_attack["Attack paths"]
  node_compliance["Compliance mapping"]
end

subgraph group_outcomes["Evidence and outcomes"]
  node_remediation["Fix guidance"]
  node_verification["Fix verification<br/>[verification.py]"]
  node_reports["Reports and audit"]
  node_notifications["Notifications<br/>[webhooks.py]"]
end

subgraph group_platform["Runtime foundation"]
  node_database[("PostgreSQL")]
end

node_user(("Security user"))
node_cloud{{"Customer cloud"}}

node_user -->|"uses"| node_web
node_web -.->|"requests"| node_api
node_api -.->|"starts scans"| node_orchestrator
node_orchestrator -->|"runs stages"| node_pipeline
node_pipeline -->|"collects from"| node_connectors
node_connectors -->|"reads estate"| node_cloud
node_pipeline -->|"stores snapshot"| node_capture
node_pipeline -->|"normalizes data"| node_normalization
node_pipeline -->|"evaluates"| node_rules
node_rules -->|"loads rules"| node_rule_catalog
node_pipeline -->|"scores findings"| node_risk
node_pipeline -->|"checks fixes"| node_verification
node_user -->|"explores routes"| node_attack
node_user -->|"reviews coverage"| node_compliance
node_user -->|"views fixes"| node_remediation
node_user -->|"requests reports"| node_reports
node_user -->|"receives updates"| node_notifications
node_pipeline -->|"persists scan data"| node_database
node_worker -.->|"executes scan work"| node_orchestrator

click node_web "https://github.com/r3ix0/cspm-saas/blob/main/apps/web/src/App.tsx"
click node_api "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/api/router.py"
click node_orchestrator "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/orchestrator.py"
click node_worker "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/workers/scan_tasks.py"
click node_pipeline "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/scan/pipeline.py"
click node_connectors "https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/connectors"
click node_capture "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/scan/capture.py"
click node_normalization "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/domain/resource.py"
click node_rules "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/rules/engine.py"
click node_rule_catalog "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/rules/registry.py"
click node_risk "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/risk/scorer.py"
click node_attack "https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/graph"
click node_compliance "https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/compliance"
click node_remediation "https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/remediation"
click node_verification "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/verification.py"
click node_reports "https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/reports"
click node_notifications "https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/webhooks.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_api,node_user toneBlue
class node_orchestrator,node_worker,node_pipeline,node_connectors,node_capture,node_normalization toneAmber
class node_rules,node_rule_catalog,node_risk,node_attack,node_compliance toneMint
class node_remediation,node_verification,node_reports,node_notifications toneRose
class node_database,node_cloud toneIndigo
```

## Components

### Product experience

- [Web application](https://github.com/r3ix0/cspm-saas/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [HTTP API](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/api/router.py): `apps/api/app/api/router.py`

### Collection and scans

- [Scan orchestrator](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/orchestrator.py): `apps/api/app/services/orchestrator.py`
- [Scan worker](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/workers/scan_tasks.py): `apps/api/app/workers/scan_tasks.py`
- [Scan pipeline](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/scan/pipeline.py): `apps/api/app/services/scan/pipeline.py`
- [Cloud connectors](https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/connectors): `apps/api/app/connectors`
- [Raw capture](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/scan/capture.py): `apps/api/app/services/scan/capture.py`
- [Resource model](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/domain/resource.py): `apps/api/app/domain/resource.py`

### Security analysis

- [Rule engine](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/rules/engine.py): `apps/api/app/rules/engine.py`
- [Rule catalog](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/rules/registry.py): `apps/api/app/rules/registry.py`
- [Risk scoring](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/risk/scorer.py): `apps/api/app/risk/scorer.py`
- [Attack paths](https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/graph): `apps/api/app/graph`
- [Compliance mapping](https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/compliance): `apps/api/app/compliance`

### Evidence and outcomes

- [Fix guidance](https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/remediation): `apps/api/app/remediation`
- [Fix verification](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/verification.py): `apps/api/app/services/verification.py`
- [Reports and audit](https://github.com/r3ix0/cspm-saas/tree/main/apps/api/app/reports): `apps/api/app/reports`
- [Notifications](https://github.com/r3ix0/cspm-saas/blob/main/apps/api/app/services/webhooks.py): `apps/api/app/services/webhooks.py`

### Runtime foundation

- **PostgreSQL**

### Other components

- **Security user**
- **Customer cloud**

## Connections

- Security user → Web application: uses (evidence: `README.md`)
- Web application → HTTP API: requests
- HTTP API → Scan orchestrator: starts scans
- Scan orchestrator → Scan pipeline: runs stages (evidence: `apps/api/app/services/scan/pipeline.py`)
- Scan pipeline → Cloud connectors: collects from (evidence: `README.md`)
- Cloud connectors → Customer cloud: reads estate (evidence: `README.md`)
- Scan pipeline → Raw capture: stores snapshot (evidence: `README.md`)
- Scan pipeline → Resource model: normalizes data (evidence: `README.md`)
- Scan pipeline → Rule engine: evaluates (evidence: `apps/api/app/services/scan/pipeline.py`)
- Rule engine → Rule catalog: loads rules (evidence: `apps/api/app/rules/engine.py`)
- Scan pipeline → Risk scoring: scores findings (evidence: `README.md`)
- Scan pipeline → Fix verification: checks fixes (evidence: `README.md`)
- Security user → Attack paths: explores routes (evidence: `README.md`)
- Security user → Compliance mapping: reviews coverage (evidence: `README.md`)
- Security user → Fix guidance: views fixes (evidence: `README.md`)
- Security user → Reports and audit: requests reports (evidence: `README.md`)
- Security user → Notifications: receives updates (evidence: `README.md`)
- Scan pipeline → PostgreSQL: persists scan data (evidence: `README.md`)
- Scan worker → Scan orchestrator: executes scan work (evidence: `apps/api/app/workers/scan_tasks.py`)
