# kushagra-2006/template-playground architecture

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

- Interactive diagram: https://gitdiagram.com/kushagra-2006/template-playground
- Repository: https://github.com/kushagra-2006/template-playground

## Overview

Accord Project Template Playground lets users edit TemplateMark, Concerto models, logic, and JSON data, then run templates for a live agreement preview. The central runtime path is the application shell into the editor workspace and shared state, which coordinates rendering in an isolated sandbox; users can also export/share work, configure AI assistance, and follow learning modules. The graph reflects README capabilities and the supplied source index/excerpts; some UI and service details are unsampled, so their connections are omitted where not evidenced.

Main entry points: [`src/pages/MainContainer.tsx`](https://github.com/kushagra-2006/template-playground/blob/main/src/pages/MainContainer.tsx) (Editor workspace), [`src/store/store.ts`](https://github.com/kushagra-2006/template-playground/blob/main/src/store/store.ts) (Playground state), [`src/App.tsx`](https://github.com/kushagra-2006/template-playground/blob/main/src/App.tsx) (Application shell), [`src/components/RebuildSandboxFrame.tsx`](https://github.com/kushagra-2006/template-playground/blob/main/src/components/RebuildSandboxFrame.tsx) (Rendering sandbox frame)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Playground UI"]
  node_shell["Application shell<br/>[App.tsx]"]
  node_workspace["Editor workspace<br/>[MainContainer.tsx]"]
  node_learning["Learning content<br/>[LearnNow.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_tour["Guided tour<br/>[Tour.ts]"]
end

subgraph group_authoring["Template Authoring"]
  node_model["Concerto model editor<br/>[ConcertoEditor.tsx]"]
  node_data["JSON data editor<br/>[JSONEditor.tsx]"]
  node_template["TemplateMark editor<br/>[MarkdownEditor.tsx]"]
  node_logic["Logic editor<br/>[LogicEditor.tsx]"]
  node_logic_source["Logic source handling<br/>[logicSource.ts]"]
  node_md_context["Markdown editor context"]
  node_md_utils["Markdown commands"]
end

subgraph group_runtime["Execution and Preview"]
  node_sandbox_frame["Rendering sandbox frame"]
  node_sandbox_store["Sandbox coordinator<br/>[rebuildSandbox.ts]"]
  node_protocol["Sandbox message protocol<br/>[rebuildSandbox.ts]"]
  node_worker["Render worker<br/>[rebuild.worker.ts]"]
  node_pipeline["Template render pipeline<br/>[rebuildPipeline.ts]"]
  node_model_cache["Bundled model loader<br/>[modelCache.ts]"]
  node_preview["Agreement preview and export<br/>[PreviewPane.tsx]"]
end

subgraph group_services["Assistant and State"]
  node_store[("Playground state<br/>[store.ts]")]
  node_archive["Template import and archive<br/>[templateArchive.ts]"]
  node_assistant_panel["AI chat panel<br/>[AIChatPanel.tsx]"]
  node_chat_relay["AI chat relay<br/>[chatRelay.ts]"]
  node_providers["LLM providers<br/>[llmProviders.ts]"]
  node_assistant_types["Assistant types"]
end

node_user(("Playground user"))
node_ai_service{{"LLM provider services"}}

node_user -->|"opens"| node_shell
node_shell -->|"routes to"| node_workspace
node_shell -->|"routes to"| node_learning
node_shell -->|"renders"| node_navbar
node_user -->|"edits templates"| node_workspace
node_workspace -->|"renders"| node_model
node_workspace -->|"renders"| node_data
node_workspace -->|"renders"| node_template
node_workspace -->|"renders"| node_logic
node_workspace -->|"reads state"| node_store
node_store -->|"imports templates"| node_archive
node_store -->|"coordinates rendering"| node_sandbox_store
node_store -->|"uses types"| node_assistant_types
node_logic -.->|"uses source"| node_logic_source
node_template -.->|"shares commands"| node_md_context
node_md_context -->|"supports commands"| node_md_utils
node_workspace -->|"renders"| node_assistant_panel
node_assistant_panel -->|"sends chat"| node_chat_relay
node_chat_relay -.->|"delegates"| node_providers
node_providers -.->|"calls provider"| node_ai_service
node_store -->|"configures execution"| node_providers
node_workspace -->|"hosts rendering"| node_sandbox_frame
node_sandbox_store -.->|"sends render requests"| node_sandbox_frame
node_sandbox_frame -->|"relays messages"| node_worker
node_worker -->|"runs pipeline"| node_pipeline
node_pipeline -->|"loads models"| node_model_cache
node_workspace -.->|"shows result"| node_preview
node_user -->|"views and exports"| node_preview
node_user -->|"follows modules"| node_learning
node_user -.->|"starts guided tour"| node_tour
node_navbar -.->|"offers tour"| node_tour

click node_shell "https://github.com/kushagra-2006/template-playground/blob/main/src/App.tsx"
click node_workspace "https://github.com/kushagra-2006/template-playground/blob/main/src/pages/MainContainer.tsx"
click node_learning "https://github.com/kushagra-2006/template-playground/blob/main/src/pages/LearnNow.tsx"
click node_navbar "https://github.com/kushagra-2006/template-playground/blob/main/src/components/Navbar.tsx"
click node_model "https://github.com/kushagra-2006/template-playground/blob/main/src/editors/ConcertoEditor.tsx"
click node_data "https://github.com/kushagra-2006/template-playground/blob/main/src/editors/JSONEditor.tsx"
click node_template "https://github.com/kushagra-2006/template-playground/blob/main/src/editors/MarkdownEditor.tsx"
click node_logic "https://github.com/kushagra-2006/template-playground/blob/main/src/editors/LogicEditor.tsx"
click node_logic_source "https://github.com/kushagra-2006/template-playground/blob/main/src/editors/logicSource.ts"
click node_md_context "https://github.com/kushagra-2006/template-playground/blob/main/src/contexts/MarkdownEditorContext.tsx"
click node_md_utils "https://github.com/kushagra-2006/template-playground/blob/main/src/utils/markdownEditorUtils.ts"
click node_store "https://github.com/kushagra-2006/template-playground/blob/main/src/store/store.ts"
click node_archive "https://github.com/kushagra-2006/template-playground/blob/main/src/utils/templateArchive.ts"
click node_sandbox_frame "https://github.com/kushagra-2006/template-playground/blob/main/src/components/RebuildSandboxFrame.tsx"
click node_sandbox_store "https://github.com/kushagra-2006/template-playground/blob/main/src/store/rebuildSandbox.ts"
click node_protocol "https://github.com/kushagra-2006/template-playground/blob/main/src/constants/rebuildSandbox.ts"
click node_worker "https://github.com/kushagra-2006/template-playground/blob/main/src/sandbox/rebuild.worker.ts"
click node_pipeline "https://github.com/kushagra-2006/template-playground/blob/main/src/sandbox/rebuildPipeline.ts"
click node_model_cache "https://github.com/kushagra-2006/template-playground/blob/main/src/utils/modelCache.ts"
click node_preview "https://github.com/kushagra-2006/template-playground/blob/main/src/components/designV2/PreviewPane.tsx"
click node_assistant_panel "https://github.com/kushagra-2006/template-playground/blob/main/src/components/AIChatPanel.tsx"
click node_chat_relay "https://github.com/kushagra-2006/template-playground/blob/main/src/ai-assistant/chatRelay.ts"
click node_providers "https://github.com/kushagra-2006/template-playground/blob/main/src/ai-assistant/llmProviders.ts"
click node_assistant_types "https://github.com/kushagra-2006/template-playground/blob/main/src/types/components/AIAssistant.types.ts"
click node_tour "https://github.com/kushagra-2006/template-playground/blob/main/src/components/Tour.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_shell,node_workspace,node_learning,node_navbar,node_tour,node_user toneBlue
class node_model,node_data,node_template,node_logic,node_logic_source,node_md_context,node_md_utils toneAmber
class node_sandbox_frame,node_sandbox_store,node_protocol,node_worker,node_pipeline,node_model_cache,node_preview toneMint
class node_store,node_archive,node_assistant_panel,node_chat_relay,node_providers,node_assistant_types toneRose
class node_ai_service toneIndigo
```

## Components

### Playground UI

- [Application shell](https://github.com/kushagra-2006/template-playground/blob/main/src/App.tsx): `src/App.tsx`
- [Editor workspace](https://github.com/kushagra-2006/template-playground/blob/main/src/pages/MainContainer.tsx): `src/pages/MainContainer.tsx`
- [Learning content](https://github.com/kushagra-2006/template-playground/blob/main/src/pages/LearnNow.tsx): `src/pages/LearnNow.tsx`
- [Navigation](https://github.com/kushagra-2006/template-playground/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`
- [Guided tour](https://github.com/kushagra-2006/template-playground/blob/main/src/components/Tour.ts): `src/components/Tour.ts`

### Template Authoring

- [Concerto model editor](https://github.com/kushagra-2006/template-playground/blob/main/src/editors/ConcertoEditor.tsx): `src/editors/ConcertoEditor.tsx`
- [JSON data editor](https://github.com/kushagra-2006/template-playground/blob/main/src/editors/JSONEditor.tsx): `src/editors/JSONEditor.tsx`
- [TemplateMark editor](https://github.com/kushagra-2006/template-playground/blob/main/src/editors/MarkdownEditor.tsx): `src/editors/MarkdownEditor.tsx`
- [Logic editor](https://github.com/kushagra-2006/template-playground/blob/main/src/editors/LogicEditor.tsx): `src/editors/LogicEditor.tsx`
- [Logic source handling](https://github.com/kushagra-2006/template-playground/blob/main/src/editors/logicSource.ts): `src/editors/logicSource.ts`
- [Markdown editor context](https://github.com/kushagra-2006/template-playground/blob/main/src/contexts/MarkdownEditorContext.tsx): `src/contexts/MarkdownEditorContext.tsx`
- [Markdown commands](https://github.com/kushagra-2006/template-playground/blob/main/src/utils/markdownEditorUtils.ts): `src/utils/markdownEditorUtils.ts`

### Execution and Preview

- [Rendering sandbox frame](https://github.com/kushagra-2006/template-playground/blob/main/src/components/RebuildSandboxFrame.tsx): `src/components/RebuildSandboxFrame.tsx`
- [Sandbox coordinator](https://github.com/kushagra-2006/template-playground/blob/main/src/store/rebuildSandbox.ts): `src/store/rebuildSandbox.ts`
- [Sandbox message protocol](https://github.com/kushagra-2006/template-playground/blob/main/src/constants/rebuildSandbox.ts): `src/constants/rebuildSandbox.ts`
- [Render worker](https://github.com/kushagra-2006/template-playground/blob/main/src/sandbox/rebuild.worker.ts): `src/sandbox/rebuild.worker.ts`
- [Template render pipeline](https://github.com/kushagra-2006/template-playground/blob/main/src/sandbox/rebuildPipeline.ts): `src/sandbox/rebuildPipeline.ts`
- [Bundled model loader](https://github.com/kushagra-2006/template-playground/blob/main/src/utils/modelCache.ts): `src/utils/modelCache.ts`
- [Agreement preview and export](https://github.com/kushagra-2006/template-playground/blob/main/src/components/designV2/PreviewPane.tsx): `src/components/designV2/PreviewPane.tsx`

### Assistant and State

- [Playground state](https://github.com/kushagra-2006/template-playground/blob/main/src/store/store.ts): `src/store/store.ts`
- [Template import and archive](https://github.com/kushagra-2006/template-playground/blob/main/src/utils/templateArchive.ts): `src/utils/templateArchive.ts`
- [AI chat panel](https://github.com/kushagra-2006/template-playground/blob/main/src/components/AIChatPanel.tsx): `src/components/AIChatPanel.tsx`
- [AI chat relay](https://github.com/kushagra-2006/template-playground/blob/main/src/ai-assistant/chatRelay.ts): `src/ai-assistant/chatRelay.ts`
- [LLM providers](https://github.com/kushagra-2006/template-playground/blob/main/src/ai-assistant/llmProviders.ts): `src/ai-assistant/llmProviders.ts`
- [Assistant types](https://github.com/kushagra-2006/template-playground/blob/main/src/types/components/AIAssistant.types.ts): `src/types/components/AIAssistant.types.ts`

### Other components

- **Playground user**
- **LLM provider services**

## Connections

- Playground user → Application shell: opens
- Application shell → Editor workspace: routes to (evidence: `src/App.tsx`)
- Application shell → Learning content: routes to (evidence: `src/App.tsx`)
- Application shell → Navigation: renders (evidence: `src/App.tsx`)
- Playground user → Editor workspace: edits templates
- Editor workspace → Concerto model editor: renders (evidence: `src/pages/MainContainer.tsx`)
- Editor workspace → JSON data editor: renders (evidence: `src/pages/MainContainer.tsx`)
- Editor workspace → TemplateMark editor: renders (evidence: `src/pages/MainContainer.tsx`)
- Editor workspace → Logic editor: renders (evidence: `src/pages/MainContainer.tsx`)
- Editor workspace → Playground state: reads state (evidence: `src/pages/MainContainer.tsx`)
- Playground state → Template import and archive: imports templates (evidence: `src/store/store.ts`)
- Playground state → Sandbox coordinator: coordinates rendering (evidence: `src/store/store.ts`)
- Playground state → Assistant types: uses types (evidence: `src/store/store.ts`)
- Logic editor → Logic source handling: uses source
- TemplateMark editor → Markdown editor context: shares commands
- Markdown editor context → Markdown commands: supports commands (evidence: `src/editors/editorsContainer/markdownCommands.ts`)
- Editor workspace → AI chat panel: renders (evidence: `src/pages/MainContainer.tsx`)
- AI chat panel → AI chat relay: sends chat (evidence: `src/components/AIChatPanel.tsx`)
- AI chat relay → LLM providers: delegates
- LLM providers → LLM provider services: calls provider (evidence: `src/ai-assistant/llmProviders.ts`)
- Playground state → LLM providers: configures execution (evidence: `src/store/store.ts`)
- Editor workspace → Rendering sandbox frame: hosts rendering (evidence: `src/pages/MainContainer.tsx`)
- Sandbox coordinator → Rendering sandbox frame: sends render requests
- Rendering sandbox frame → Render worker: relays messages
- Render worker → Template render pipeline: runs pipeline (evidence: `src/sandbox/rebuild.worker.ts`)
- Template render pipeline → Bundled model loader: loads models (evidence: `src/sandbox/rebuildPipeline.ts`)
- Editor workspace → Agreement preview and export: shows result
- Playground user → Agreement preview and export: views and exports
- Playground user → Learning content: follows modules
- Playground user → Guided tour: starts guided tour
- Navigation → Guided tour: offers tour
