# langflow-ai/langflow-embedded-chat architecture

> Architecture diagram of the GitHub repository langflow-ai/langflow-embedded-chat, 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/langflow-ai/langflow-embedded-chat
- Repository: https://github.com/langflow-ai/langflow-embedded-chat

## Overview

Langflow Embedded Chat is an embeddable web component for chatting with a Langflow flow. A host page supplies configuration; the widget manages open state and messages, the chat window accepts input and displays replies, and its controller sends requests to Langflow. The window renders messages and sending placeholders, while utilities handle response extraction, positioning, and header parsing. Styling and other behavior are configurable through the component API. Source excerpts show the request and rendering path; some widget internals are only partially excerpted, so links are limited to documented imports and visible calls.

Main entry points: [`src/chatWidget/chatWindow/index.tsx`](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatWindow/index.tsx) (Chat window), [`src/chatWidget/index.tsx`](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/index.tsx) (Chat widget), [`src/controllers/index.ts`](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/controllers/index.ts) (Request controller), [`src/chatWidget/utils.ts`](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/utils.ts) (Widget utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_embed["Embedding"]
  node_element["Custom element<br/>[index.tsx]"]
end

subgraph group_interface["Chat interface"]
  node_widget["Chat widget<br/>[index.tsx]"]
  node_trigger["Chat trigger<br/>[index.tsx]"]
  node_window["Chat window<br/>[index.tsx]"]
  node_message["Message renderer<br/>[index.tsx]"]
  node_placeholder["Sending placeholder<br/>[index.tsx]"]
end

subgraph group_runtime["Request runtime"]
  node_controller["Request controller<br/>[index.ts]"]
  node_utils["Widget utilities<br/>[utils.ts]"]
  node_types["Message types<br/>[index.ts]"]
end

node_host(("Host application"))
node_langflow["Langflow API"]

node_host -->|"embeds"| node_element
node_element -->|"registers"| node_widget
node_widget -->|"renders"| node_trigger
node_widget -->|"renders"| node_window
node_window -->|"sends request"| node_controller
node_controller -->|"posts flow input"| node_langflow
node_controller -->|"returns response"| node_window
node_window -->|"renders messages"| node_message
node_window -->|"renders while sending"| node_placeholder
node_window -->|"uses helpers"| node_utils
node_controller -->|"parses headers"| node_utils
node_widget -->|"parses headers"| node_utils
node_window -->|"uses message types"| node_types
node_message -->|"uses message types"| node_types
node_placeholder -->|"uses placeholder type"| node_types

click node_element "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/index.tsx"
click node_widget "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/index.tsx"
click node_trigger "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatTrigger/index.tsx"
click node_window "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatWindow/index.tsx"
click node_message "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatWindow/chatMessage/index.tsx"
click node_placeholder "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatPlaceholder/index.tsx"
click node_controller "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/controllers/index.ts"
click node_utils "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/utils.ts"
click node_types "https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/types/chatWidget/index.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_element toneBlue
class node_widget,node_trigger,node_window,node_message,node_placeholder toneAmber
class node_controller,node_utils,node_types,node_langflow toneMint
class node_host toneIndigo
```

## Components

### Embedding

- [Custom element](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/index.tsx): `src/index.tsx`

### Chat interface

- [Chat widget](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/index.tsx): `src/chatWidget/index.tsx`
- [Chat trigger](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatTrigger/index.tsx): `src/chatWidget/chatTrigger/index.tsx`
- [Chat window](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatWindow/index.tsx): `src/chatWidget/chatWindow/index.tsx`
- [Message renderer](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/chatWindow/chatMessage/index.tsx): `src/chatWidget/chatWindow/chatMessage/index.tsx`
- [Sending placeholder](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatPlaceholder/index.tsx): `src/chatPlaceholder/index.tsx`

### Request runtime

- [Request controller](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/controllers/index.ts): `src/controllers/index.ts`
- [Widget utilities](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/chatWidget/utils.ts): `src/chatWidget/utils.ts`
- [Message types](https://github.com/langflow-ai/langflow-embedded-chat/blob/main/src/types/chatWidget/index.ts): `src/types/chatWidget/index.ts`

### Other components

- **Host application**
- **Langflow API**

## Connections

- Host application → Custom element: embeds (evidence: `README.md`)
- Custom element → Chat widget: registers (evidence: `src/index.tsx`)
- Chat widget → Chat trigger: renders (evidence: `src/chatWidget/index.tsx`)
- Chat widget → Chat window: renders (evidence: `src/chatWidget/index.tsx`)
- Chat window → Request controller: sends request (evidence: `src/chatWidget/chatWindow/index.tsx`)
- Request controller → Langflow API: posts flow input (evidence: `src/controllers/index.ts`)
- Request controller → Chat window: returns response (evidence: `src/chatWidget/chatWindow/index.tsx`)
- Chat window → Message renderer: renders messages (evidence: `src/chatWidget/chatWindow/index.tsx`)
- Chat window → Sending placeholder: renders while sending (evidence: `src/chatWidget/chatWindow/index.tsx`)
- Chat window → Widget utilities: uses helpers (evidence: `src/chatWidget/chatWindow/index.tsx`)
- Request controller → Widget utilities: parses headers (evidence: `src/controllers/index.ts`)
- Chat widget → Widget utilities: parses headers (evidence: `src/chatWidget/index.tsx`)
- Chat window → Message types: uses message types (evidence: `src/chatWidget/chatWindow/index.tsx`)
- Message renderer → Message types: uses message types (evidence: `src/chatWidget/chatWindow/chatMessage/index.tsx`)
- Sending placeholder → Message types: uses placeholder type (evidence: `src/chatPlaceholder/index.tsx`)
