# ahlbertng/swiftdeploy architecture

> Architecture diagram of the GitHub repository ahlbertng/swiftdeploy, 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/ahlbertng/swiftdeploy
- Repository: https://github.com/ahlbertng/swiftdeploy

## Overview

SwiftDeploy is a deployment-automation CLI paired with a FastAPI service. The main workflow loads a manifest, checks policy, renders deployment configuration, deploys the service, verifies health, and records events; status, promotion, and audit provide distinct operational workflows. The README documents CLI capabilities and their relationships, but the CLI source was not excerpted, so its internal implementation is represented at the documented entry point rather than inferred in detail.

Main entry points: [`swiftdeploy`](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy) (SwiftDeploy CLI), [`app/main.py`](https://github.com/ahlbertng/swiftdeploy/blob/main/app/main.py) (FastAPI service), [`templates`](https://github.com/ahlbertng/swiftdeploy/tree/main/templates) (Configuration generation), [`manifest.yaml`](https://github.com/ahlbertng/swiftdeploy/blob/main/manifest.yaml) (Deployment manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deployment["Deployment workflow"]
  node_cli["SwiftDeploy CLI"]
  node_manifest["Deployment manifest<br/>[manifest.yaml]"]
  node_configgen["Configuration generation"]
  node_compose["Docker Compose"]
  node_health["Health verification"]
end

subgraph group_policy["Policy controls"]
  node_opa["OPA evaluation"]
  node_policyrules["Policy rules"]
end

subgraph group_operations["Operations and audit"]
  node_status["Status dashboard"]
  node_promotion["Canary promotion"]
  node_history["Event history"]
  node_historyfile["History log"]
  node_audit["Audit report"]
  node_reportfile["Audit output"]
end

subgraph group_service["Application service"]
  node_app["FastAPI service<br/>[main.py]"]
  node_metrics["Service metrics<br/>[main.py]"]
  node_chaos["Chaos controls<br/>[main.py]"]
end

node_operator(("Operator"))

node_operator -->|"runs commands"| node_cli
node_cli -->|"loads configuration"| node_manifest
node_cli -->|"renders configuration"| node_configgen
node_configgen -->|"generates Compose"| node_compose
node_cli -->|"checks policies"| node_opa
node_opa -.->|"evaluates rules"| node_policyrules
node_cli -->|"deploys stack"| node_compose
node_compose -->|"runs service"| node_app
node_cli -->|"verifies health"| node_health
node_health -->|"checks /healthz"| node_app
node_cli -->|"runs status"| node_status
node_status -->|"scrapes metrics"| node_metrics
node_metrics -->|"exposes /metrics"| node_app
node_status -->|"queries policies"| node_opa
node_cli -->|"runs promotion"| node_promotion
node_promotion -->|"scrapes metrics"| node_metrics
node_promotion -->|"checks canary"| node_opa
node_cli -->|"records events"| node_history
node_history -->|"appends events"| node_historyfile
node_audit -->|"reads events"| node_historyfile
node_audit -->|"writes report"| node_reportfile
node_app -->|"updates metrics"| node_metrics
node_chaos -->|"injects failures"| node_app

click node_cli "https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy"
click node_manifest "https://github.com/ahlbertng/swiftdeploy/blob/main/manifest.yaml"
click node_configgen "https://github.com/ahlbertng/swiftdeploy/tree/main/templates"
click node_health "https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy"
click node_policyrules "https://github.com/ahlbertng/swiftdeploy/tree/main/policies"
click node_status "https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy"
click node_promotion "https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy"
click node_history "https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy"
click node_audit "https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy"
click node_app "https://github.com/ahlbertng/swiftdeploy/blob/main/app/main.py"
click node_metrics "https://github.com/ahlbertng/swiftdeploy/blob/main/app/main.py"
click node_chaos "https://github.com/ahlbertng/swiftdeploy/blob/main/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_cli,node_manifest,node_configgen,node_compose,node_health toneBlue
class node_opa,node_policyrules toneAmber
class node_status,node_promotion,node_history,node_historyfile,node_audit,node_reportfile toneMint
class node_app,node_metrics,node_chaos toneRose
class node_operator toneIndigo
```

## Components

### Deployment workflow

- [SwiftDeploy CLI](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy): `swiftdeploy`
- [Deployment manifest](https://github.com/ahlbertng/swiftdeploy/blob/main/manifest.yaml): `manifest.yaml`
- [Configuration generation](https://github.com/ahlbertng/swiftdeploy/tree/main/templates): `templates`
- **Docker Compose**
- [Health verification](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy): `swiftdeploy`

### Policy controls

- **OPA evaluation**
- [Policy rules](https://github.com/ahlbertng/swiftdeploy/tree/main/policies): `policies`

### Operations and audit

- [Status dashboard](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy): `swiftdeploy`
- [Canary promotion](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy): `swiftdeploy`
- [Event history](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy): `swiftdeploy`
- **History log**
- [Audit report](https://github.com/ahlbertng/swiftdeploy/blob/main/swiftdeploy): `swiftdeploy`
- **Audit output**

### Application service

- [FastAPI service](https://github.com/ahlbertng/swiftdeploy/blob/main/app/main.py): `app/main.py`
- [Service metrics](https://github.com/ahlbertng/swiftdeploy/blob/main/app/main.py): `app/main.py`
- [Chaos controls](https://github.com/ahlbertng/swiftdeploy/blob/main/app/main.py): `app/main.py`

### Other components

- **Operator**

## Connections

- Operator → SwiftDeploy CLI: runs commands (evidence: `README.md`)
- SwiftDeploy CLI → Deployment manifest: loads configuration (evidence: `README.md`)
- SwiftDeploy CLI → Configuration generation: renders configuration (evidence: `README.md`)
- Configuration generation → Docker Compose: generates Compose (evidence: `README.md`)
- SwiftDeploy CLI → OPA evaluation: checks policies (evidence: `README.md`)
- OPA evaluation → Policy rules: evaluates rules
- SwiftDeploy CLI → Docker Compose: deploys stack (evidence: `README.md`)
- Docker Compose → FastAPI service: runs service (evidence: `README.md`)
- SwiftDeploy CLI → Health verification: verifies health (evidence: `README.md`)
- Health verification → FastAPI service: checks /healthz (evidence: `README.md`)
- SwiftDeploy CLI → Status dashboard: runs status (evidence: `README.md`)
- Status dashboard → Service metrics: scrapes metrics (evidence: `README.md`)
- Service metrics → FastAPI service: exposes /metrics (evidence: `README.md`)
- Status dashboard → OPA evaluation: queries policies (evidence: `README.md`)
- SwiftDeploy CLI → Canary promotion: runs promotion (evidence: `README.md`)
- Canary promotion → Service metrics: scrapes metrics (evidence: `README.md`)
- Canary promotion → OPA evaluation: checks canary (evidence: `README.md`)
- SwiftDeploy CLI → Event history: records events (evidence: `README.md`)
- Event history → History log: appends events (evidence: `README.md`)
- Audit report → History log: reads events (evidence: `README.md`)
- Audit report → Audit output: writes report (evidence: `README.md`)
- FastAPI service → Service metrics: updates metrics (evidence: `app/main.py`)
- Chaos controls → FastAPI service: injects failures (evidence: `app/main.py`)
