# albinjacob/munitas architecture

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

- Interactive diagram: https://gitdiagram.com/albinjacob/munitas
- Repository: https://github.com/albinjacob/munitas

## Overview

Munitas is a self-hosted governance platform for datasets, AI agents, and pipelines. Its main user flow is to register and seal an artifact, request or grant purpose-bound access where needed, run a pipeline, then record an independent gate decision on its output. The console calls the control-plane API; the API coordinates persistence, policy checks, storage, and durable worker execution. The README documents the common governance model and OPA checks; worker and several feature modules are indexed but not excerpted, so their internal links are omitted where not evidenced.

Main entry points: [`platform/api/app/main.py`](https://github.com/albinjacob/munitas/blob/main/platform/api/app/main.py) (Control-plane API), [`worker/main.py`](https://github.com/albinjacob/munitas/blob/main/worker/main.py) (Worker service), [`platform/api/app/pipeline.py`](https://github.com/albinjacob/munitas/blob/main/platform/api/app/pipeline.py) (Run coordination), [`web/src/App.tsx`](https://github.com/albinjacob/munitas/blob/main/web/src/App.tsx) (Web console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["User console"]
  node_console_ui["Web console<br/>[App.tsx]"]
  node_identity_ui["Identity session"]
  node_pipeline_ui["Run monitor<br/>[PipelineRun.tsx]"]
  node_pipeline_api_ui["Pipeline API client<br/>[pipeline.ts]"]
  node_dag_ui["DAG pipeline client<br/>[dag_pipelines.ts]"]
end

subgraph group_governance["Governance control plane"]
  node_control_api["Control-plane API<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_policy["Policy evaluation<br/>[opa.py]"]
  node_grant_access["Grants and leases<br/>[grants.py]"]
  node_dataset_ingest["Dataset registration<br/>[ingest.py]"]
  node_versions["Sealed versions<br/>[versions.py]"]
  node_agent_registry["Agent registry<br/>[agents.py]"]
  node_dag_registry["Pipeline registry<br/>[dag_pipelines.py]"]
  node_run_api["Run coordination<br/>[pipeline.py]"]
  node_gate["Human gate decision<br/>[pipeline.py]"]
end

subgraph group_execution["Pipeline execution"]
  node_worker["Worker service<br/>[main.py]"]
  node_workflows["Workflow orchestration<br/>[workflows.py]"]
  node_dag_workflow["DAG execution<br/>[dag_workflow.py]"]
  node_agent_runtime["Agent run execution"]
end

subgraph group_platform["Platform services"]
  node_postgres[("Platform database<br/>[db.py]")]
  node_storage["Object storage<br/>[storage.py]"]
  node_seaweed["SeaweedFS grants<br/>[seaweed.py]"]
  node_temporal["Workflow service<br/>[temporal_client.py]"]
end

node_operator(("Operator"))
node_opa_service["OPA service"]

node_operator -->|"uses"| node_console_ui
node_console_ui -->|"establishes identity"| node_identity_ui
node_console_ui -->|"monitors runs"| node_pipeline_ui
node_pipeline_ui -->|"requests run data"| node_pipeline_api_ui
node_pipeline_api_ui -.->|"calls API"| node_control_api
node_dag_ui -->|"registers pipelines"| node_control_api
node_operator -->|"registers data"| node_dataset_ingest
node_operator -->|"registers agent"| node_agent_registry
node_operator -->|"registers pipeline"| node_dag_registry
node_control_api -->|"authenticates requests"| node_auth
node_control_api -->|"checks policy"| node_policy
node_control_api -->|"reads and writes"| node_postgres
node_dataset_ingest -.->|"stores content"| node_storage
node_storage -->|"selects backend"| node_seaweed
node_grant_access -->|"applies prefix grants"| node_seaweed
node_run_api -->|"starts workflows"| node_temporal
node_run_api -->|"records run"| node_postgres
node_temporal -.->|"dispatches work"| node_worker
node_worker -->|"registers workflows"| node_workflows
node_worker -->|"registers workflows"| node_dag_workflow
node_worker -->|"registers workflows"| node_agent_runtime
node_run_api -->|"uses sealed definition"| node_dag_registry
node_workflows -.->|"ends at gate"| node_gate
node_dag_workflow -->|"ends at gate"| node_gate
node_agent_runtime -->|"requires readiness decision"| node_gate
node_policy -->|"evaluates requests"| node_opa_service

click node_console_ui "https://github.com/albinjacob/munitas/blob/main/web/src/App.tsx"
click node_identity_ui "https://github.com/albinjacob/munitas/blob/main/web/src/identity/IdentityContext.tsx"
click node_pipeline_ui "https://github.com/albinjacob/munitas/blob/main/web/src/features/pipeline/PipelineRun.tsx"
click node_pipeline_api_ui "https://github.com/albinjacob/munitas/blob/main/web/src/api/pipeline.ts"
click node_dag_ui "https://github.com/albinjacob/munitas/blob/main/web/src/api/dag_pipelines.ts"
click node_control_api "https://github.com/albinjacob/munitas/blob/main/platform/api/app/main.py"
click node_auth "https://github.com/albinjacob/munitas/blob/main/platform/api/app/auth.py"
click node_policy "https://github.com/albinjacob/munitas/blob/main/platform/api/app/opa.py"
click node_grant_access "https://github.com/albinjacob/munitas/blob/main/platform/api/app/grants.py"
click node_dataset_ingest "https://github.com/albinjacob/munitas/blob/main/platform/api/app/ingest.py"
click node_versions "https://github.com/albinjacob/munitas/blob/main/platform/api/app/versions.py"
click node_agent_registry "https://github.com/albinjacob/munitas/blob/main/platform/api/app/agents.py"
click node_dag_registry "https://github.com/albinjacob/munitas/blob/main/platform/api/app/dag_pipelines.py"
click node_run_api "https://github.com/albinjacob/munitas/blob/main/platform/api/app/pipeline.py"
click node_postgres "https://github.com/albinjacob/munitas/blob/main/platform/api/app/db.py"
click node_storage "https://github.com/albinjacob/munitas/blob/main/platform/api/app/storage.py"
click node_seaweed "https://github.com/albinjacob/munitas/blob/main/platform/api/app/seaweed.py"
click node_temporal "https://github.com/albinjacob/munitas/blob/main/platform/api/app/temporal_client.py"
click node_worker "https://github.com/albinjacob/munitas/blob/main/worker/main.py"
click node_workflows "https://github.com/albinjacob/munitas/blob/main/worker/workflows.py"
click node_dag_workflow "https://github.com/albinjacob/munitas/blob/main/worker/dag_workflow.py"
click node_agent_runtime "https://github.com/albinjacob/munitas/blob/main/worker/agent_run_workflow.py"
click node_gate "https://github.com/albinjacob/munitas/blob/main/platform/api/app/pipeline.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_console_ui,node_identity_ui,node_pipeline_ui,node_pipeline_api_ui,node_dag_ui toneBlue
class node_control_api,node_auth,node_policy,node_grant_access,node_dataset_ingest,node_versions,node_agent_registry,node_dag_registry,node_run_api,node_gate toneAmber
class node_worker,node_workflows,node_dag_workflow,node_agent_runtime toneMint
class node_postgres,node_storage,node_seaweed,node_temporal toneRose
class node_operator,node_opa_service toneIndigo
```

## Components

### User console

- [Web console](https://github.com/albinjacob/munitas/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Identity session](https://github.com/albinjacob/munitas/blob/main/web/src/identity/IdentityContext.tsx): `web/src/identity/IdentityContext.tsx`
- [Run monitor](https://github.com/albinjacob/munitas/blob/main/web/src/features/pipeline/PipelineRun.tsx): `web/src/features/pipeline/PipelineRun.tsx`
- [Pipeline API client](https://github.com/albinjacob/munitas/blob/main/web/src/api/pipeline.ts): `web/src/api/pipeline.ts`
- [DAG pipeline client](https://github.com/albinjacob/munitas/blob/main/web/src/api/dag_pipelines.ts): `web/src/api/dag_pipelines.ts`

### Governance control plane

- [Control-plane API](https://github.com/albinjacob/munitas/blob/main/platform/api/app/main.py): `platform/api/app/main.py`
- [Authentication](https://github.com/albinjacob/munitas/blob/main/platform/api/app/auth.py): `platform/api/app/auth.py`
- [Policy evaluation](https://github.com/albinjacob/munitas/blob/main/platform/api/app/opa.py): `platform/api/app/opa.py`
- [Grants and leases](https://github.com/albinjacob/munitas/blob/main/platform/api/app/grants.py): `platform/api/app/grants.py`
- [Dataset registration](https://github.com/albinjacob/munitas/blob/main/platform/api/app/ingest.py): `platform/api/app/ingest.py`
- [Sealed versions](https://github.com/albinjacob/munitas/blob/main/platform/api/app/versions.py): `platform/api/app/versions.py`
- [Agent registry](https://github.com/albinjacob/munitas/blob/main/platform/api/app/agents.py): `platform/api/app/agents.py`
- [Pipeline registry](https://github.com/albinjacob/munitas/blob/main/platform/api/app/dag_pipelines.py): `platform/api/app/dag_pipelines.py`
- [Run coordination](https://github.com/albinjacob/munitas/blob/main/platform/api/app/pipeline.py): `platform/api/app/pipeline.py`
- [Human gate decision](https://github.com/albinjacob/munitas/blob/main/platform/api/app/pipeline.py): `platform/api/app/pipeline.py`

### Pipeline execution

- [Worker service](https://github.com/albinjacob/munitas/blob/main/worker/main.py): `worker/main.py`
- [Workflow orchestration](https://github.com/albinjacob/munitas/blob/main/worker/workflows.py): `worker/workflows.py`
- [DAG execution](https://github.com/albinjacob/munitas/blob/main/worker/dag_workflow.py): `worker/dag_workflow.py`
- [Agent run execution](https://github.com/albinjacob/munitas/blob/main/worker/agent_run_workflow.py): `worker/agent_run_workflow.py`

### Platform services

- [Platform database](https://github.com/albinjacob/munitas/blob/main/platform/api/app/db.py): `platform/api/app/db.py`
- [Object storage](https://github.com/albinjacob/munitas/blob/main/platform/api/app/storage.py): `platform/api/app/storage.py`
- [SeaweedFS grants](https://github.com/albinjacob/munitas/blob/main/platform/api/app/seaweed.py): `platform/api/app/seaweed.py`
- [Workflow service](https://github.com/albinjacob/munitas/blob/main/platform/api/app/temporal_client.py): `platform/api/app/temporal_client.py`

### Other components

- **Operator**
- **OPA service**

## Connections

- Operator → Web console: uses
- Web console → Identity session: establishes identity (evidence: `web/src/App.tsx`)
- Web console → Run monitor: monitors runs (evidence: `web/src/App.tsx`)
- Run monitor → Pipeline API client: requests run data (evidence: `web/src/features/pipeline/PipelineRun.tsx`)
- Pipeline API client → Control-plane API: calls API
- DAG pipeline client → Control-plane API: registers pipelines (evidence: `web/src/api/dag_pipelines.ts`)
- Operator → Dataset registration: registers data
- Operator → Agent registry: registers agent
- Operator → Pipeline registry: registers pipeline
- Control-plane API → Authentication: authenticates requests (evidence: `platform/api/app/auth.py`)
- Control-plane API → Policy evaluation: checks policy
- Control-plane API → Platform database: reads and writes (evidence: `platform/api/app/db.py`)
- Dataset registration → Object storage: stores content
- Object storage → SeaweedFS grants: selects backend (evidence: `platform/api/app/storage.py`)
- Grants and leases → SeaweedFS grants: applies prefix grants (evidence: `platform/api/app/seaweed.py`)
- Run coordination → Workflow service: starts workflows (evidence: `platform/api/app/pipeline.py`)
- Run coordination → Platform database: records run (evidence: `platform/api/app/pipeline.py`)
- Workflow service → Worker service: dispatches work
- Worker service → Workflow orchestration: registers workflows (evidence: `worker/main.py`)
- Worker service → DAG execution: registers workflows (evidence: `worker/main.py`)
- Worker service → Agent run execution: registers workflows (evidence: `worker/main.py`)
- Run coordination → Pipeline registry: uses sealed definition (evidence: `platform/api/app/dag_pipelines.py`)
- Workflow orchestration → Human gate decision: ends at gate
- DAG execution → Human gate decision: ends at gate
- Agent run execution → Human gate decision: requires readiness decision
- Policy evaluation → OPA service: evaluates requests
