# runtz-dev/runtz architecture

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

- Interactive diagram: https://gitdiagram.com/runtz-dev/runtz
- Repository: https://github.com/runtz-dev/runtz

## Overview

Runtz is a DevSecOps security platform: scanner clients submit results to a Go engine, and users review findings, assets, trends, and cloud-security checks in a Next.js platform. The engine also handles identity, workspaces, API keys, billing, and cloud integrations. The README documents the major scan families and platform capabilities; sampled excerpts show server startup, the frontend API proxy, MongoDB setup, and cloud-ingestion validation. Several feature-specific backend implementations were not sampled, so their internal calls are not expanded.

Main entry points: [`frontend/src/app/api/[...path]/route.ts`](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/api/%5B...path%5D/route.ts) (API proxy), [`engine/internal/api/server.go`](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/server.go) (HTTP engine), [`engine/internal/api/cloud_ingest.go`](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/cloud_ingest.go) (Scan ingestion and queries), [`frontend/src/app/(platform)`](https://github.com/runtz-dev/runtz/tree/main/frontend/src/app/(platform)) (Web platform)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Platform experience"]
  node_webui["Web platform"]
  node_proxy["API proxy<br/>[route.ts]"]
  node_overview["Overview dashboard<br/>[page.tsx]"]
  node_scanviews["Scan dashboards"]
  node_cloudviews["Cloud setup and views<br/>[cloud-pages.tsx]"]
  node_settings["Workspace settings<br/>[page.tsx]"]
  node_onboarding["First-run setup<br/>[page.tsx]"]
end

subgraph group_engine["Engine and identity"]
  node_engine["HTTP engine<br/>[server.go]"]
  node_auth["Authentication<br/>[auth_email.go]"]
  node_workspace["Workspace and API keys<br/>[api_keys.go]"]
  node_billing["Plans and billing<br/>[billing.go]"]
end

subgraph group_scans["Scan results"]
  node_scanapi["Scan ingestion and queries<br/>[cloud_ingest.go]"]
  node_sca["SCA results<br/>[page.tsx]"]
  node_sast["SAST results<br/>[page.tsx]"]
  node_infra["Host, container, Kubernetes<br/>[page.tsx]"]
end

subgraph group_cloud["Cloud security"]
  node_cloudapi["Cloud scan ingestion<br/>[cloud_ingest.go]"]
  node_gcp["GCP credential validation<br/>[client.go]"]
  node_securityclient["Security service client<br/>[client.go]"]
end

subgraph group_services["State and integrations"]
  node_mongo[("MongoDB")]
  node_securityservice["Runtz Security service"]
  node_stripe["Stripe"]
end

node_user(("Platform user"))
node_scanner(("Scanner CLI"))

node_user -->|"uses"| node_webui
node_scanner -->|"uploads scans"| node_scanapi
node_webui -->|"requests API"| node_proxy
node_proxy -->|"forwards requests"| node_engine
node_engine -->|"connects and queries"| node_mongo
node_engine -.->|"handles identity"| node_auth
node_engine -.->|"handles workspace access"| node_workspace
node_engine -.->|"handles billing"| node_billing
node_scanapi -.->|"stores scan data"| node_mongo
node_overview -.->|"loads dashboard data"| node_proxy
node_scanviews -.->|"loads scan data"| node_proxy
node_webui -->|"presents trends"| node_overview
node_webui -->|"presents findings"| node_scanviews
node_settings -->|"manages workspaces"| node_proxy
node_onboarding -->|"creates workspace"| node_proxy
node_cloudviews -.->|"manages cloud scans"| node_proxy
node_cloudapi -->|"delegates security operations"| node_securityclient
node_cloudapi -.->|"validates credentials"| node_gcp
node_securityclient -->|"sends tenant requests"| node_securityservice
node_scanapi -.->|"serves scan results"| node_sca
node_scanapi -.->|"serves scan results"| node_sast
node_scanapi -.->|"serves scan results"| node_infra
node_billing -.->|"creates checkout"| node_stripe

click node_webui "https://github.com/runtz-dev/runtz/tree/main/frontend/src/app/(platform)"
click node_proxy "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/api/%5B...path%5D/route.ts"
click node_overview "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/overview/page.tsx"
click node_scanviews "https://github.com/runtz-dev/runtz/tree/main/frontend/src/app/(platform)"
click node_cloudviews "https://github.com/runtz-dev/runtz/blob/main/frontend/src/components/runtz/cloud-pages.tsx"
click node_settings "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/settings/page.tsx"
click node_onboarding "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/onboarding/page.tsx"
click node_engine "https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/server.go"
click node_auth "https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/auth_email.go"
click node_workspace "https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/api_keys.go"
click node_billing "https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/billing.go"
click node_scanapi "https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/cloud_ingest.go"
click node_sca "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/sca/page.tsx"
click node_sast "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/sast/page.tsx"
click node_infra "https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/hosts/page.tsx"
click node_cloudapi "https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/cloud_ingest.go"
click node_gcp "https://github.com/runtz-dev/runtz/blob/main/engine/internal/cloudgcp/client.go"
click node_securityclient "https://github.com/runtz-dev/runtz/blob/main/engine/internal/securityclient/client.go"

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_webui,node_proxy,node_overview,node_scanviews,node_cloudviews,node_settings,node_onboarding,node_user toneBlue
class node_engine,node_auth,node_workspace,node_billing toneAmber
class node_scanapi,node_sca,node_sast,node_infra toneMint
class node_cloudapi,node_gcp,node_securityclient toneRose
class node_mongo,node_securityservice,node_stripe,node_scanner toneIndigo
```

## Components

### Platform experience

- [Web platform](https://github.com/runtz-dev/runtz/tree/main/frontend/src/app/(platform)): `frontend/src/app/(platform)`
- [API proxy](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/api/%5B...path%5D/route.ts): `frontend/src/app/api/[...path]/route.ts`
- [Overview dashboard](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/overview/page.tsx): `frontend/src/app/(platform)/overview/page.tsx`
- [Scan dashboards](https://github.com/runtz-dev/runtz/tree/main/frontend/src/app/(platform)): `frontend/src/app/(platform)`
- [Cloud setup and views](https://github.com/runtz-dev/runtz/blob/main/frontend/src/components/runtz/cloud-pages.tsx): `frontend/src/components/runtz/cloud-pages.tsx`
- [Workspace settings](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/settings/page.tsx): `frontend/src/app/(platform)/settings/page.tsx`
- [First-run setup](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/onboarding/page.tsx): `frontend/src/app/(platform)/onboarding/page.tsx`

### Engine and identity

- [HTTP engine](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/server.go): `engine/internal/api/server.go`
- [Authentication](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/auth_email.go): `engine/internal/api/auth_email.go`
- [Workspace and API keys](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/api_keys.go): `engine/internal/api/api_keys.go`
- [Plans and billing](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/billing.go): `engine/internal/api/billing.go`

### Scan results

- [Scan ingestion and queries](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/cloud_ingest.go): `engine/internal/api/cloud_ingest.go`
- [SCA results](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/sca/page.tsx): `frontend/src/app/(platform)/sca/page.tsx`
- [SAST results](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/sast/page.tsx): `frontend/src/app/(platform)/sast/page.tsx`
- [Host, container, Kubernetes](https://github.com/runtz-dev/runtz/blob/main/frontend/src/app/(platform)/hosts/page.tsx): `frontend/src/app/(platform)/hosts/page.tsx`

### Cloud security

- [Cloud scan ingestion](https://github.com/runtz-dev/runtz/blob/main/engine/internal/api/cloud_ingest.go): `engine/internal/api/cloud_ingest.go`
- [GCP credential validation](https://github.com/runtz-dev/runtz/blob/main/engine/internal/cloudgcp/client.go): `engine/internal/cloudgcp/client.go`
- [Security service client](https://github.com/runtz-dev/runtz/blob/main/engine/internal/securityclient/client.go): `engine/internal/securityclient/client.go`

### State and integrations

- **MongoDB**
- **Runtz Security service**
- **Stripe**

### Other components

- **Platform user**
- **Scanner CLI**

## Connections

- Platform user → Web platform: uses (evidence: `README.md`)
- Scanner CLI → Scan ingestion and queries: uploads scans (evidence: `README.md`)
- Web platform → API proxy: requests API (evidence: `frontend/src/app/api/[...path]/route.ts`)
- API proxy → HTTP engine: forwards requests (evidence: `frontend/src/app/api/[...path]/route.ts`)
- HTTP engine → MongoDB: connects and queries (evidence: `engine/internal/api/server.go`)
- HTTP engine → Authentication: handles identity
- HTTP engine → Workspace and API keys: handles workspace access
- HTTP engine → Plans and billing: handles billing
- Scan ingestion and queries → MongoDB: stores scan data
- Overview dashboard → API proxy: loads dashboard data
- Scan dashboards → API proxy: loads scan data
- Web platform → Overview dashboard: presents trends (evidence: `README.md`)
- Web platform → Scan dashboards: presents findings (evidence: `README.md`)
- Workspace settings → API proxy: manages workspaces (evidence: `frontend/src/app/(platform)/settings/page.tsx`)
- First-run setup → API proxy: creates workspace (evidence: `frontend/src/app/(platform)/onboarding/page.tsx`)
- Cloud setup and views → API proxy: manages cloud scans
- Cloud scan ingestion → Security service client: delegates security operations (evidence: `engine/internal/api/cloud_ingest.go`)
- Cloud scan ingestion → GCP credential validation: validates credentials
- Security service client → Runtz Security service: sends tenant requests (evidence: `engine/internal/securityclient/client.go`)
- Scan ingestion and queries → SCA results: serves scan results
- Scan ingestion and queries → SAST results: serves scan results
- Scan ingestion and queries → Host, container, Kubernetes: serves scan results
- Plans and billing → Stripe: creates checkout
