# tgmstudios/orgflow architecture

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

## Overview

OrgFlow is an institutional-memory platform for nonprofits. The main workflow connects consented Google content, discovers recurring processes, drafts playbooks for human approval, and makes approved knowledge searchable, runnable, and transferable when staff leave. Web and iOS clients access organization workspaces and backend capabilities; PostgreSQL-backed storage persists organizational records. The graph preserves the documented Connect, Capture, Ask, and Transfer branches. Some links are based on README descriptions because the corresponding implementation excerpts were not provided.

Main entry points: [`backend/app.ts`](https://github.com/tgmstudios/orgflow/blob/main/backend/app.ts) (HTTP application), [`frontend/app.tsx`](https://github.com/tgmstudios/orgflow/blob/main/frontend/app.tsx) (Web workspace), [`backend/operations.ts`](https://github.com/tgmstudios/orgflow/blob/main/backend/operations.ts) (Knowledge operations), [`app/iOS/OrgFlow/Services/OrgFlowAPI.swift`](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Services/OrgFlowAPI.swift) (iOS API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Web workspace<br/>[app.tsx]"]
  node_webapi["Web API client<br/>[api.ts]"]
  node_discoverui["Discover UI<br/>[discover.tsx]"]
  node_indexui["Indexing UI<br/>[indexing.tsx]"]
  node_peopleui["People UI<br/>[people.tsx]"]
  node_mapui["Knowledge map<br/>[knowledge-map.tsx]"]
  node_clusterui["Cluster view<br/>[cluster-view.tsx]"]
  node_motion["Web motion layer<br/>[motion.tsx]"]
end

subgraph group_ios["iOS experience"]
  node_iosask["Ask and Capture"]
  node_iosapi["iOS API client<br/>[OrgFlowAPI.swift]"]
  node_ioslibrary["Playbook library"]
  node_ioschecklist["Checklist runs"]
  node_iosmap["iOS knowledge map"]
  node_iosperson["iOS people"]
  node_iosaudio["Voice capture"]
  node_theme["iOS design system"]
end

subgraph group_services["Backend services"]
  node_api["HTTP application<br/>[app.ts]"]
  node_google["Google connector<br/>[google.ts]"]
end

subgraph group_knowledge["Knowledge lifecycle"]
  node_operations["Knowledge operations<br/>[operations.ts]"]
  node_agent["Ask agent<br/>[agent.ts]"]
  node_retrieval["Evidence retrieval<br/>[retrieval.ts]"]
  node_health["Knowledge health<br/>[health.ts]"]
end

subgraph group_platform["Platform foundation"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_workspace["Workspace isolation<br/>[workspace.ts]"]
  node_store[("Record store<br/>[store.ts]")]
  node_billing["Usage and billing<br/>[monetization.ts]"]
end

node_staff(("Org staff"))
node_ai["Luminal AI"]
node_googlecloud["Google Drive and Gmail"]

node_staff -->|"uses workspace"| node_webapp
node_staff -->|"uses app"| node_iosask
node_webapp -->|"calls API"| node_webapi
node_webapp -->|"renders"| node_discoverui
node_webapp -->|"renders"| node_indexui
node_webapp -->|"renders"| node_peopleui
node_webapp -->|"renders"| node_mapui
node_clusterui -->|"loads data"| node_webapi
node_webapi -->|"sends requests"| node_api
node_iosask -->|"requests answers"| node_iosapi
node_iosaudio -.->|"provides voice input"| node_iosask
node_iosapi -->|"sends requests"| node_api
node_ioslibrary -->|"loads and publishes"| node_iosapi
node_ioslibrary -->|"starts runs"| node_ioschecklist
node_iosmap -->|"updates ownership"| node_iosapi
node_iosperson -->|"requests handoff"| node_iosapi
node_iosask -->|"uses styles"| node_theme
node_webapp -->|"uses animation"| node_motion
node_api -->|"authenticates"| node_auth
node_api -->|"routes workspace"| node_workspace
node_api -->|"delegates operations"| node_operations
node_api -->|"creates handler"| node_agent
node_api -->|"routes connector"| node_google
node_api -->|"checks and meters"| node_billing
node_auth -->|"reads and writes"| node_store
node_workspace -->|"reads and writes"| node_store
node_operations -->|"persists records"| node_store
node_operations -->|"searches evidence"| node_retrieval
node_operations -->|"drafts and transfers"| node_ai
node_agent -->|"searches and saves drafts"| node_operations
node_agent -->|"grounds answers"| node_retrieval
node_google -->|"reads consented content"| node_googlecloud
node_google -.->|"indexes sources"| node_store
node_health -.->|"assesses knowledge"| node_store
node_discoverui -->|"requests discovery"| node_operations
node_indexui -->|"starts indexing"| node_google
node_peopleui -->|"requests handoff"| node_operations
node_mapui -.->|"offers clusters"| node_clusterui

click node_webapp "https://github.com/tgmstudios/orgflow/blob/main/frontend/app.tsx"
click node_webapi "https://github.com/tgmstudios/orgflow/blob/main/frontend/api.ts"
click node_discoverui "https://github.com/tgmstudios/orgflow/blob/main/frontend/discover.tsx"
click node_indexui "https://github.com/tgmstudios/orgflow/blob/main/frontend/indexing.tsx"
click node_peopleui "https://github.com/tgmstudios/orgflow/blob/main/frontend/people.tsx"
click node_mapui "https://github.com/tgmstudios/orgflow/blob/main/frontend/knowledge-map.tsx"
click node_clusterui "https://github.com/tgmstudios/orgflow/blob/main/frontend/cluster-view.tsx"
click node_iosask "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Ask/AskViewController.swift"
click node_iosapi "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Services/OrgFlowAPI.swift"
click node_ioslibrary "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/ArticleViewController.swift"
click node_ioschecklist "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/ChecklistViewController.swift"
click node_iosmap "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/KnowledgeMapViewController.swift"
click node_iosperson "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/PersonViewController.swift"
click node_iosaudio "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Audio/MicrophoneCaptureController.swift"
click node_api "https://github.com/tgmstudios/orgflow/blob/main/backend/app.ts"
click node_auth "https://github.com/tgmstudios/orgflow/blob/main/backend/auth.ts"
click node_workspace "https://github.com/tgmstudios/orgflow/blob/main/backend/workspace.ts"
click node_store "https://github.com/tgmstudios/orgflow/blob/main/backend/store.ts"
click node_google "https://github.com/tgmstudios/orgflow/blob/main/backend/google.ts"
click node_operations "https://github.com/tgmstudios/orgflow/blob/main/backend/operations.ts"
click node_agent "https://github.com/tgmstudios/orgflow/blob/main/backend/agent.ts"
click node_retrieval "https://github.com/tgmstudios/orgflow/blob/main/backend/retrieval.ts"
click node_health "https://github.com/tgmstudios/orgflow/blob/main/backend/health.ts"
click node_billing "https://github.com/tgmstudios/orgflow/blob/main/backend/monetization.ts"
click node_theme "https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Theme/ContinuityTheme.swift"
click node_motion "https://github.com/tgmstudios/orgflow/blob/main/frontend/motion.tsx"

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_webapp,node_webapi,node_discoverui,node_indexui,node_peopleui,node_mapui,node_clusterui,node_motion toneBlue
class node_iosask,node_iosapi,node_ioslibrary,node_ioschecklist,node_iosmap,node_iosperson,node_iosaudio,node_theme toneAmber
class node_api,node_google toneMint
class node_operations,node_agent,node_retrieval,node_health toneRose
class node_auth,node_workspace,node_store,node_billing,node_staff,node_ai,node_googlecloud toneIndigo
```

## Components

### Web experience

- [Web workspace](https://github.com/tgmstudios/orgflow/blob/main/frontend/app.tsx): `frontend/app.tsx`
- [Web API client](https://github.com/tgmstudios/orgflow/blob/main/frontend/api.ts): `frontend/api.ts`
- [Discover UI](https://github.com/tgmstudios/orgflow/blob/main/frontend/discover.tsx): `frontend/discover.tsx`
- [Indexing UI](https://github.com/tgmstudios/orgflow/blob/main/frontend/indexing.tsx): `frontend/indexing.tsx`
- [People UI](https://github.com/tgmstudios/orgflow/blob/main/frontend/people.tsx): `frontend/people.tsx`
- [Knowledge map](https://github.com/tgmstudios/orgflow/blob/main/frontend/knowledge-map.tsx): `frontend/knowledge-map.tsx`
- [Cluster view](https://github.com/tgmstudios/orgflow/blob/main/frontend/cluster-view.tsx): `frontend/cluster-view.tsx`
- [Web motion layer](https://github.com/tgmstudios/orgflow/blob/main/frontend/motion.tsx): `frontend/motion.tsx`

### iOS experience

- [Ask and Capture](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Ask/AskViewController.swift): `app/iOS/OrgFlow/Ask/AskViewController.swift`
- [iOS API client](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Services/OrgFlowAPI.swift): `app/iOS/OrgFlow/Services/OrgFlowAPI.swift`
- [Playbook library](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/ArticleViewController.swift): `app/iOS/OrgFlow/Library/ArticleViewController.swift`
- [Checklist runs](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/ChecklistViewController.swift): `app/iOS/OrgFlow/Library/ChecklistViewController.swift`
- [iOS knowledge map](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/KnowledgeMapViewController.swift): `app/iOS/OrgFlow/Library/KnowledgeMapViewController.swift`
- [iOS people](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Library/PersonViewController.swift): `app/iOS/OrgFlow/Library/PersonViewController.swift`
- [Voice capture](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Audio/MicrophoneCaptureController.swift): `app/iOS/OrgFlow/Audio/MicrophoneCaptureController.swift`
- [iOS design system](https://github.com/tgmstudios/orgflow/blob/main/app/iOS/OrgFlow/Theme/ContinuityTheme.swift): `app/iOS/OrgFlow/Theme/ContinuityTheme.swift`

### Backend services

- [HTTP application](https://github.com/tgmstudios/orgflow/blob/main/backend/app.ts): `backend/app.ts`
- [Google connector](https://github.com/tgmstudios/orgflow/blob/main/backend/google.ts): `backend/google.ts`

### Knowledge lifecycle

- [Knowledge operations](https://github.com/tgmstudios/orgflow/blob/main/backend/operations.ts): `backend/operations.ts`
- [Ask agent](https://github.com/tgmstudios/orgflow/blob/main/backend/agent.ts): `backend/agent.ts`
- [Evidence retrieval](https://github.com/tgmstudios/orgflow/blob/main/backend/retrieval.ts): `backend/retrieval.ts`
- [Knowledge health](https://github.com/tgmstudios/orgflow/blob/main/backend/health.ts): `backend/health.ts`

### Platform foundation

- [Authentication](https://github.com/tgmstudios/orgflow/blob/main/backend/auth.ts): `backend/auth.ts`
- [Workspace isolation](https://github.com/tgmstudios/orgflow/blob/main/backend/workspace.ts): `backend/workspace.ts`
- [Record store](https://github.com/tgmstudios/orgflow/blob/main/backend/store.ts): `backend/store.ts`
- [Usage and billing](https://github.com/tgmstudios/orgflow/blob/main/backend/monetization.ts): `backend/monetization.ts`

### Other components

- **Org staff**
- **Luminal AI**
- **Google Drive and Gmail**

## Connections

- Org staff → Web workspace: uses workspace (evidence: `README.md`)
- Org staff → Ask and Capture: uses app (evidence: `README.md`)
- Web workspace → Web API client: calls API (evidence: `frontend/app.tsx`)
- Web workspace → Discover UI: renders (evidence: `frontend/app.tsx`)
- Web workspace → Indexing UI: renders (evidence: `frontend/app.tsx`)
- Web workspace → People UI: renders (evidence: `frontend/app.tsx`)
- Web workspace → Knowledge map: renders (evidence: `frontend/app.tsx`)
- Cluster view → Web API client: loads data (evidence: `frontend/cluster-view.tsx`)
- Web API client → HTTP application: sends requests (evidence: `README.md`)
- Ask and Capture → iOS API client: requests answers (evidence: `app/iOS/OrgFlow/Ask/AskViewController.swift`)
- Voice capture → Ask and Capture: provides voice input
- iOS API client → HTTP application: sends requests (evidence: `README.md`)
- Playbook library → iOS API client: loads and publishes (evidence: `app/iOS/OrgFlow/Library/ArticleViewController.swift`)
- Playbook library → Checklist runs: starts runs (evidence: `app/iOS/OrgFlow/Library/ArticleViewController.swift`)
- iOS knowledge map → iOS API client: updates ownership (evidence: `app/iOS/OrgFlow/Library/KnowledgeMapViewController.swift`)
- iOS people → iOS API client: requests handoff (evidence: `app/iOS/OrgFlow/Services/OrgFlowAPI.swift`)
- Ask and Capture → iOS design system: uses styles (evidence: `app/iOS/OrgFlow/Ask/AskViewController.swift`)
- Web workspace → Web motion layer: uses animation (evidence: `frontend/app.tsx`)
- HTTP application → Authentication: authenticates (evidence: `backend/app.ts`)
- HTTP application → Workspace isolation: routes workspace (evidence: `backend/app.ts`)
- HTTP application → Knowledge operations: delegates operations (evidence: `backend/app.ts`)
- HTTP application → Ask agent: creates handler (evidence: `backend/app.ts`)
- HTTP application → Google connector: routes connector (evidence: `backend/app.ts`)
- HTTP application → Usage and billing: checks and meters (evidence: `backend/app.ts`)
- Authentication → Record store: reads and writes (evidence: `backend/auth.ts`)
- Workspace isolation → Record store: reads and writes (evidence: `backend/workspace.ts`)
- Knowledge operations → Record store: persists records (evidence: `backend/operations.ts`)
- Knowledge operations → Evidence retrieval: searches evidence (evidence: `backend/operations.ts`)
- Knowledge operations → Luminal AI: drafts and transfers (evidence: `backend/operations.ts`)
- Ask agent → Knowledge operations: searches and saves drafts (evidence: `backend/app.ts`)
- Ask agent → Evidence retrieval: grounds answers (evidence: `README.md`)
- Google connector → Google Drive and Gmail: reads consented content (evidence: `README.md`)
- Google connector → Record store: indexes sources
- Knowledge health → Record store: assesses knowledge
- Discover UI → Knowledge operations: requests discovery (evidence: `README.md`)
- Indexing UI → Google connector: starts indexing (evidence: `README.md`)
- People UI → Knowledge operations: requests handoff (evidence: `README.md`)
- Knowledge map → Cluster view: offers clusters
