Skip to main content

System Architecture

ClaraVerse is a self-hosted AI workspace with six core services orchestrated by Docker Compose. All services run on a single bridge network (claraverse-network) and communicate internally by container name.

Service Overview​

ServiceTechnologyPortRole
FrontendReact 19 / Vite / Nginx80Web UI, static asset serving
BackendGo 1.24+ / Fiber3001REST API, WebSocket, tool execution
MongoDBMongoDB 727017Users, agents, workflows, credentials, memories
MySQLMySQL 8.03306AI providers, models, capabilities, MCP servers
RedisRedis 7 Alpine6379Job scheduler, WebSocket pub/sub, sessions
SearXNGSearXNG (latest)8080 (internal)Self-hosted meta-search engine

Network Diagram​

                        Internet
|
Port 80 Port 3001
| |
┌────────────────────┼──────────┼────────────────────────┐
│ claraverse-network (bridge) │
│ | | │
│ ┌─────────────┐ │ ┌──────────────┐ │
│ │ Frontend │ │ │ Backend │ │
│ │ (Nginx) │──┘ │ (Go Fiber) │ │
│ └─────────────┘ └──────┬───────┘ │
│ │ │
│ ┌────────┬───────────┼───────────┐ │
│ ▼ ▼ ▼ ▼ │
│ ┌─────────┐ ┌───────┐ ┌─────────┐ ┌─────────┐ │
│ │ MongoDB │ │ MySQL │ │ Redis │ │ SearXNG │ │
│ │ :27017 │ │ :3306 │ │ :6379 │ │ :8080 │ │
│ └─────────┘ └───────┘ └─────────┘ └─────────┘ │
└──────────────────────────────────────────────────────────┘

Data Flow​

Chat Messages​

  1. User sends a message in the browser.
  2. The frontend stores the message locally in IndexedDB (zero-knowledge design).
  3. A WebSocket frame is sent to the backend on port 3001.
  4. The backend validates the JWT, checks rate limits, and forwards the message to the configured LLM provider.
  5. Streamed response chunks flow back over the same WebSocket connection.
  6. If the LLM triggers a tool call (web search, code execution, etc.), the backend executes it and returns the result inline.

Workflow Execution​

  1. A trigger fires (manual, scheduled via Redis cron, or API call).
  2. The backend loads the agent and workflow definition from MongoDB.
  3. Nodes execute sequentially or in parallel, each running tool calls or LLM requests.
  4. Execution history is saved to MongoDB. Optional webhook notifications are dispatched.

What Each Database Stores​

MongoDB (Document Data)​

CollectionContents
usersAccounts and preferences
agentsAgent definitions and configurations
workflowsVisual workflow definitions
workflow_versionsVersion history for workflows
executionsAgent execution logs
credentialsEncrypted integration credentials
memoriesClara memory system entries
chat_sessionsOptional encrypted chat sync
analyticsUsage analytics

MySQL (Relational Data)​

TableContents
providersAI provider configs (OpenAI, Anthropic, etc.)
modelsAvailable models per provider
model_aliasesAlternate names for models
model_capabilitiesPer-model feature flags
mcp_serversMCP server configurations
mcp_server_toolsTools exposed by MCP servers

Redis (Ephemeral Data)​

Key PatternPurpose
scheduler:*Cron job schedules
pubsub:*WebSocket message routing across instances
session:*Session data
ratelimit:*Rate limiter counters

External / Optional Services​

ServicePurposeRequired?
SearXNGWeb search tool for agentsYes (included in Compose)
E2BSandboxed Python code executionNo -- requires E2B_API_KEY
ComposioOAuth integrations (Google Sheets, Gmail, etc.)No -- requires COMPOSIO_API_KEY

Scaling Notes​

  • Backend is horizontally scalable. Redis pub/sub handles WebSocket message routing across multiple instances.
  • Frontend serves static assets through Nginx and is CDN-friendly.
  • Databases follow standard MySQL/MongoDB replication and sharding patterns.
  • For a single-server deployment (the typical self-hosting scenario), the default resource limits in docker-compose.yml work well for up to ~50 concurrent users.