# nick040791/sourcehub architecture

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

- Interactive diagram: https://gitdiagram.com/nick040791/sourcehub
- Repository: https://github.com/nick040791/sourcehub

## Overview

SourceHub is a self-hosted forge for a local repository collection. The operator uses its web UI to browse and manage repositories, work on Git changes, handle issues and pull requests, run local workflows, and delegate coding or reviews to Helper. The daemon routes HTTP and Git Smart HTTP requests to backend capabilities, which use SQLite, local Git repositories, and optional AI providers. The README documents capabilities beyond the sampled excerpts; uncertain internal routing is not expanded into finer call chains.

Main entry points: [`src/services/api.ts`](https://github.com/nick040791/sourcehub/blob/main/src/services/api.ts) (API Client), [`server/agentService.ts`](https://github.com/nick040791/sourcehub/blob/main/server/agentService.ts) (Agent Service), [`server/vitePluginGitApi.ts`](https://github.com/nick040791/sourcehub/blob/main/server/vitePluginGitApi.ts) (API And Git Router), [`server/workflowService.ts`](https://github.com/nick040791/sourcehub/blob/main/server/workflowService.ts) (Workflow Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surface["Operator Surface"]
  node_app["Forge UI<br/>[App.tsx]"]
  node_api["API Client<br/>[api.ts]"]
end

subgraph group_forge["Forge Workflows"]
  node_desktop["Git Workbench<br/>[DesktopView.tsx]"]
  node_issues["Issue Tracker<br/>[IssuesView.tsx]"]
  node_pulls["Pull Requests"]
  node_actions["Actions UI<br/>[ActionsView.tsx]"]
  node_agents["Helper UI<br/>[AgentsView.tsx]"]
  node_settings["Security And Settings<br/>[SettingsView.tsx]"]
end

subgraph group_runtime["Daemon Services"]
  node_daemon["HTTP Daemon<br/>[index.ts]"]
  node_router["API And Git Router"]
  node_git["Git Service<br/>[gitService.ts]"]
  node_workflow["Workflow Runner<br/>[workflowService.ts]"]
  node_agent["Agent Service<br/>[agentService.ts]"]
  node_providers["AI Provider Service"]
  node_auth["Auth And Crypto<br/>[auth.ts]"]
  node_webhooks["Webhook Service<br/>[webhookService.ts]"]
end

subgraph group_state["Local State And Integrations"]
  node_db[("SQLite<br/>[db.ts]")]
  node_repositories[("Git Repositories")]
  node_workflowfiles["Workflow Definitions<br/>[workflows]"]
end

node_operator(("Operator"))
node_gitcli(("Git CLI"))
node_ollama(("Ollama / AI API"))

node_operator -->|"uses"| node_app
node_gitcli -->|"Git Smart HTTP"| node_daemon
node_app -->|"requests"| node_api
node_api -->|"HTTP API"| node_daemon
node_daemon -->|"routes requests"| node_router
node_router -->|"dispatches Git operations"| node_git
node_router -->|"dispatches workflows"| node_workflow
node_router -->|"dispatches agent tasks"| node_agent
node_router -->|"checks access"| node_auth
node_desktop -->|"requests Git actions"| node_api
node_issues -->|"requests issue actions"| node_api
node_pulls -->|"requests PR actions"| node_api
node_actions -->|"requests workflow runs"| node_api
node_agents -->|"requests agent tasks"| node_api
node_settings -->|"manages settings"| node_api
node_git -->|"reads and writes"| node_repositories
node_workflow -->|"reads repository"| node_git
node_workflow -->|"loads definitions"| node_workflowfiles
node_agent -->|"uses worktrees"| node_git
node_agent -->|"runs workflows"| node_workflow
node_agent -->|"requests completions"| node_providers
node_providers -.->|"calls provider"| node_ollama
node_agent -->|"dispatches events"| node_webhooks
node_git -->|"persists forge data"| node_db
node_workflow -->|"stores run records"| node_db
node_agent -->|"stores run and PR data"| node_db
node_providers -->|"stores provider settings"| node_db
node_auth -->|"uses credentials"| node_db

click node_app "https://github.com/nick040791/sourcehub/blob/main/src/App.tsx"
click node_api "https://github.com/nick040791/sourcehub/blob/main/src/services/api.ts"
click node_desktop "https://github.com/nick040791/sourcehub/blob/main/src/components/desktop/DesktopView.tsx"
click node_issues "https://github.com/nick040791/sourcehub/blob/main/src/components/issues/IssuesView.tsx"
click node_pulls "https://github.com/nick040791/sourcehub/blob/main/src/components/pr/PullRequestsView.tsx"
click node_actions "https://github.com/nick040791/sourcehub/blob/main/src/components/actions/ActionsView.tsx"
click node_agents "https://github.com/nick040791/sourcehub/blob/main/src/components/agents/AgentsView.tsx"
click node_settings "https://github.com/nick040791/sourcehub/blob/main/src/components/settings/SettingsView.tsx"
click node_daemon "https://github.com/nick040791/sourcehub/blob/main/server/index.ts"
click node_router "https://github.com/nick040791/sourcehub/blob/main/server/vitePluginGitApi.ts"
click node_git "https://github.com/nick040791/sourcehub/blob/main/server/gitService.ts"
click node_workflow "https://github.com/nick040791/sourcehub/blob/main/server/workflowService.ts"
click node_agent "https://github.com/nick040791/sourcehub/blob/main/server/agentService.ts"
click node_providers "https://github.com/nick040791/sourcehub/blob/main/server/aiProviderService.ts"
click node_auth "https://github.com/nick040791/sourcehub/blob/main/server/auth.ts"
click node_webhooks "https://github.com/nick040791/sourcehub/blob/main/server/webhookService.ts"
click node_db "https://github.com/nick040791/sourcehub/blob/main/server/db.ts"
click node_workflowfiles "https://github.com/nick040791/sourcehub/tree/main/.sourcehub/workflows"

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_app,node_api toneBlue
class node_desktop,node_issues,node_pulls,node_actions,node_agents,node_settings toneAmber
class node_daemon,node_router,node_git,node_workflow,node_agent,node_providers,node_auth,node_webhooks,node_ollama toneMint
class node_db,node_repositories,node_workflowfiles toneRose
class node_operator,node_gitcli toneIndigo
```

## Components

### Operator Surface

- [Forge UI](https://github.com/nick040791/sourcehub/blob/main/src/App.tsx): `src/App.tsx`
- [API Client](https://github.com/nick040791/sourcehub/blob/main/src/services/api.ts): `src/services/api.ts`

### Forge Workflows

- [Git Workbench](https://github.com/nick040791/sourcehub/blob/main/src/components/desktop/DesktopView.tsx): `src/components/desktop/DesktopView.tsx`
- [Issue Tracker](https://github.com/nick040791/sourcehub/blob/main/src/components/issues/IssuesView.tsx): `src/components/issues/IssuesView.tsx`
- [Pull Requests](https://github.com/nick040791/sourcehub/blob/main/src/components/pr/PullRequestsView.tsx): `src/components/pr/PullRequestsView.tsx`
- [Actions UI](https://github.com/nick040791/sourcehub/blob/main/src/components/actions/ActionsView.tsx): `src/components/actions/ActionsView.tsx`
- [Helper UI](https://github.com/nick040791/sourcehub/blob/main/src/components/agents/AgentsView.tsx): `src/components/agents/AgentsView.tsx`
- [Security And Settings](https://github.com/nick040791/sourcehub/blob/main/src/components/settings/SettingsView.tsx): `src/components/settings/SettingsView.tsx`

### Daemon Services

- [HTTP Daemon](https://github.com/nick040791/sourcehub/blob/main/server/index.ts): `server/index.ts`
- [API And Git Router](https://github.com/nick040791/sourcehub/blob/main/server/vitePluginGitApi.ts): `server/vitePluginGitApi.ts`
- [Git Service](https://github.com/nick040791/sourcehub/blob/main/server/gitService.ts): `server/gitService.ts`
- [Workflow Runner](https://github.com/nick040791/sourcehub/blob/main/server/workflowService.ts): `server/workflowService.ts`
- [Agent Service](https://github.com/nick040791/sourcehub/blob/main/server/agentService.ts): `server/agentService.ts`
- [AI Provider Service](https://github.com/nick040791/sourcehub/blob/main/server/aiProviderService.ts): `server/aiProviderService.ts`
- [Auth And Crypto](https://github.com/nick040791/sourcehub/blob/main/server/auth.ts): `server/auth.ts`
- [Webhook Service](https://github.com/nick040791/sourcehub/blob/main/server/webhookService.ts): `server/webhookService.ts`

### Local State And Integrations

- [SQLite](https://github.com/nick040791/sourcehub/blob/main/server/db.ts): `server/db.ts`
- **Git Repositories**
- [Workflow Definitions](https://github.com/nick040791/sourcehub/tree/main/.sourcehub/workflows): `.sourcehub/workflows`

### Other components

- **Operator**
- **Git CLI**
- **Ollama / AI API**

## Connections

- Operator → Forge UI: uses
- Git CLI → HTTP Daemon: Git Smart HTTP
- Forge UI → API Client: requests
- API Client → HTTP Daemon: HTTP API
- HTTP Daemon → API And Git Router: routes requests
- API And Git Router → Git Service: dispatches Git operations
- API And Git Router → Workflow Runner: dispatches workflows
- API And Git Router → Agent Service: dispatches agent tasks
- API And Git Router → Auth And Crypto: checks access
- Git Workbench → API Client: requests Git actions
- Issue Tracker → API Client: requests issue actions
- Pull Requests → API Client: requests PR actions
- Actions UI → API Client: requests workflow runs
- Helper UI → API Client: requests agent tasks
- Security And Settings → API Client: manages settings
- Git Service → Git Repositories: reads and writes
- Workflow Runner → Git Service: reads repository
- Workflow Runner → Workflow Definitions: loads definitions
- Agent Service → Git Service: uses worktrees
- Agent Service → Workflow Runner: runs workflows
- Agent Service → AI Provider Service: requests completions
- AI Provider Service → Ollama / AI API: calls provider
- Agent Service → Webhook Service: dispatches events
- Git Service → SQLite: persists forge data
- Workflow Runner → SQLite: stores run records
- Agent Service → SQLite: stores run and PR data
- AI Provider Service → SQLite: stores provider settings
- Auth And Crypto → SQLite: uses credentials
