Architecture
How MyBotBox is built — the C4 model, request pipeline, multi-tenancy, and execution data flow.
MyBotBox is a multi-tenant platform for building, deploying, and running AI agent workflows. This section is the system-design reference: how the pieces fit together, how a request is authenticated and authorized, how tenants are isolated, and how a workflow actually runs.
These pages describe the hosted architecture. The same codebase is self-hostable — every external dependency (database, cache, queue, storage, email, LLM provider) sits behind a swappable port, so you can point it at your own infrastructure.
At a glance
graph LR
subgraph BUILD ["Build"]
A[Visual Canvas] --> B[190 Blocks]
end
subgraph ENGINE ["Engine"]
C[Serializer] --> D[Executor DAG]
D --> E[30 Block Handlers]
end
subgraph DEPLOY ["Deploy"]
F[REST API]
G[Webhook]
H[Schedule / Poll]
I[Chat]
end
B --> C
E --> F & G & H & IA workflow is authored on a ReactFlow canvas, serialized into an execution graph, run by a topological DAG executor that dispatches each node to a typed handler, and deployed as an immutable version reachable by API, webhook, schedule, poll, or chat.
In this section
C4 model
Context → Container → Deployment → Component → Code views of the platform.
Request pipeline
The shared authentication, authorization, and rate-limit gates every API call passes.
Multi-tenancy
Organizations, workspaces, workflows, the permissions model, and the YID identifier.
Execution & data flow
How a run moves from trigger to handlers to logs and cost metering.
Technology
| Layer | Technology |
|---|---|
| Runtime | Bun, Turborepo monorepo |
| Framework | Next.js 16 (App Router), React 19, TypeScript (strict) |
| Database | PostgreSQL 17 (Cloud SQL) + pgvector, Drizzle ORM (90 tables) |
| Cache / rate-limit | Memorystore Redis 7 (sliding window), in-memory fallback |
| Queue | Cloud Tasks + Cloud Functions (async dispatch, polling) |
| Auth | Firebase Auth (OAuth, SSO/SAML, TOTP), JWT session cookie |
| AI | 17 provider adapters (OpenAI, Anthropic, Gemini, Bedrock, …) |
| Payments | Stripe (subscriptions + usage metering) |
| Hosting | Google Cloud Run (blue-green canary deploy) |
| Observability | OpenTelemetry, Sentry, Datadog |