# ashark-ai-05/opencanvas architecture

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

- Interactive diagram: https://gitdiagram.com/ashark-ai-05/opencanvas
- Repository: https://github.com/ashark-ai-05/opencanvas

## Overview

OpenCanvas is a local-first AI canvas: a user prompt is handled either by the model-free instant-intent path or by a provider-backed agent, which creates typed widgets that appear and persist on an interactive canvas. The README also documents conversation memory/search, MCP sources, extensible widgets, and REST/SSE control. The supplied excerpts show selected backend, indexing, and search internals; several frontend and backend routes are represented only by tree paths or README capability statements, so those links are cited to the README rather than inferred from names.

Main entry points: [`src/backend/routes/chat.ts`](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/routes/chat.ts) (Chat route), [`app/src/hooks/useFastLane.ts`](https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/hooks/useFastLane.ts) (Instant intent), [`app/src/canvas/Canvas.tsx`](https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/canvas/Canvas.tsx) (Canvas and widgets), [`src/indexer/orchestrator.ts`](https://github.com/ashark-ai-05/opencanvas/blob/main/src/indexer/orchestrator.ts) (Knowledge indexing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Canvas interface"]
  node_app["Application shell<br/>[App.tsx]"]
  node_chat["Chat interface<br/>[ChatTabs.tsx]"]
  node_fastlane["Instant intent<br/>[useFastLane.ts]"]
  node_intent["Intent parsing"]
  node_canvas["Canvas and widgets<br/>[Canvas.tsx]"]
  node_widgetviews["Widget renderers"]
end

subgraph group_agent["Agent and widgets"]
  node_providerfactory["Provider factory<br/>[index.ts]"]
  node_providers["Model providers"]
  node_agenttools["Agent tools"]
  node_streambus["Widget stream bus"]
  node_registry["Widget registry<br/>[widget-registry.ts]"]
end

subgraph group_backend["Backend services"]
  node_api["HTTP and SSE API<br/>[server.ts]"]
  node_chatroute["Chat route<br/>[chat.ts]"]
  node_state["Backend state<br/>[state.ts]"]
  node_notebook[("Notebook store<br/>[notebook-store.ts]")]
end

subgraph group_knowledge["Knowledge and integrations"]
  node_mcp["MCP sources<br/>[source.ts]"]
  node_mcptransport["MCP transport<br/>[transport.ts]"]
  node_indexer["Knowledge indexing<br/>[orchestrator.ts]"]
  node_enricher["QA enrichment<br/>[qa-enricher.ts]"]
  node_embedder["Embedding providers"]
  node_searchroute["Search route<br/>[search.ts]"]
  node_search["Hybrid search<br/>[service.ts]"]
  node_store[("SQLite knowledge store<br/>[store.ts]")]
end

node_user(("User"))
node_external(("Configured services"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_chat
node_app -->|"renders"| node_canvas
node_chat -->|"checks intent"| node_fastlane
node_fastlane -->|"classifies prompt"| node_intent
node_user -->|"types prompt"| node_fastlane
node_fastlane -->|"places widgets"| node_canvas
node_chat -->|"sends turns"| node_api
node_api -.->|"routes requests"| node_chatroute
node_chatroute -.->|"uses state"| node_state
node_state -->|"creates provider"| node_providerfactory
node_providerfactory -->|"selects adapter"| node_providers
node_chatroute -.->|"streams widgets"| node_canvas
node_agenttools -.->|"registers widget kinds"| node_registry
node_agenttools -->|"reads and writes"| node_notebook
node_chatroute -->|"streams widget updates"| node_streambus
node_canvas -.->|"renders shapes"| node_widgetviews
node_user -->|"configures sources"| node_mcp
node_mcptransport -->|"connects sources"| node_mcp
node_external -.->|"provides MCP"| node_mcptransport
node_indexer -->|"enriches chunks"| node_enricher
node_indexer -->|"embeds chunks"| node_embedder
node_indexer -->|"writes chunks"| node_store
node_user -->|"searches memory"| node_searchroute
node_searchroute -->|"runs search"| node_search
node_search -->|"embeds query"| node_embedder
node_search -->|"queries index"| node_store
node_external -.->|"supplies model API"| node_providers
node_external -.->|"supplies embeddings"| node_embedder

click node_app "https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/App.tsx"
click node_chat "https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/components/ChatTabs.tsx"
click node_fastlane "https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/hooks/useFastLane.ts"
click node_intent "https://github.com/ashark-ai-05/opencanvas/tree/main/app/src/intent"
click node_canvas "https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/canvas/Canvas.tsx"
click node_widgetviews "https://github.com/ashark-ai-05/opencanvas/tree/main/app/src/canvas/shapes"
click node_api "https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/server.ts"
click node_chatroute "https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/routes/chat.ts"
click node_state "https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/state.ts"
click node_providerfactory "https://github.com/ashark-ai-05/opencanvas/blob/main/src/providers/index.ts"
click node_providers "https://github.com/ashark-ai-05/opencanvas/tree/main/src/providers"
click node_agenttools "https://github.com/ashark-ai-05/opencanvas/tree/main/src/agent/tools"
click node_streambus "https://github.com/ashark-ai-05/opencanvas/blob/main/src/agent/widget-stream-bus.ts"
click node_registry "https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/widget-registry.ts"
click node_notebook "https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/notebook-store.ts"
click node_mcp "https://github.com/ashark-ai-05/opencanvas/blob/main/src/mcp/source.ts"
click node_mcptransport "https://github.com/ashark-ai-05/opencanvas/blob/main/src/mcp/transport.ts"
click node_indexer "https://github.com/ashark-ai-05/opencanvas/blob/main/src/indexer/orchestrator.ts"
click node_enricher "https://github.com/ashark-ai-05/opencanvas/blob/main/src/indexer/qa-enricher.ts"
click node_embedder "https://github.com/ashark-ai-05/opencanvas/blob/main/src/core/embedding-provider.ts"
click node_searchroute "https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/routes/search.ts"
click node_search "https://github.com/ashark-ai-05/opencanvas/blob/main/src/search/service.ts"
click node_store "https://github.com/ashark-ai-05/opencanvas/blob/main/src/storage/store.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_chat,node_fastlane,node_intent,node_canvas,node_widgetviews,node_user toneBlue
class node_providerfactory,node_providers,node_agenttools,node_streambus,node_registry toneAmber
class node_api,node_chatroute,node_state,node_notebook toneMint
class node_mcp,node_mcptransport,node_indexer,node_enricher,node_embedder,node_searchroute,node_search,node_store toneRose
class node_external toneIndigo
```

## Components

### Canvas interface

- [Application shell](https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/App.tsx): `app/src/App.tsx`
- [Chat interface](https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/components/ChatTabs.tsx): `app/src/components/ChatTabs.tsx`
- [Instant intent](https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/hooks/useFastLane.ts): `app/src/hooks/useFastLane.ts`
- [Intent parsing](https://github.com/ashark-ai-05/opencanvas/tree/main/app/src/intent): `app/src/intent`
- [Canvas and widgets](https://github.com/ashark-ai-05/opencanvas/blob/main/app/src/canvas/Canvas.tsx): `app/src/canvas/Canvas.tsx`
- [Widget renderers](https://github.com/ashark-ai-05/opencanvas/tree/main/app/src/canvas/shapes): `app/src/canvas/shapes`

### Agent and widgets

- [Provider factory](https://github.com/ashark-ai-05/opencanvas/blob/main/src/providers/index.ts): `src/providers/index.ts`
- [Model providers](https://github.com/ashark-ai-05/opencanvas/tree/main/src/providers): `src/providers`
- [Agent tools](https://github.com/ashark-ai-05/opencanvas/tree/main/src/agent/tools): `src/agent/tools`
- [Widget stream bus](https://github.com/ashark-ai-05/opencanvas/blob/main/src/agent/widget-stream-bus.ts): `src/agent/widget-stream-bus.ts`
- [Widget registry](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/widget-registry.ts): `src/backend/widget-registry.ts`

### Backend services

- [HTTP and SSE API](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/server.ts): `src/backend/server.ts`
- [Chat route](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/routes/chat.ts): `src/backend/routes/chat.ts`
- [Backend state](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/state.ts): `src/backend/state.ts`
- [Notebook store](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/notebook-store.ts): `src/backend/notebook-store.ts`

### Knowledge and integrations

- [MCP sources](https://github.com/ashark-ai-05/opencanvas/blob/main/src/mcp/source.ts): `src/mcp/source.ts`
- [MCP transport](https://github.com/ashark-ai-05/opencanvas/blob/main/src/mcp/transport.ts): `src/mcp/transport.ts`
- [Knowledge indexing](https://github.com/ashark-ai-05/opencanvas/blob/main/src/indexer/orchestrator.ts): `src/indexer/orchestrator.ts`
- [QA enrichment](https://github.com/ashark-ai-05/opencanvas/blob/main/src/indexer/qa-enricher.ts): `src/indexer/qa-enricher.ts`
- [Embedding providers](https://github.com/ashark-ai-05/opencanvas/blob/main/src/core/embedding-provider.ts): `src/core/embedding-provider.ts`
- [Search route](https://github.com/ashark-ai-05/opencanvas/blob/main/src/backend/routes/search.ts): `src/backend/routes/search.ts`
- [Hybrid search](https://github.com/ashark-ai-05/opencanvas/blob/main/src/search/service.ts): `src/search/service.ts`
- [SQLite knowledge store](https://github.com/ashark-ai-05/opencanvas/blob/main/src/storage/store.ts): `src/storage/store.ts`

### Other components

- **User**
- **Configured services**

## Connections

- User → Application shell: uses (evidence: `README.md`)
- Application shell → Chat interface: renders (evidence: `app/src/App.tsx`)
- Application shell → Canvas and widgets: renders (evidence: `app/src/App.tsx`)
- Chat interface → Instant intent: checks intent (evidence: `app/src/hooks/useFastLane.ts`)
- Instant intent → Intent parsing: classifies prompt (evidence: `app/src/hooks/useFastLane.ts`)
- User → Instant intent: types prompt (evidence: `README.md`)
- Instant intent → Canvas and widgets: places widgets (evidence: `README.md`)
- Chat interface → HTTP and SSE API: sends turns (evidence: `README.md`)
- HTTP and SSE API → Chat route: routes requests (evidence: `src/backend/server.ts`)
- Chat route → Backend state: uses state (evidence: `src/backend/state.ts`)
- Backend state → Provider factory: creates provider (evidence: `src/backend/state.ts`)
- Provider factory → Model providers: selects adapter (evidence: `src/providers/index.ts`)
- Chat route → Canvas and widgets: streams widgets
- Agent tools → Widget registry: registers widget kinds (evidence: `src/agent/tools/_shared.ts`)
- Agent tools → Notebook store: reads and writes (evidence: `src/agent/tools/_shared.ts`)
- Chat route → Widget stream bus: streams widget updates
- Canvas and widgets → Widget renderers: renders shapes (evidence: `README.md`)
- User → MCP sources: configures sources (evidence: `README.md`)
- MCP transport → MCP sources: connects sources (evidence: `src/backend/server.ts`)
- Configured services → MCP transport: provides MCP (evidence: `README.md`)
- Knowledge indexing → QA enrichment: enriches chunks (evidence: `src/indexer/orchestrator.ts`)
- Knowledge indexing → Embedding providers: embeds chunks (evidence: `src/indexer/orchestrator.ts`)
- Knowledge indexing → SQLite knowledge store: writes chunks (evidence: `src/indexer/orchestrator.ts`)
- User → Search route: searches memory (evidence: `README.md`)
- Search route → Hybrid search: runs search (evidence: `src/backend/routes/search.ts`)
- Hybrid search → Embedding providers: embeds query (evidence: `src/search/service.ts`)
- Hybrid search → SQLite knowledge store: queries index (evidence: `src/search/service.ts`)
- Configured services → Model providers: supplies model API (evidence: `README.md`)
- Configured services → Embedding providers: supplies embeddings
