# gitbot-hq/gitbot architecture

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

- Interactive diagram: https://gitdiagram.com/gitbot-hq/gitbot
- Repository: https://github.com/gitbot-hq/gitbot

## Overview

GitBot is a local web workspace for running Claude Code, Codex, or OpenCode through reusable bots and persistent threads. The main workflow is to configure a bot, choose a repository, send a task, and follow the agent’s streamed conversation and permission requests. The product also supports repository browsing, setup runs, bot sharing, and Marketplace discovery and publishing. Several UI and route implementations are unsampled; those areas are represented at their known module paths, and uncertain connections are omitted.

Main entry points: [`src/bot-routes.ts`](https://github.com/gitbot-hq/gitbot/blob/main/src/bot-routes.ts) (Bot and thread routes), [`src/server.ts`](https://github.com/gitbot-hq/gitbot/blob/main/src/server.ts) (HTTP server), [`src/start-claude-code.ts`](https://github.com/gitbot-hq/gitbot/blob/main/src/start-claude-code.ts) (Claude Code runner), [`src/start-codex.ts`](https://github.com/gitbot-hq/gitbot/blob/main/src/start-codex.ts) (Codex runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Local runtime"]
  node_server["HTTP server<br/>[server.ts]"]
  node_common["Server services<br/>[server-common.ts]"]
  node_workspace["Repository workspace<br/>[workspace.ts]"]
  node_static["UI file serving<br/>[static-ui.ts]"]
end

subgraph group_work["Bots and work"]
  node_botroutes["Bot and thread routes<br/>[bot-routes.ts]"]
  node_botstore[("Bot and thread store<br/>[bot-store.ts]")]
  node_prompt["Prompt and setup logic<br/>[bot-prompt.ts]"]
  node_claude["Claude Code runner"]
  node_codex["Codex runner<br/>[start-codex.ts]"]
  node_opencode["OpenCode runner<br/>[start-opencode.ts]"]
end

subgraph group_ui["Workspace UI"]
  node_shell["GitBot workspace<br/>[app-shell.tsx]"]
  node_api["Browser API client<br/>[api.ts]"]
  node_onboarding["Bot onboarding"]
end

subgraph group_sharing["Sharing and marketplace"]
  node_marketpage["Marketplace interface<br/>[page.tsx]"]
  node_marketlib["Marketplace client<br/>[marketplace.ts]"]
  node_marketproxy["Marketplace proxy"]
  node_share["Bot sharing<br/>[share.ts]"]
end

node_user(("User"))
node_browser(("Browser"))
node_agents{{"Installed coding agents"}}
node_marketservice{{"Marketplace service"}}

node_user -->|"uses"| node_browser
node_browser -->|"sends requests"| node_server
node_server -->|"uses services"| node_common
node_server -->|"dispatches bot routes"| node_botroutes
node_server -->|"dispatches marketplace routes"| node_marketproxy
node_common -->|"calls repository functions"| node_workspace
node_common -->|"serves UI files"| node_static
node_botroutes -->|"reads and updates"| node_botstore
node_botroutes -->|"loads transcripts"| node_claude
node_botroutes -->|"loads transcripts"| node_codex
node_botroutes -->|"loads history"| node_opencode
node_claude -->|"uses bot state"| node_botstore
node_codex -->|"uses bot state"| node_botstore
node_opencode -->|"binds sessions"| node_botstore
node_claude -->|"uses prompt logic"| node_prompt
node_codex -->|"uses prompt logic"| node_prompt
node_opencode -->|"uses prompt logic"| node_prompt
node_claude -.->|"runs agent"| node_agents
node_codex -.->|"runs agent"| node_agents
node_opencode -.->|"runs agent"| node_agents
node_browser -->|"uses workspace"| node_shell
node_shell -.->|"requests server data"| node_api
node_onboarding -.->|"configures bots"| node_api
node_marketpage -->|"uses marketplace client"| node_marketlib
node_marketlib -.->|"requests listings"| node_marketproxy
node_marketproxy -->|"proxies requests"| node_marketservice
node_marketpage -.->|"offers bot sharing"| node_share

click node_server "https://github.com/gitbot-hq/gitbot/blob/main/src/server.ts"
click node_common "https://github.com/gitbot-hq/gitbot/blob/main/src/server-common.ts"
click node_workspace "https://github.com/gitbot-hq/gitbot/blob/main/src/workspace.ts"
click node_static "https://github.com/gitbot-hq/gitbot/blob/main/src/static-ui.ts"
click node_botroutes "https://github.com/gitbot-hq/gitbot/blob/main/src/bot-routes.ts"
click node_botstore "https://github.com/gitbot-hq/gitbot/blob/main/src/bot-store.ts"
click node_prompt "https://github.com/gitbot-hq/gitbot/blob/main/src/bot-prompt.ts"
click node_claude "https://github.com/gitbot-hq/gitbot/blob/main/src/start-claude-code.ts"
click node_codex "https://github.com/gitbot-hq/gitbot/blob/main/src/start-codex.ts"
click node_opencode "https://github.com/gitbot-hq/gitbot/blob/main/src/start-opencode.ts"
click node_shell "https://github.com/gitbot-hq/gitbot/blob/main/ui/app/components/app-shell.tsx"
click node_api "https://github.com/gitbot-hq/gitbot/blob/main/ui/app/lib/api.ts"
click node_onboarding "https://github.com/gitbot-hq/gitbot/blob/main/ui/app/components/onboarding-flow.tsx"
click node_marketpage "https://github.com/gitbot-hq/gitbot/blob/main/ui/app/marketplace/page.tsx"
click node_marketlib "https://github.com/gitbot-hq/gitbot/blob/main/ui/app/lib/marketplace.ts"
click node_marketproxy "https://github.com/gitbot-hq/gitbot/blob/main/src/marketplace-proxy.ts"
click node_share "https://github.com/gitbot-hq/gitbot/blob/main/ui/app/lib/share.ts"

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_server,node_common,node_workspace,node_static,node_user,node_browser toneBlue
class node_botroutes,node_botstore,node_prompt,node_claude,node_codex,node_opencode toneAmber
class node_shell,node_api,node_onboarding toneMint
class node_marketpage,node_marketlib,node_marketproxy,node_share toneRose
class node_agents,node_marketservice toneIndigo
```

## Components

### Local runtime

- [HTTP server](https://github.com/gitbot-hq/gitbot/blob/main/src/server.ts): `src/server.ts`
- [Server services](https://github.com/gitbot-hq/gitbot/blob/main/src/server-common.ts): `src/server-common.ts`
- [Repository workspace](https://github.com/gitbot-hq/gitbot/blob/main/src/workspace.ts): `src/workspace.ts`
- [UI file serving](https://github.com/gitbot-hq/gitbot/blob/main/src/static-ui.ts): `src/static-ui.ts`

### Bots and work

- [Bot and thread routes](https://github.com/gitbot-hq/gitbot/blob/main/src/bot-routes.ts): `src/bot-routes.ts`
- [Bot and thread store](https://github.com/gitbot-hq/gitbot/blob/main/src/bot-store.ts): `src/bot-store.ts`
- [Prompt and setup logic](https://github.com/gitbot-hq/gitbot/blob/main/src/bot-prompt.ts): `src/bot-prompt.ts`
- [Claude Code runner](https://github.com/gitbot-hq/gitbot/blob/main/src/start-claude-code.ts): `src/start-claude-code.ts`
- [Codex runner](https://github.com/gitbot-hq/gitbot/blob/main/src/start-codex.ts): `src/start-codex.ts`
- [OpenCode runner](https://github.com/gitbot-hq/gitbot/blob/main/src/start-opencode.ts): `src/start-opencode.ts`

### Workspace UI

- [GitBot workspace](https://github.com/gitbot-hq/gitbot/blob/main/ui/app/components/app-shell.tsx): `ui/app/components/app-shell.tsx`
- [Browser API client](https://github.com/gitbot-hq/gitbot/blob/main/ui/app/lib/api.ts): `ui/app/lib/api.ts`
- [Bot onboarding](https://github.com/gitbot-hq/gitbot/blob/main/ui/app/components/onboarding-flow.tsx): `ui/app/components/onboarding-flow.tsx`

### Sharing and marketplace

- [Marketplace interface](https://github.com/gitbot-hq/gitbot/blob/main/ui/app/marketplace/page.tsx): `ui/app/marketplace/page.tsx`
- [Marketplace client](https://github.com/gitbot-hq/gitbot/blob/main/ui/app/lib/marketplace.ts): `ui/app/lib/marketplace.ts`
- [Marketplace proxy](https://github.com/gitbot-hq/gitbot/blob/main/src/marketplace-proxy.ts): `src/marketplace-proxy.ts`
- [Bot sharing](https://github.com/gitbot-hq/gitbot/blob/main/ui/app/lib/share.ts): `ui/app/lib/share.ts`

### Other components

- **User**
- **Browser**
- **Installed coding agents**
- **Marketplace service**

## Connections

- User → Browser: uses (evidence: `README.md`)
- Browser → HTTP server: sends requests (evidence: `README.md`)
- HTTP server → Server services: uses services (evidence: `src/server.ts`)
- HTTP server → Bot and thread routes: dispatches bot routes (evidence: `src/server.ts`)
- HTTP server → Marketplace proxy: dispatches marketplace routes (evidence: `src/server.ts`)
- Server services → Repository workspace: calls repository functions (evidence: `src/server-common.ts`)
- Server services → UI file serving: serves UI files (evidence: `src/server-common.ts`)
- Bot and thread routes → Bot and thread store: reads and updates (evidence: `src/bot-routes.ts`)
- Bot and thread routes → Claude Code runner: loads transcripts (evidence: `src/bot-routes.ts`)
- Bot and thread routes → Codex runner: loads transcripts (evidence: `src/bot-routes.ts`)
- Bot and thread routes → OpenCode runner: loads history (evidence: `src/bot-routes.ts`)
- Claude Code runner → Bot and thread store: uses bot state (evidence: `src/start-claude-code.ts`)
- Codex runner → Bot and thread store: uses bot state (evidence: `src/start-codex.ts`)
- OpenCode runner → Bot and thread store: binds sessions (evidence: `src/start-opencode.ts`)
- Claude Code runner → Prompt and setup logic: uses prompt logic (evidence: `src/start-claude-code.ts`)
- Codex runner → Prompt and setup logic: uses prompt logic (evidence: `src/start-codex.ts`)
- OpenCode runner → Prompt and setup logic: uses prompt logic (evidence: `src/start-opencode.ts`)
- Claude Code runner → Installed coding agents: runs agent
- Codex runner → Installed coding agents: runs agent
- OpenCode runner → Installed coding agents: runs agent
- Browser → GitBot workspace: uses workspace (evidence: `README.md`)
- GitBot workspace → Browser API client: requests server data
- Bot onboarding → Browser API client: configures bots
- Marketplace interface → Marketplace client: uses marketplace client (evidence: `ui/app/marketplace/page.tsx`)
- Marketplace client → Marketplace proxy: requests listings
- Marketplace proxy → Marketplace service: proxies requests
- Marketplace interface → Bot sharing: offers bot sharing
