# tvolodi/letflow architecture

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

- Interactive diagram: https://gitdiagram.com/tvolodi/letflow
- Repository: https://github.com/tvolodi/letflow

## Overview

Letflow is a multi-tenant BPM platform: users define processes, then run and manage definition-driven instances through an HTTP API and a React SPA. The README says the SPA’s API integration is not yet end-to-end, so the graph keeps it separate from the backend rather than implying a working request path. The backend’s engine, definition, and API surfaces are represented alongside documented capabilities such as identity, entities, exam modules, and webhooks. Mobile behavior is described in the README, but its application sources are absent from the supplied tree; only native shell files are shown.

Main entry points: [`lib/letflow/api/authorized_router.ex`](https://github.com/tvolodi/letflow/blob/main/lib/letflow/api/authorized_router.ex) (HTTP API), [`web/src/main.tsx`](https://github.com/tvolodi/letflow/blob/main/web/src/main.tsx) (React SPA), [`web/src/auth/AuthProvider.tsx`](https://github.com/tvolodi/letflow/blob/main/web/src/auth/AuthProvider.tsx) (Web authentication), [`lib/letflow/engine.ex`](https://github.com/tvolodi/letflow/blob/main/lib/letflow/engine.ex) (Instance engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_spa["React SPA<br/>[main.tsx]"]
  node_auth["Web authentication<br/>[AuthProvider.tsx]"]
  node_tenant_config["Tenant OIDC config<br/>[tenantConfig.ts]"]
  node_process_ui["Process editor<br/>[ProcessCanvas.tsx]"]
  node_exam_ui["Exam experience"]
end

subgraph group_backend["Workflow backend"]
  node_api["HTTP API"]
  node_definitions["Process definitions"]
  node_engine["Instance engine<br/>[engine.ex]"]
end

subgraph group_domains["Platform domains"]
  node_identity["Tenant identity<br/>[identity.ex]"]
  node_entities["Entity records<br/>[records.ex]"]
  node_exam_backend["Exam module<br/>[router.ex]"]
  node_webhooks["Webhook delivery<br/>[webhooks.ex]"]
  node_audit["Audit trail<br/>[audit.ex]"]
end

subgraph group_runtime["Runtime infrastructure"]
  node_event_store[("Event store<br/>[event_store.ex]")]
  node_app_runtime["OTP application<br/>[application.ex]"]
end

node_user(("Tenant user"))
node_db[("PostgreSQL")]
node_oidc["OIDC provider"]

node_user -->|"uses"| node_spa
node_spa -->|"mounts"| node_auth
node_spa -.->|"renders"| node_process_ui
node_spa -.->|"routes to"| node_exam_ui
node_auth -->|"resolves config"| node_tenant_config
node_tenant_config -.->|"requests config"| node_api
node_auth -.->|"authenticates"| node_oidc
node_user -->|"calls"| node_api
node_api -.->|"manages"| node_definitions
node_api -.->|"starts instances"| node_engine
node_engine -.->|"records events"| node_event_store
node_api -.->|"authorizes tenants"| node_identity
node_api -.->|"serves records"| node_entities
node_api -.->|"routes exam"| node_exam_backend
node_api -.->|"manages deliveries"| node_webhooks
node_engine -.->|"audits actions"| node_audit
node_app_runtime -.->|"starts HTTP"| node_api
node_event_store -.->|"persists"| node_db

click node_spa "https://github.com/tvolodi/letflow/blob/main/web/src/main.tsx"
click node_auth "https://github.com/tvolodi/letflow/blob/main/web/src/auth/AuthProvider.tsx"
click node_tenant_config "https://github.com/tvolodi/letflow/blob/main/web/src/auth/tenantConfig.ts"
click node_process_ui "https://github.com/tvolodi/letflow/blob/main/web/src/components/canvas/ProcessCanvas.tsx"
click node_exam_ui "https://github.com/tvolodi/letflow/blob/main/web/src/modules/exam/ExamSessionPage.tsx"
click node_api "https://github.com/tvolodi/letflow/blob/main/lib/letflow/api/authorized_router.ex"
click node_definitions "https://github.com/tvolodi/letflow/blob/main/lib/letflow/definitions/process_definition.ex"
click node_engine "https://github.com/tvolodi/letflow/blob/main/lib/letflow/engine.ex"
click node_event_store "https://github.com/tvolodi/letflow/blob/main/lib/letflow/event_store.ex"
click node_identity "https://github.com/tvolodi/letflow/blob/main/lib/letflow/identity.ex"
click node_entities "https://github.com/tvolodi/letflow/blob/main/lib/letflow/entities/records.ex"
click node_exam_backend "https://github.com/tvolodi/letflow/blob/main/lib/letflow/modules/exam/router.ex"
click node_webhooks "https://github.com/tvolodi/letflow/blob/main/lib/letflow/webhooks.ex"
click node_audit "https://github.com/tvolodi/letflow/blob/main/lib/letflow/audit.ex"
click node_app_runtime "https://github.com/tvolodi/letflow/blob/main/lib/letflow/application.ex"

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_spa,node_auth,node_tenant_config,node_process_ui,node_exam_ui,node_user toneBlue
class node_api,node_definitions,node_engine,node_db toneAmber
class node_identity,node_entities,node_exam_backend,node_webhooks,node_audit toneMint
class node_event_store,node_app_runtime toneRose
class node_oidc toneIndigo
```

## Components

### User experience

- [React SPA](https://github.com/tvolodi/letflow/blob/main/web/src/main.tsx): `web/src/main.tsx`
- [Web authentication](https://github.com/tvolodi/letflow/blob/main/web/src/auth/AuthProvider.tsx): `web/src/auth/AuthProvider.tsx`
- [Tenant OIDC config](https://github.com/tvolodi/letflow/blob/main/web/src/auth/tenantConfig.ts): `web/src/auth/tenantConfig.ts`
- [Process editor](https://github.com/tvolodi/letflow/blob/main/web/src/components/canvas/ProcessCanvas.tsx): `web/src/components/canvas/ProcessCanvas.tsx`
- [Exam experience](https://github.com/tvolodi/letflow/blob/main/web/src/modules/exam/ExamSessionPage.tsx): `web/src/modules/exam/ExamSessionPage.tsx`

### Workflow backend

- [HTTP API](https://github.com/tvolodi/letflow/blob/main/lib/letflow/api/authorized_router.ex): `lib/letflow/api/authorized_router.ex`
- [Process definitions](https://github.com/tvolodi/letflow/blob/main/lib/letflow/definitions/process_definition.ex): `lib/letflow/definitions/process_definition.ex`
- [Instance engine](https://github.com/tvolodi/letflow/blob/main/lib/letflow/engine.ex): `lib/letflow/engine.ex`

### Platform domains

- [Tenant identity](https://github.com/tvolodi/letflow/blob/main/lib/letflow/identity.ex): `lib/letflow/identity.ex`
- [Entity records](https://github.com/tvolodi/letflow/blob/main/lib/letflow/entities/records.ex): `lib/letflow/entities/records.ex`
- [Exam module](https://github.com/tvolodi/letflow/blob/main/lib/letflow/modules/exam/router.ex): `lib/letflow/modules/exam/router.ex`
- [Webhook delivery](https://github.com/tvolodi/letflow/blob/main/lib/letflow/webhooks.ex): `lib/letflow/webhooks.ex`
- [Audit trail](https://github.com/tvolodi/letflow/blob/main/lib/letflow/audit.ex): `lib/letflow/audit.ex`

### Runtime infrastructure

- [Event store](https://github.com/tvolodi/letflow/blob/main/lib/letflow/event_store.ex): `lib/letflow/event_store.ex`
- [OTP application](https://github.com/tvolodi/letflow/blob/main/lib/letflow/application.ex): `lib/letflow/application.ex`

### Other components

- **Tenant user**
- **PostgreSQL**
- **OIDC provider**

## Connections

- Tenant user → React SPA: uses (evidence: `README.md`)
- React SPA → Web authentication: mounts (evidence: `web/src/main.tsx`)
- React SPA → Process editor: renders
- React SPA → Exam experience: routes to
- Web authentication → Tenant OIDC config: resolves config (evidence: `web/src/auth/AuthProvider.tsx`)
- Tenant OIDC config → HTTP API: requests config
- Web authentication → OIDC provider: authenticates
- Tenant user → HTTP API: calls (evidence: `README.md`)
- HTTP API → Process definitions: manages
- HTTP API → Instance engine: starts instances
- Instance engine → Event store: records events
- HTTP API → Tenant identity: authorizes tenants
- HTTP API → Entity records: serves records
- HTTP API → Exam module: routes exam
- HTTP API → Webhook delivery: manages deliveries
- Instance engine → Audit trail: audits actions
- OTP application → HTTP API: starts HTTP
- Event store → PostgreSQL: persists
