# shadcn/ember-cloudflare architecture

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

- Interactive diagram: https://gitdiagram.com/shadcn/ember-cloudflare
- Repository: https://github.com/shadcn/ember-cloudflare

## Overview

Ember is a Cloudflare-hosted team chat application. People sign in or join a workspace, then use rooms, threads, direct messages, search, files, and optional bots, AI, huddles, and notifications. The browser presents the workspace and calls the Worker; the Worker owns workspace behavior and supporting services, with shared protocol and rich-text packages. The README documents the product capabilities; some subsystem links are documented there or implied by module responsibilities, since much of the implementation was not sampled.

Main entry points: [`apps/worker/src/workspace.ts`](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/workspace.ts) (Workspace service), [`apps/web/src/App.tsx`](https://github.com/shadcn/ember-cloudflare/blob/main/apps/web/src/App.tsx) (Web app), [`apps/worker/src/searches.ts`](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/searches.ts) (Search API), [`apps/worker/src/index.ts`](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/index.ts) (Worker routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Web application"]
  node_app["Web app<br/>[App.tsx]"]
  node_workspace_ui["Workspace UI<br/>[workspace.tsx]"]
end

subgraph group_worker["Worker runtime"]
  node_worker_entry["Worker routes<br/>[index.ts]"]
  node_workspace["Workspace service<br/>[workspace.ts]"]
end

subgraph group_features["Conversation features"]
  node_chat_room["Room runtime<br/>[chat-room.ts]"]
  node_room_store[("Conversation state<br/>[workspace-store.ts]")]
  node_search_api["Search API<br/>[searches.ts]"]
  node_search_index[("Search index<br/>[search-index.ts]")]
  node_file_service["File handling<br/>[uploads.ts]"]
end

subgraph group_services["Workspace services"]
  node_bots["Slack-compatible bots<br/>[webhooks.ts]"]
  node_assistant["AI assistants<br/>[gateway.ts]"]
  node_huddles["Huddles<br/>[room.ts]"]
  node_push["Push delivery<br/>[delivery.ts]"]
  node_membership["Membership and auth<br/>[auth.ts]"]
end

subgraph group_shared["Shared packages"]
  node_protocol["Wire protocol<br/>[index.ts]"]
  node_search_protocol["Search contract<br/>[search.ts]"]
  node_richtext["Rich text<br/>[render.ts]"]
end

node_person(("Team member"))
node_cloudflare["Cloudflare platform"]
node_external_bots(("Webhook senders"))
node_ai_provider["AI providers"]

node_person -->|"uses"| node_app
node_app -.->|"fetches bootstrap"| node_worker_entry
node_app -.->|"loads workspace"| node_workspace_ui
node_worker_entry -.->|"dispatches requests"| node_workspace
node_workspace -.->|"stores workspace data"| node_room_store
node_workspace -->|"delegates AI"| node_assistant
node_workspace -->|"delegates huddles"| node_huddles
node_app -->|"searches messages"| node_search_api
node_search_api -->|"queries index"| node_search_index
node_search_api -->|"parses search"| node_search_protocol
node_chat_room -.->|"records messages"| node_room_store
node_app -->|"uploads files"| node_file_service
node_external_bots -->|"posts webhooks"| node_bots
node_workspace -.->|"routes bot events"| node_bots
node_workspace -.->|"sends notifications"| node_push
node_workspace -->|"checks access"| node_membership
node_assistant -->|"requests model"| node_ai_provider
node_app -->|"uses API types"| node_protocol
node_workspace -->|"handles frames"| node_protocol
node_workspace_ui -.->|"renders messages"| node_richtext
node_cloudflare -->|"runs on"| node_worker_entry

click node_app "https://github.com/shadcn/ember-cloudflare/blob/main/apps/web/src/App.tsx"
click node_workspace_ui "https://github.com/shadcn/ember-cloudflare/blob/main/apps/web/src/components/workspace/workspace.tsx"
click node_worker_entry "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/index.ts"
click node_workspace "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/workspace.ts"
click node_chat_room "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/chat-room.ts"
click node_room_store "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/workspace-store.ts"
click node_search_api "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/searches.ts"
click node_search_index "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/search-index.ts"
click node_file_service "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/files/uploads.ts"
click node_bots "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/bots/webhooks.ts"
click node_assistant "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/assistant/gateway.ts"
click node_huddles "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/huddles/room.ts"
click node_push "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/push/delivery.ts"
click node_membership "https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/auth.ts"
click node_protocol "https://github.com/shadcn/ember-cloudflare/blob/main/packages/protocol/src/index.ts"
click node_search_protocol "https://github.com/shadcn/ember-cloudflare/blob/main/packages/protocol/src/search.ts"
click node_richtext "https://github.com/shadcn/ember-cloudflare/blob/main/packages/richtext/src/render.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_workspace_ui toneBlue
class node_worker_entry,node_workspace toneAmber
class node_chat_room,node_room_store,node_search_api,node_search_index,node_file_service,node_external_bots toneMint
class node_bots,node_assistant,node_huddles,node_push,node_membership toneRose
class node_protocol,node_search_protocol,node_richtext,node_person,node_cloudflare,node_ai_provider toneIndigo
```

## Components

### Web application

- [Web app](https://github.com/shadcn/ember-cloudflare/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Workspace UI](https://github.com/shadcn/ember-cloudflare/blob/main/apps/web/src/components/workspace/workspace.tsx): `apps/web/src/components/workspace/workspace.tsx`

### Worker runtime

- [Worker routes](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/index.ts): `apps/worker/src/index.ts`
- [Workspace service](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/workspace.ts): `apps/worker/src/workspace.ts`

### Conversation features

- [Room runtime](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/chat-room.ts): `apps/worker/src/chat-room.ts`
- [Conversation state](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/workspace-store.ts): `apps/worker/src/workspace-store.ts`
- [Search API](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/searches.ts): `apps/worker/src/searches.ts`
- [Search index](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/search-index.ts): `apps/worker/src/search-index.ts`
- [File handling](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/files/uploads.ts): `apps/worker/src/files/uploads.ts`

### Workspace services

- [Slack-compatible bots](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/bots/webhooks.ts): `apps/worker/src/bots/webhooks.ts`
- [AI assistants](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/assistant/gateway.ts): `apps/worker/src/assistant/gateway.ts`
- [Huddles](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/huddles/room.ts): `apps/worker/src/huddles/room.ts`
- [Push delivery](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/push/delivery.ts): `apps/worker/src/push/delivery.ts`
- [Membership and auth](https://github.com/shadcn/ember-cloudflare/blob/main/apps/worker/src/auth.ts): `apps/worker/src/auth.ts`

### Shared packages

- [Wire protocol](https://github.com/shadcn/ember-cloudflare/blob/main/packages/protocol/src/index.ts): `packages/protocol/src/index.ts`
- [Search contract](https://github.com/shadcn/ember-cloudflare/blob/main/packages/protocol/src/search.ts): `packages/protocol/src/search.ts`
- [Rich text](https://github.com/shadcn/ember-cloudflare/blob/main/packages/richtext/src/render.ts): `packages/richtext/src/render.ts`

### Other components

- **Team member**
- **Cloudflare platform**
- **Webhook senders**
- **AI providers**

## Connections

- Team member → Web app: uses
- Web app → Worker routes: fetches bootstrap
- Web app → Workspace UI: loads workspace
- Worker routes → Workspace service: dispatches requests
- Workspace service → Conversation state: stores workspace data (evidence: `apps/worker/src/workspace.ts`)
- Workspace service → AI assistants: delegates AI (evidence: `apps/worker/src/workspace.ts`)
- Workspace service → Huddles: delegates huddles (evidence: `apps/worker/src/workspace.ts`)
- Web app → Search API: searches messages
- Search API → Search index: queries index (evidence: `apps/worker/src/searches.ts`)
- Search API → Search contract: parses search (evidence: `apps/worker/src/searches.ts`)
- Room runtime → Conversation state: records messages
- Web app → File handling: uploads files
- Webhook senders → Slack-compatible bots: posts webhooks
- Workspace service → Slack-compatible bots: routes bot events
- Workspace service → Push delivery: sends notifications
- Workspace service → Membership and auth: checks access (evidence: `apps/worker/src/workspace.ts`)
- AI assistants → AI providers: requests model
- Web app → Wire protocol: uses API types (evidence: `apps/web/src/App.tsx`)
- Workspace service → Wire protocol: handles frames (evidence: `apps/worker/src/workspace.ts`)
- Workspace UI → Rich text: renders messages
- Cloudflare platform → Worker routes: runs on
