A decoupled agentic AI chat interface that separates the presentation layer (React frontend) from the orchestration logic (n8n workflow backend). This architecture enables sophisticated AI behaviors—including reasoning visualization, tool usage transparency, and multimodal file analysis—while maintaining a brandable, zero-code configurable frontend.
- Real-time Streaming: SSE (Server-Sent Events) for live AI response visualization
- Tool Call Transparency: Visualize AI "thinking" and tool execution in real-time
- Developer Metrics: Token usage and latency tracking via n8n REST API
- Zero-Code Branding: Configure colors, fonts, and styling via JSON—no code changes required
- AI-Powered Theme Extraction: Perplexity Wizard automatically extracts branding from any website
- Multi-Company Watermarking: Display multiple partner/agency logos as configurable watermarks
- Multimodal Support: Handle file uploads with image thumbnail previews in messages
- Shareable Sessions: URL-based session management for conversation continuity
┌─────────────────────────────────────────────────────────────────────┐
│ CLIENT (React Frontend) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌────────────┐ │
│ │ ChatInput │ │MessageBubble│ │ThemeInjector│ │ToolCall │ │
│ │ │ │ │ │ │ │ Indicator │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ └────────────┘ │
│ │ ▲ │
└──────────────┼──────────────┼───────────────────────────────────────┘
│ │
POST (multipart) │ SSE (text/event-stream)
│ │
▼ │
┌─────────────────────────────────────────────────────────────────────┐
│ BACKEND (n8n Workflow) │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────────┐ │
│ │ Webhook │──│ AI Agent │──│ Tools (Vector Store, │ │
│ │ Node │ │ Node │ │ Functions, Sub-workflows) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
n8n_chat_ux/
├── README.md # This file
├── src/
│ ├── frontend/ # React + TypeScript + Vite application
│ │ ├── README.md # Frontend documentation
│ │ ├── src/
│ │ │ ├── components/ # UI components (Chat, Messages, Theming, Settings)
│ │ │ ├── services/ # API, stream parsing, Perplexity integration
│ │ │ └── types/ # TypeScript type definitions
│ │ └── public/config.json # Zero-code branding configuration
│ └── docker/ # Container configurations
│ ├── README.md # Docker overview
│ └── local-n8n/ # Local n8n development environment
│ └── README.md # n8n setup instructions
└── references/ # Research & reference materials
└── README.md # Research documentation index
- Node.js 18+
- Docker & Docker Compose
cd src/docker/local-n8n
docker-compose up -dAccess n8n at http://localhost:5678
cd src/frontend
npm install
npm run devAccess the chat UI at http://localhost:5173
Click the ⚙️ button to open Settings and configure:
- n8n Connection: Set your webhook URL
- Identity: Bot name, avatar, intro message, system prompt
- Theme Colors: Primary, secondary, background, surface colors
- Integrator Branding: Optional watermark with your company logo
To enable token usage tracking in the metrics display:
- Copy
src/frontend/public/n8n-api-key.template.jsonton8n-api-key.json - Generate an API key from n8n Settings → API
- Replace the placeholder in the JSON file with your key
Once configured, messages display latency and token counts (input/output).
The Perplexity Wizard requires an API key to extract branding automatically:
Option A: Configuration File (Recommended)
- Copy
src/frontend/public/perplexity-api-key.template.jsontoperplexity-api-key.json - Replace the placeholder with your actual API key from perplexity.ai/settings/api
- The file is gitignored for security
Option B: Settings UI
- Open Settings → Perplexity Wizard section
- Enter your API key directly (stored in browser session only)
- Enter a website URL
- Click "✨ Run Wizard" to extract colors, bot name, intro message, and system prompt
Edit src/frontend/public/config.json or use the Settings UI:
{
"identity": {
"botName": "n8n Assistant",
"avatarUrl": "",
"introMessage": "Hello! How can I help you today?",
"systemPrompt": "You are a helpful AI assistant..."
},
"theme": {
"primaryColor": "#ff6d5a",
"secondaryColor": "#ff8f7e",
"backgroundColor": "#0f0f23"
},
"n8n": {
"webhookUrl": "http://localhost:5678/webhook/chat"
},
"branding": {
"enabled": true,
"companies": [
{ "id": "1", "name": "n8n", "logoUrl": "/n8n-logo.svg", "linkUrl": "https://n8n.io" }
],
"position": "bottom-right",
"opacity": 0.4,
"size": 48
}
}| Directory | Purpose |
|---|---|
| src/frontend/README.md | Frontend architecture, components, and configuration |
| src/docker/README.md | Docker environments overview |
| src/docker/local-n8n/README.md | Local n8n setup and usage |
| references/README.md | Research documents and design rationale |
This architecture addresses key challenges in enterprise AI deployment:
- Separation of Concerns: AI logic (n8n) iterates independently from UI (React)—no frontend deployments needed for prompt changes
- Transparency: Users see what the AI is doing, building trust through visibility
- Flexibility: Brand the interface for any client without code changes
- Visual Attachments: Uploaded images display as thumbnails in message bubbles
- Scalability: n8n workflows scale independently from the frontend
- White-Labeling: Integrator watermarking enables reseller/partner branding
| Layer | Technology |
|---|---|
| Frontend | React 18, TypeScript, Vite |
| Styling | CSS Modules, CSS Custom Properties |
| AI Extraction | Perplexity API (Sonar model) |
| Backend | n8n (workflow automation) |
| Communication | SSE (streaming), multipart/form-data (uploads) |
| Development | Docker Compose, ESLint |