# forgemind-git/openforge-ai architecture

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

- Interactive diagram: https://gitdiagram.com/forgemind-git/openforge-ai
- Repository: https://github.com/forgemind-git/openforge-ai

## Overview

OpenForge AI is a self-hosted, multi-user assistant that brings tasks, calendar, mail, and WhatsApp/Telegram chats into an office dashboard. Users connect their own credentials, ask Forge by text or live voice to inspect data or prepare actions, then review and confirm drafts before anything is sent or changed. The graph separates the browser experience, server request and assistant flow, external integrations, and persistent state. Evidence is limited to the supplied excerpts, source index references, and README; unsampled implementation details are not inferred.

Main entry points: [`server/src/index.js`](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/index.js) (HTTP entry), [`server/src/integrations/google.js`](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/google.js) (Google services), [`web/src/pages/Office.jsx`](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Office.jsx) (Office dashboard), [`web/src/App.jsx`](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/App.jsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser experience"]
  node_webapp["App shell<br/>[App.jsx]"]
  node_office["Office dashboard<br/>[Office.jsx]"]
  node_sheets["Work cards<br/>[Sheets.jsx]"]
  node_settingsui["Settings page<br/>[Settings.jsx]"]
  node_authui["Sign-in page<br/>[AuthPage.jsx]"]
  node_apiclient["API client<br/>[api.js]"]
  node_apicontext["API context<br/>[apiContext.js]"]
  node_demo["Demo data<br/>[demo.js]"]
  node_briefui["Morning brief<br/>[MorningBrief.jsx]"]
  node_briefscript["Brief builder<br/>[brief.js]"]
  node_voicenarration["Voice narration<br/>[narration.js]"]
  node_livevoice["Live voice client<br/>[geminiLive.js]"]
end

subgraph group_server["Server workflow"]
  node_serverentry["HTTP entry<br/>[index.js]"]
  node_settingsroutes["Credential settings<br/>[settings.js]"]
  node_publicroutes["OAuth and webhooks<br/>[public.js]"]
  node_assistantroute["Assistant endpoint<br/>[assistant.js]"]
  node_liveassistant["Assistant runtime<br/>[live.js]"]
  node_tools["Assistant tools<br/>[tools.js]"]
  node_actions["Draft actions<br/>[actions.js]"]
  node_dataroutes["Work data routes<br/>[data.js]"]
end

subgraph group_integrations["External integrations"]
  node_llm["Model adapter<br/>[llm.js]"]
  node_google["Google services<br/>[google.js]"]
  node_messaging["Chat services<br/>[messaging.js]"]
end

subgraph group_persistence["Identity and state"]
  node_authroutes["Authentication<br/>[auth.js]"]
  node_store["Credential store<br/>[store.js]"]
  node_crypto["Secret encryption<br/>[crypto.js]"]
  node_database[("SQLite state<br/>[db.js]")]
end

node_user(("User"))
node_modelprovider{{"OpenAI or Anthropic"}}
node_googlecloud{{"Google APIs"}}
node_chatplatforms{{"WhatsApp and Telegram"}}

node_user -->|"uses"| node_webapp
node_webapp -->|"shows when signed out"| node_authui
node_webapp -->|"shows office"| node_office
node_webapp -->|"routes settings"| node_settingsui
node_office -->|"reads API context"| node_apicontext
node_apicontext -->|"provides"| node_apiclient
node_office -->|"opens work cards"| node_sheets
node_office -->|"uses sample data"| node_demo
node_office -->|"shows brief"| node_briefui
node_briefui -->|"builds script"| node_briefscript
node_briefui -->|"narrates"| node_voicenarration
node_voicenarration -->|"uses live voice"| node_livevoice
node_apiclient -->|"requests API"| node_serverentry
node_serverentry -->|"mounts auth routes"| node_authroutes
node_serverentry -->|"mounts public routes"| node_publicroutes
node_serverentry -->|"mounts settings routes"| node_settingsroutes
node_serverentry -->|"mounts assistant routes"| node_assistantroute
node_serverentry -->|"mounts data routes"| node_dataroutes
node_assistantroute -->|"calls model"| node_llm
node_assistantroute -->|"uses tools"| node_tools
node_serverentry -->|"attaches voice runtime"| node_liveassistant
node_liveassistant -->|"dispatches tools"| node_tools
node_liveassistant -->|"reads and writes"| node_database
node_liveassistant -->|"loads credentials"| node_store
node_tools -->|"reads Google data"| node_google
node_tools -->|"reads and drafts"| node_database
node_dataroutes -->|"confirms actions"| node_actions
node_dataroutes -->|"handles work data"| node_google
node_dataroutes -->|"handles chat data"| node_messaging
node_actions -->|"executes confirmed work"| node_google
node_actions -->|"sends confirmed replies"| node_messaging
node_settingsroutes -->|"saves credentials"| node_store
node_settingsroutes -->|"checks model key"| node_llm
node_settingsroutes -->|"starts OAuth"| node_google
node_publicroutes -->|"handles OAuth return"| node_google
node_publicroutes -->|"receives webhooks"| node_messaging
node_store -->|"persists settings"| node_database
node_store -->|"encrypts secrets"| node_crypto
node_authroutes -->|"reads user state"| node_database
node_llm -->|"calls model API"| node_modelprovider
node_google -->|"calls Google APIs"| node_googlecloud
node_messaging -->|"calls chat APIs"| node_chatplatforms

click node_webapp "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/App.jsx"
click node_office "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Office.jsx"
click node_sheets "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Sheets.jsx"
click node_settingsui "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Settings.jsx"
click node_authui "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/AuthPage.jsx"
click node_apiclient "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/api.js"
click node_apicontext "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/apiContext.js"
click node_demo "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/demo.js"
click node_briefui "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/components/MorningBrief.jsx"
click node_briefscript "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/brief.js"
click node_voicenarration "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/narration.js"
click node_livevoice "https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/geminiLive.js"
click node_serverentry "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/index.js"
click node_authroutes "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/auth.js"
click node_settingsroutes "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/settings.js"
click node_publicroutes "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/public.js"
click node_assistantroute "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/assistant.js"
click node_liveassistant "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/assistant/live.js"
click node_tools "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/assistant/tools.js"
click node_actions "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/assistant/actions.js"
click node_dataroutes "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/data.js"
click node_llm "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/llm.js"
click node_google "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/google.js"
click node_messaging "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/messaging.js"
click node_store "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/store.js"
click node_crypto "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/crypto.js"
click node_database "https://github.com/forgemind-git/openforge-ai/blob/main/server/src/db.js"

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_office,node_sheets,node_settingsui,node_authui,node_apiclient,node_apicontext,node_demo,node_briefui,node_briefscript,node_voicenarration,node_livevoice,node_user toneBlue
class node_serverentry,node_settingsroutes,node_publicroutes,node_assistantroute,node_liveassistant,node_tools,node_actions,node_dataroutes toneAmber
class node_llm,node_google,node_messaging,node_googlecloud toneMint
class node_authroutes,node_store,node_crypto,node_database toneRose
class node_modelprovider,node_chatplatforms toneIndigo
```

## Components

### Browser experience

- [App shell](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Office dashboard](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Office.jsx): `web/src/pages/Office.jsx`
- [Work cards](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Sheets.jsx): `web/src/pages/Sheets.jsx`
- [Settings page](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/Settings.jsx): `web/src/pages/Settings.jsx`
- [Sign-in page](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/pages/AuthPage.jsx): `web/src/pages/AuthPage.jsx`
- [API client](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/api.js): `web/src/api.js`
- [API context](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/apiContext.js): `web/src/lib/apiContext.js`
- [Demo data](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/demo.js): `web/src/lib/demo.js`
- [Morning brief](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/components/MorningBrief.jsx): `web/src/components/MorningBrief.jsx`
- [Brief builder](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/brief.js): `web/src/lib/brief.js`
- [Voice narration](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/narration.js): `web/src/lib/narration.js`
- [Live voice client](https://github.com/forgemind-git/openforge-ai/blob/main/web/src/lib/geminiLive.js): `web/src/lib/geminiLive.js`

### Server workflow

- [HTTP entry](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/index.js): `server/src/index.js`
- [Credential settings](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/settings.js): `server/src/routes/settings.js`
- [OAuth and webhooks](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/public.js): `server/src/routes/public.js`
- [Assistant endpoint](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/assistant.js): `server/src/routes/assistant.js`
- [Assistant runtime](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/assistant/live.js): `server/src/assistant/live.js`
- [Assistant tools](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/assistant/tools.js): `server/src/assistant/tools.js`
- [Draft actions](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/assistant/actions.js): `server/src/assistant/actions.js`
- [Work data routes](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/routes/data.js): `server/src/routes/data.js`

### External integrations

- [Model adapter](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/llm.js): `server/src/integrations/llm.js`
- [Google services](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/google.js): `server/src/integrations/google.js`
- [Chat services](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/integrations/messaging.js): `server/src/integrations/messaging.js`

### Identity and state

- [Authentication](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/auth.js): `server/src/auth.js`
- [Credential store](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/store.js): `server/src/store.js`
- [Secret encryption](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/crypto.js): `server/src/crypto.js`
- [SQLite state](https://github.com/forgemind-git/openforge-ai/blob/main/server/src/db.js): `server/src/db.js`

### Other components

- **User**
- **OpenAI or Anthropic**
- **Google APIs**
- **WhatsApp and Telegram**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Sign-in page: shows when signed out (evidence: `web/src/App.jsx`)
- App shell → Office dashboard: shows office (evidence: `web/src/App.jsx`)
- App shell → Settings page: routes settings (evidence: `web/src/App.jsx`)
- Office dashboard → API context: reads API context (evidence: `web/src/pages/Office.jsx`)
- API context → API client: provides (evidence: `web/src/lib/apiContext.js`)
- Office dashboard → Work cards: opens work cards (evidence: `web/src/pages/Office.jsx`)
- Office dashboard → Demo data: uses sample data (evidence: `web/src/pages/Office.jsx`)
- Office dashboard → Morning brief: shows brief (evidence: `web/src/pages/Office.jsx`)
- Morning brief → Brief builder: builds script (evidence: `web/src/components/MorningBrief.jsx`)
- Morning brief → Voice narration: narrates (evidence: `web/src/components/MorningBrief.jsx`)
- Voice narration → Live voice client: uses live voice (evidence: `web/src/lib/narration.js`)
- API client → HTTP entry: requests API (evidence: `web/src/api.js`)
- HTTP entry → Authentication: mounts auth routes (evidence: `server/src/index.js`)
- HTTP entry → OAuth and webhooks: mounts public routes (evidence: `server/src/index.js`)
- HTTP entry → Credential settings: mounts settings routes (evidence: `server/src/index.js`)
- HTTP entry → Assistant endpoint: mounts assistant routes (evidence: `server/src/index.js`)
- HTTP entry → Work data routes: mounts data routes (evidence: `server/src/index.js`)
- Assistant endpoint → Model adapter: calls model (evidence: `server/src/routes/assistant.js`)
- Assistant endpoint → Assistant tools: uses tools (evidence: `server/src/routes/assistant.js`)
- HTTP entry → Assistant runtime: attaches voice runtime (evidence: `server/src/index.js`)
- Assistant runtime → Assistant tools: dispatches tools (evidence: `server/src/assistant/live.js`)
- Assistant runtime → SQLite state: reads and writes (evidence: `server/src/assistant/live.js`)
- Assistant runtime → Credential store: loads credentials (evidence: `server/src/assistant/live.js`)
- Assistant tools → Google services: reads Google data (evidence: `server/src/assistant/tools.js`)
- Assistant tools → SQLite state: reads and drafts (evidence: `server/src/assistant/tools.js`)
- Work data routes → Draft actions: confirms actions (evidence: `server/src/routes/data.js`)
- Work data routes → Google services: handles work data (evidence: `server/src/routes/data.js`)
- Work data routes → Chat services: handles chat data (evidence: `server/src/routes/data.js`)
- Draft actions → Google services: executes confirmed work (evidence: `server/src/assistant/actions.js`)
- Draft actions → Chat services: sends confirmed replies (evidence: `server/src/assistant/actions.js`)
- Credential settings → Credential store: saves credentials (evidence: `server/src/routes/settings.js`)
- Credential settings → Model adapter: checks model key (evidence: `server/src/routes/settings.js`)
- Credential settings → Google services: starts OAuth (evidence: `server/src/routes/settings.js`)
- OAuth and webhooks → Google services: handles OAuth return (evidence: `server/src/routes/public.js`)
- OAuth and webhooks → Chat services: receives webhooks (evidence: `server/src/routes/public.js`)
- Credential store → SQLite state: persists settings (evidence: `server/src/store.js`)
- Credential store → Secret encryption: encrypts secrets (evidence: `server/src/store.js`)
- Authentication → SQLite state: reads user state (evidence: `server/src/auth.js`)
- Model adapter → OpenAI or Anthropic: calls model API (evidence: `README.md`)
- Google services → Google APIs: calls Google APIs (evidence: `server/src/integrations/google.js`)
- Chat services → WhatsApp and Telegram: calls chat APIs (evidence: `server/src/integrations/messaging.js`)
