# tuturuleo/apphub architecture

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

- Interactive diagram: https://gitdiagram.com/tuturuleo/apphub
- Repository: https://github.com/tuturuleo/apphub

## Overview

AppHub provisions and manages projects assembled from provider-backed recipes: users connect accounts, choose a recipe, and AppHub creates and wires resources in the background; the UI then exposes project status, deployment controls, monitoring, and assistant/MCP operations. The graph preserves these product branches and the provider, persistence, and workflow layers. Some worker subsystems are represented at their exact enclosing directories because their source was not sampled; their internal links are omitted where evidence is unavailable.

Main entry points: [`src/web/App.tsx`](https://github.com/tuturuleo/apphub/blob/main/src/web/App.tsx) (App shell), [`src/worker/index.ts`](https://github.com/tuturuleo/apphub/blob/main/src/worker/index.ts) (HTTP worker), [`src/worker/service.ts`](https://github.com/tuturuleo/apphub/blob/main/src/worker/service.ts) (Project operations), [`src/worker/engine.ts`](https://github.com/tuturuleo/apphub/blob/main/src/worker/engine.ts) (Provisioning and status engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["App shell<br/>[App.tsx]"]
  node_router["Client routing<br/>[router.ts]"]
  node_projects_ui["Projects<br/>[ProjectsPage.tsx]"]
  node_new_project["New project<br/>[NewProjectPage.tsx]"]
  node_project_view["Project details<br/>[ProjectPage.tsx]"]
  node_connections_ui["Connections"]
  node_assistant_ui["Assistant chat<br/>[ChatPage.tsx]"]
  node_resources_ui["Resources<br/>[ResourcesPage.tsx]"]
  node_limits_ui["Limits<br/>[LimitsPage.tsx]"]
  node_security_ui["Security<br/>[SecurityPage.tsx]"]
  node_queries["Query hooks<br/>[queries.ts]"]
  node_web_api["Web API client<br/>[api.ts]"]
end

subgraph group_management["Project management"]
  node_worker["HTTP worker<br/>[index.ts]"]
  node_project_service["Project operations<br/>[service.ts]"]
  node_workflow["Provisioning workflow<br/>[workflow.ts]"]
  node_engine["Provisioning and status engine<br/>[engine.ts]"]
  node_recipes["Recipe catalog"]
  node_monitor["Health monitoring<br/>[monitor.ts]"]
  node_mcp["MCP operations<br/>[mcp.ts]"]
  node_chat["Assistant service<br/>[chat.ts]"]
  node_tools["Assistant tools<br/>[tools.ts]"]
end

subgraph group_integrations["Integrations"]
  node_provider_catalog["Provider connections<br/>[index.ts]"]
  node_provider_clients["Provider clients"]
  node_llm["LLM access<br/>[llm.ts]"]
end

subgraph group_platform["Worker platform"]
  node_database[("D1 store<br/>[db.ts]")]
  node_auth["Passkey and tokens<br/>[auth.ts]"]
  node_crypto["Secret encryption<br/>[crypto.ts]"]
  node_proxy["Access proxy<br/>[proxy.ts]"]
end

node_user(("Owner"))

node_user -->|"uses"| node_app
node_app -->|"reads route"| node_router
node_app -->|"renders"| node_projects_ui
node_app -->|"renders"| node_new_project
node_app -->|"renders"| node_project_view
node_app -->|"renders"| node_connections_ui
node_app -->|"renders"| node_assistant_ui
node_app -->|"renders"| node_resources_ui
node_app -->|"renders"| node_limits_ui
node_app -->|"renders"| node_security_ui
node_queries -->|"calls"| node_web_api
node_web_api -.->|"HTTP requests"| node_worker
node_worker -->|"authenticates"| node_auth
node_worker -->|"routes operations"| node_project_service
node_worker -->|"routes MCP"| node_mcp
node_worker -->|"runs checks"| node_monitor
node_worker -->|"routes chat"| node_chat
node_worker -.->|"dispatches tools"| node_tools
node_project_service -->|"reads and writes"| node_database
node_project_service -->|"delegates provider work"| node_engine
node_project_service -->|"selects recipe"| node_recipes
node_project_service -->|"starts provisioning"| node_workflow
node_workflow -.->|"provisions resources"| node_engine
node_engine -->|"calls providers"| node_provider_clients
node_engine -->|"checks models"| node_llm
node_provider_catalog -->|"validates connections"| node_provider_clients
node_provider_clients -->|"uses crypto"| node_crypto
node_llm -->|"uses HTTP relay"| node_provider_clients
node_monitor -.->|"checks resource health"| node_engine
node_chat -.->|"requests completions"| node_llm
node_mcp -.->|"exposes operations"| node_project_service
node_tools -.->|"invokes project actions"| node_project_service
node_auth -.->|"stores credentials"| node_database
node_database -->|"encrypts provider tokens"| node_crypto
node_user -.->|"connects accounts"| node_provider_catalog
node_proxy -->|"forwards requests"| node_worker

click node_app "https://github.com/tuturuleo/apphub/blob/main/src/web/App.tsx"
click node_router "https://github.com/tuturuleo/apphub/blob/main/src/web/router.ts"
click node_projects_ui "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ProjectsPage.tsx"
click node_new_project "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/NewProjectPage.tsx"
click node_project_view "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ProjectPage.tsx"
click node_connections_ui "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ConnectionsPage.tsx"
click node_assistant_ui "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ChatPage.tsx"
click node_resources_ui "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ResourcesPage.tsx"
click node_limits_ui "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/LimitsPage.tsx"
click node_security_ui "https://github.com/tuturuleo/apphub/blob/main/src/web/pages/SecurityPage.tsx"
click node_queries "https://github.com/tuturuleo/apphub/blob/main/src/web/queries.ts"
click node_web_api "https://github.com/tuturuleo/apphub/blob/main/src/web/api.ts"
click node_worker "https://github.com/tuturuleo/apphub/blob/main/src/worker/index.ts"
click node_project_service "https://github.com/tuturuleo/apphub/blob/main/src/worker/service.ts"
click node_workflow "https://github.com/tuturuleo/apphub/blob/main/src/worker/workflow.ts"
click node_engine "https://github.com/tuturuleo/apphub/blob/main/src/worker/engine.ts"
click node_recipes "https://github.com/tuturuleo/apphub/tree/main/src/worker/recipes"
click node_monitor "https://github.com/tuturuleo/apphub/blob/main/src/worker/monitor.ts"
click node_mcp "https://github.com/tuturuleo/apphub/blob/main/src/worker/mcp.ts"
click node_chat "https://github.com/tuturuleo/apphub/blob/main/src/worker/chat.ts"
click node_tools "https://github.com/tuturuleo/apphub/blob/main/src/worker/tools.ts"
click node_provider_catalog "https://github.com/tuturuleo/apphub/blob/main/src/worker/providers/index.ts"
click node_provider_clients "https://github.com/tuturuleo/apphub/tree/main/src/worker/providers"
click node_llm "https://github.com/tuturuleo/apphub/blob/main/src/worker/llm.ts"
click node_database "https://github.com/tuturuleo/apphub/blob/main/src/worker/db.ts"
click node_auth "https://github.com/tuturuleo/apphub/blob/main/src/worker/auth.ts"
click node_crypto "https://github.com/tuturuleo/apphub/blob/main/src/worker/crypto.ts"
click node_proxy "https://github.com/tuturuleo/apphub/blob/main/src/worker/proxy.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_app,node_router,node_projects_ui,node_new_project,node_project_view,node_connections_ui,node_assistant_ui,node_resources_ui,node_limits_ui,node_security_ui,node_queries,node_web_api toneBlue
class node_worker,node_project_service,node_workflow,node_engine,node_recipes,node_monitor,node_mcp,node_chat,node_tools toneAmber
class node_provider_catalog,node_provider_clients,node_llm toneMint
class node_database,node_auth,node_crypto,node_proxy toneRose
class node_user toneIndigo
```

## Components

### Web interface

- [App shell](https://github.com/tuturuleo/apphub/blob/main/src/web/App.tsx): `src/web/App.tsx`
- [Client routing](https://github.com/tuturuleo/apphub/blob/main/src/web/router.ts): `src/web/router.ts`
- [Projects](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ProjectsPage.tsx): `src/web/pages/ProjectsPage.tsx`
- [New project](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/NewProjectPage.tsx): `src/web/pages/NewProjectPage.tsx`
- [Project details](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ProjectPage.tsx): `src/web/pages/ProjectPage.tsx`
- [Connections](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ConnectionsPage.tsx): `src/web/pages/ConnectionsPage.tsx`
- [Assistant chat](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ChatPage.tsx): `src/web/pages/ChatPage.tsx`
- [Resources](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/ResourcesPage.tsx): `src/web/pages/ResourcesPage.tsx`
- [Limits](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/LimitsPage.tsx): `src/web/pages/LimitsPage.tsx`
- [Security](https://github.com/tuturuleo/apphub/blob/main/src/web/pages/SecurityPage.tsx): `src/web/pages/SecurityPage.tsx`
- [Query hooks](https://github.com/tuturuleo/apphub/blob/main/src/web/queries.ts): `src/web/queries.ts`
- [Web API client](https://github.com/tuturuleo/apphub/blob/main/src/web/api.ts): `src/web/api.ts`

### Project management

- [HTTP worker](https://github.com/tuturuleo/apphub/blob/main/src/worker/index.ts): `src/worker/index.ts`
- [Project operations](https://github.com/tuturuleo/apphub/blob/main/src/worker/service.ts): `src/worker/service.ts`
- [Provisioning workflow](https://github.com/tuturuleo/apphub/blob/main/src/worker/workflow.ts): `src/worker/workflow.ts`
- [Provisioning and status engine](https://github.com/tuturuleo/apphub/blob/main/src/worker/engine.ts): `src/worker/engine.ts`
- [Recipe catalog](https://github.com/tuturuleo/apphub/tree/main/src/worker/recipes): `src/worker/recipes`
- [Health monitoring](https://github.com/tuturuleo/apphub/blob/main/src/worker/monitor.ts): `src/worker/monitor.ts`
- [MCP operations](https://github.com/tuturuleo/apphub/blob/main/src/worker/mcp.ts): `src/worker/mcp.ts`
- [Assistant service](https://github.com/tuturuleo/apphub/blob/main/src/worker/chat.ts): `src/worker/chat.ts`
- [Assistant tools](https://github.com/tuturuleo/apphub/blob/main/src/worker/tools.ts): `src/worker/tools.ts`

### Integrations

- [Provider connections](https://github.com/tuturuleo/apphub/blob/main/src/worker/providers/index.ts): `src/worker/providers/index.ts`
- [Provider clients](https://github.com/tuturuleo/apphub/tree/main/src/worker/providers): `src/worker/providers`
- [LLM access](https://github.com/tuturuleo/apphub/blob/main/src/worker/llm.ts): `src/worker/llm.ts`

### Worker platform

- [D1 store](https://github.com/tuturuleo/apphub/blob/main/src/worker/db.ts): `src/worker/db.ts`
- [Passkey and tokens](https://github.com/tuturuleo/apphub/blob/main/src/worker/auth.ts): `src/worker/auth.ts`
- [Secret encryption](https://github.com/tuturuleo/apphub/blob/main/src/worker/crypto.ts): `src/worker/crypto.ts`
- [Access proxy](https://github.com/tuturuleo/apphub/blob/main/src/worker/proxy.ts): `src/worker/proxy.ts`

### Other components

- **Owner**

## Connections

- Owner → App shell: uses (evidence: `src/web/App.tsx`)
- App shell → Client routing: reads route (evidence: `src/web/App.tsx`)
- App shell → Projects: renders (evidence: `src/web/App.tsx`)
- App shell → New project: renders (evidence: `src/web/App.tsx`)
- App shell → Project details: renders (evidence: `src/web/App.tsx`)
- App shell → Connections: renders (evidence: `src/web/App.tsx`)
- App shell → Assistant chat: renders (evidence: `src/web/App.tsx`)
- App shell → Resources: renders (evidence: `src/web/App.tsx`)
- App shell → Limits: renders (evidence: `src/web/App.tsx`)
- App shell → Security: renders (evidence: `src/web/App.tsx`)
- Query hooks → Web API client: calls (evidence: `src/web/queries.ts`)
- Web API client → HTTP worker: HTTP requests
- HTTP worker → Passkey and tokens: authenticates (evidence: `src/worker/index.ts`)
- HTTP worker → Project operations: routes operations (evidence: `src/worker/index.ts`)
- HTTP worker → MCP operations: routes MCP (evidence: `README.md`)
- HTTP worker → Health monitoring: runs checks (evidence: `src/worker/index.ts`)
- HTTP worker → Assistant service: routes chat (evidence: `src/worker/index.ts`)
- HTTP worker → Assistant tools: dispatches tools
- Project operations → D1 store: reads and writes (evidence: `src/worker/service.ts`)
- Project operations → Provisioning and status engine: delegates provider work (evidence: `src/worker/service.ts`)
- Project operations → Recipe catalog: selects recipe (evidence: `src/worker/service.ts`)
- Project operations → Provisioning workflow: starts provisioning (evidence: `README.md`)
- Provisioning workflow → Provisioning and status engine: provisions resources
- Provisioning and status engine → Provider clients: calls providers (evidence: `src/worker/engine.ts`)
- Provisioning and status engine → LLM access: checks models (evidence: `src/worker/engine.ts`)
- Provider connections → Provider clients: validates connections (evidence: `src/worker/providers/index.ts`)
- Provider clients → Secret encryption: uses crypto (evidence: `src/worker/providers/github.ts`)
- LLM access → Provider clients: uses HTTP relay (evidence: `src/worker/llm.ts`)
- Health monitoring → Provisioning and status engine: checks resource health
- Assistant service → LLM access: requests completions
- MCP operations → Project operations: exposes operations (evidence: `README.md`)
- Assistant tools → Project operations: invokes project actions
- Passkey and tokens → D1 store: stores credentials
- D1 store → Secret encryption: encrypts provider tokens (evidence: `src/worker/db.ts`)
- Owner → Provider connections: connects accounts (evidence: `README.md`)
- Access proxy → HTTP worker: forwards requests (evidence: `README.md`)
