# rcarubbi/carubbi.chatbotstudio architecture

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

- Interactive diagram: https://gitdiagram.com/rcarubbi/carubbi.chatbotstudio
- Repository: https://github.com/rcarubbi/carubbi.chatbotstudio
- Video tour (about a minute): https://gitdiagram.com/rcarubbi/carubbi.chatbotstudio/video

## Overview

Carubbi.ChatbotStudio is a Blockly-based platform for designing, managing, and running Microsoft Bot Framework chatbots. A user authors a bot in the editor; its configuration is managed and versioned by the backend, then published to the runtime, where incoming messages are handled and bot state persisted. The tree also shows a Direct Line connector and configurable speech, NLP, maps, FAQ, and image-classification services. Some capability links are documented rather than source-verified; those are marked dashed, and unsampled internals are represented at their exact enclosing directories.

Main entry points: [`Carubbi.BotEditor.Api/Controllers/MessagesController.cs`](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Controllers/MessagesController.cs) (Message handling), [`Carubbi.BotEditor.Backend.Domain/Services/BotService.cs`](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Domain/Services/BotService.cs) (Bot lifecycle), [`carubbi-boteditor/src/App.js`](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/carubbi-boteditor/src/App.js) (Studio UI), [`Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs`](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs) (Runtime API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Bot authoring"]
  node_editor["Studio UI<br/>[App.js]"]
  node_blockly["Blockly editor"]
  node_flowchart["Flow visualization<br/>[flowchart.js]"]
  node_config["Bot definition<br/>[BotConfig.cs]"]
end

subgraph group_management["Management backend"]
  node_accounts["Accounts and access"]
  node_managementapi["Management API<br/>[BotController.cs]"]
  node_botservice["Bot lifecycle<br/>[BotService.cs]"]
  node_botdata["Bot records<br/>[Bot.cs]"]
  node_repositories[("SQL repositories<br/>[Repositories]")]
  node_runtimeclient["Runtime client"]
  node_channelclient["Channel registration"]
end

subgraph group_runtime["Bot runtime"]
  node_runtimeapi["Runtime API"]
  node_tenant["Tenant configuration<br/>[TenantManager.cs]"]
  node_messages["Message handling"]
  node_dialogsteps["Conversation steps<br/>[Dialogs]"]
  node_formruntime["Form-step runtime<br/>[FormStepService.cs]"]
  node_connector["Direct Line connector<br/>[bridge.js]"]
end

subgraph group_integrations["Bot integrations"]
  node_services["External capability services"]
  node_speech["Speech synthesis"]
end

subgraph group_state["State and persistence"]
  node_state["Conversation state<br/>[StateManager.cs]"]
  node_botstore[("Bot data store")]
  node_activitylogs[("Activity logging")]
end

node_user(("Bot author"))
node_channelservice["Channel service"]
node_person(("Chat participant"))

node_user -.->|"authors in"| node_editor
node_editor -.->|"edits flows"| node_blockly
node_blockly -.->|"generates definition"| node_config
node_editor -.->|"manages bots"| node_managementapi
node_managementapi -.->|"delegates lifecycle"| node_botservice
node_botservice -->|"creates versions"| node_botdata
node_botservice -->|"uses repository"| node_repositories
node_botservice -->|"publishes runtime"| node_runtimeclient
node_botservice -->|"registers channels"| node_channelclient
node_channelclient -.->|"calls registration"| node_channelservice
node_runtimeclient -.->|"calls runtime"| node_runtimeapi
node_runtimeapi -->|"builds forms"| node_formruntime
node_runtimeapi -->|"configures tenant"| node_tenant
node_person -.->|"sends activity"| node_messages
node_messages -.->|"dispatches dialogue"| node_dialogsteps
node_messages -->|"loads bot config"| node_config
node_messages -->|"uses bot store"| node_botstore
node_tenant -->|"registers tenant store"| node_botstore
node_messages -.->|"records activity"| node_activitylogs
node_connector -.->|"bridges messages"| node_messages
node_dialogsteps -.->|"uses configured services"| node_services
node_messages -->|"resolves recognition"| node_speech
node_speech -->|"synthesizes speech"| node_services
node_messages -.->|"clears dialog state"| node_state

click node_editor "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/carubbi-boteditor/src/App.js"
click node_blockly "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.UI/Scripts/blockly/JsonBotDefinition/JsonBotDefinitionBlocks.js"
click node_flowchart "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.UI/Scripts/flowchart/flowchart.js"
click node_config "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Config/BotConfig.cs"
click node_accounts "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Controllers/AccountController.cs"
click node_managementapi "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Controllers/BotController.cs"
click node_botservice "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Domain/Services/BotService.cs"
click node_botdata "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Domain/Entities/Bot.cs"
click node_repositories "https://github.com/rcarubbi/carubbi.chatbotstudio/tree/master/Carubbi.BotEditor.Backend.DataAccess/Repositories"
click node_runtimeclient "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Integrations/BotRuntimeServiceClient.cs"
click node_channelclient "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Integrations/ChannelRegistrationServiceClient.cs"
click node_runtimeapi "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs"
click node_tenant "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/TenantManager.cs"
click node_messages "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Controllers/MessagesController.cs"
click node_dialogsteps "https://github.com/rcarubbi/carubbi.chatbotstudio/tree/master/Carubbi.BotEditor.Api/Dialogs"
click node_formruntime "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Forms/FormStepService.cs"
click node_connector "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/carubbi-botconnector/src/directline/bridge.js"
click node_state "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/State/StateManager.cs"
click node_botstore "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/BotOverrides/Autofac/BotDataStoreModule.cs"
click node_activitylogs "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/State/SqlActivityLogger.cs"
click node_services "https://github.com/rcarubbi/carubbi.chatbotstudio/tree/master/Carubbi.BotEditor.Services"
click node_speech "https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Services/SpeechSysthesizer/SpeechSynthesizerManager.cs"

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_editor,node_blockly,node_flowchart,node_config toneBlue
class node_accounts,node_managementapi,node_botservice,node_botdata,node_repositories,node_runtimeclient,node_channelclient toneAmber
class node_runtimeapi,node_tenant,node_messages,node_dialogsteps,node_formruntime,node_connector toneMint
class node_services,node_speech toneRose
class node_state,node_botstore,node_activitylogs,node_user,node_channelservice,node_person toneIndigo
```

## Components

### Bot authoring

- [Studio UI](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/carubbi-boteditor/src/App.js): `carubbi-boteditor/src/App.js`
- [Blockly editor](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.UI/Scripts/blockly/JsonBotDefinition/JsonBotDefinitionBlocks.js): `Carubbi.BotEditor.UI/Scripts/blockly/JsonBotDefinition/JsonBotDefinitionBlocks.js`
- [Flow visualization](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.UI/Scripts/flowchart/flowchart.js): `Carubbi.BotEditor.UI/Scripts/flowchart/flowchart.js`
- [Bot definition](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Config/BotConfig.cs): `Carubbi.BotEditor.Config/BotConfig.cs`

### Management backend

- [Accounts and access](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Controllers/AccountController.cs): `Carubbi.BotEditor.Backend.Api/Controllers/AccountController.cs`
- [Management API](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Controllers/BotController.cs): `Carubbi.BotEditor.Backend.Api/Controllers/BotController.cs`
- [Bot lifecycle](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Domain/Services/BotService.cs): `Carubbi.BotEditor.Backend.Domain/Services/BotService.cs`
- [Bot records](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Domain/Entities/Bot.cs): `Carubbi.BotEditor.Backend.Domain/Entities/Bot.cs`
- [SQL repositories](https://github.com/rcarubbi/carubbi.chatbotstudio/tree/master/Carubbi.BotEditor.Backend.DataAccess/Repositories): `Carubbi.BotEditor.Backend.DataAccess/Repositories`
- [Runtime client](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Integrations/BotRuntimeServiceClient.cs): `Carubbi.BotEditor.Backend.Api/Integrations/BotRuntimeServiceClient.cs`
- [Channel registration](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Backend.Api/Integrations/ChannelRegistrationServiceClient.cs): `Carubbi.BotEditor.Backend.Api/Integrations/ChannelRegistrationServiceClient.cs`

### Bot runtime

- [Runtime API](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs): `Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs`
- [Tenant configuration](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/TenantManager.cs): `Carubbi.BotEditor.Api/TenantManager.cs`
- [Message handling](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Controllers/MessagesController.cs): `Carubbi.BotEditor.Api/Controllers/MessagesController.cs`
- [Conversation steps](https://github.com/rcarubbi/carubbi.chatbotstudio/tree/master/Carubbi.BotEditor.Api/Dialogs): `Carubbi.BotEditor.Api/Dialogs`
- [Form-step runtime](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/Forms/FormStepService.cs): `Carubbi.BotEditor.Api/Forms/FormStepService.cs`
- [Direct Line connector](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/carubbi-botconnector/src/directline/bridge.js): `carubbi-botconnector/src/directline/bridge.js`

### Bot integrations

- [External capability services](https://github.com/rcarubbi/carubbi.chatbotstudio/tree/master/Carubbi.BotEditor.Services): `Carubbi.BotEditor.Services`
- [Speech synthesis](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Services/SpeechSysthesizer/SpeechSynthesizerManager.cs): `Carubbi.BotEditor.Services/SpeechSysthesizer/SpeechSynthesizerManager.cs`

### State and persistence

- [Conversation state](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/State/StateManager.cs): `Carubbi.BotEditor.Api/State/StateManager.cs`
- [Bot data store](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/BotOverrides/Autofac/BotDataStoreModule.cs): `Carubbi.BotEditor.Api/BotOverrides/Autofac/BotDataStoreModule.cs`
- [Activity logging](https://github.com/rcarubbi/carubbi.chatbotstudio/blob/master/Carubbi.BotEditor.Api/State/SqlActivityLogger.cs): `Carubbi.BotEditor.Api/State/SqlActivityLogger.cs`

### Other components

- **Bot author**
- **Channel service**
- **Chat participant**

## Connections

- Bot author → Studio UI: authors in (evidence: `README.md`)
- Studio UI → Blockly editor: edits flows (evidence: `README.md`)
- Blockly editor → Bot definition: generates definition (evidence: `README.md`)
- Studio UI → Management API: manages bots (evidence: `README.md`)
- Management API → Bot lifecycle: delegates lifecycle
- Bot lifecycle → Bot records: creates versions (evidence: `Carubbi.BotEditor.Backend.Domain/Services/BotService.cs`)
- Bot lifecycle → SQL repositories: uses repository (evidence: `Carubbi.BotEditor.Backend.Domain/Services/BotService.cs`)
- Bot lifecycle → Runtime client: publishes runtime (evidence: `Carubbi.BotEditor.Backend.Domain/Services/BotService.cs`)
- Bot lifecycle → Channel registration: registers channels (evidence: `Carubbi.BotEditor.Backend.Domain/Services/BotService.cs`)
- Channel registration → Channel service: calls registration
- Runtime client → Runtime API: calls runtime
- Runtime API → Form-step runtime: builds forms (evidence: `Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs`)
- Runtime API → Tenant configuration: configures tenant (evidence: `Carubbi.BotEditor.Api/Controllers/BotRuntimeController.cs`)
- Chat participant → Message handling: sends activity (evidence: `README.md`)
- Message handling → Conversation steps: dispatches dialogue (evidence: `Carubbi.BotEditor.Api/Controllers/MessagesController.cs`)
- Message handling → Bot definition: loads bot config (evidence: `Carubbi.BotEditor.Api/Controllers/MessagesController.cs`)
- Message handling → Bot data store: uses bot store (evidence: `Carubbi.BotEditor.Api/Controllers/MessagesController.cs`)
- Tenant configuration → Bot data store: registers tenant store (evidence: `Carubbi.BotEditor.Api/TenantManager.cs`)
- Message handling → Activity logging: records activity
- Direct Line connector → Message handling: bridges messages
- Conversation steps → External capability services: uses configured services (evidence: `README.md`)
- Message handling → Speech synthesis: resolves recognition (evidence: `Carubbi.BotEditor.Api/Controllers/MessagesController.cs`)
- Speech synthesis → External capability services: synthesizes speech (evidence: `Carubbi.BotEditor.Services/SpeechSysthesizer/SpeechSynthesizerManager.cs`)
- Message handling → Conversation state: clears dialog state (evidence: `Carubbi.BotEditor.Api/Controllers/MessagesController.cs`)
