Typebot
Audited from github.com/baptisteArno/typebot.io
Typebot is a chatbot builder: a visual editor for designing conversation flows, a separate runtime that serves the chats, and JavaScript and React embed libraries that put them on websites, with results collected per bot.
- Language
- TypeScript
- Database
- PostgreSQL
- Hosting
- Docker
- Running for
- 3 years 4 months
- Team
- Solo
Why this architecture
The editor and the chat runtime are separate Next.js apps built from one Dockerfile, so the public chat runtime scales apart from the editor. Bot logic, Forge integration blocks and the Prisma schema live in shared Bun workspace packages that both apps use.
Tech stack by layer
20 technologies · audited Oct 5, 2026- Next.jsNext.js 16 runs both the builder (apps/builder) and the chat runtime (apps/viewer) as separate apps.
- ReactReact 19 renders the builder UI; drag and drop on the flow canvas uses @dnd-kit/react.
- Tailwind CSSTailwind CSS 4 through @tailwindcss/postcss styles the builder.
- ZustandClient state in the builder, with shared-zustand to sync stores across tabs.
- TanStack StartThe marketing site (apps/landing-page) is a separate TanStack Start + Vite 8 app with MDX via content-collections.
- TypeScriptThe only application language; every app and package is a Bun workspace written in TypeScript 5.
- oRPCTyped procedures and OpenAPI output for the builder, viewer, bot engine and billing packages.
- EffectEffect 4 (beta) is used across lib, auth, config, emails, prisma and the Bun workflows app.
- NextAuth.jsSign-in for the builder through next-auth 5 (beta) in packages/auth, with Upstash rate limiting.
- Vercel AI SDKpackages/ai wraps the ai package (v5) for AI blocks; the openai client is also used directly.
- StripeWorkspace billing in packages/billing and the payment input that chats can collect.
- PrismaPrisma 7 schema and migrations in packages/prisma, with pg and PlanetScale driver adapters and read replicas.
- PostgreSQLDefault database; docker-compose.yml runs postgres:16 and the workflows app reads it through @effect/sql-pg.
- MySQLSupported as an alternative: packages/prisma has a db:generate:mysql script and a PlanetScale adapter.
- RedisRequired by both containers in docker-compose.yml; packages/lib connects with ioredis.
- MinIOpackages/lib uses the MinIO client to talk to S3-compatible object storage.
- DockerOne parameterised Dockerfile (ARG SCOPE) builds either the builder or the viewer image from Next.js standalone output.
- BunPackage manager (bun@1.3.9), Docker base layer and the runtime for apps/workflows.
- NxNx 22 orchestrates builds and tests with cached esbuild and Vitest targets.
- PartyKitpackages/partykit is deployed by its own workflow; the webhook block, builder and viewer use partysocket.
- SentryError reporting in the Next.js apps (@sentry/nextjs) and the Bun workflows app (@sentry/bun).
- OpenTelemetryTracing through the OpenTelemetry Node SDK, @effect/opentelemetry and @orpc/otel in the builder.
- PlaywrightEnd-to-end tests in packages/playwright and the root tests/ directory.
- VitestUnit tests (root vitest.config.ts, Nx Vitest targets); packages/config pulls in Testcontainers for Postgres.
- BiomeFormatting and linting (biome.json, format-and-lint scripts) instead of ESLint and Prettier.
- GitHub ActionsTypecheck, release, npm publishing of the embeds, PartyKit and workflows deploys, and daily/hourly/monthly jobs.
- AGENTS.mdRoot AGENTS.md and CLAUDE.md plus skills in .agents/skills, .claude/skills and .github/skills guide coding agents.
Typebot architecture diagram
Open SVGDiagram as text
- Builder UI (React 19 · dnd-kit) → Builder app (Next.js · oRPC): edit bots
- Embedded chat (JS and React embeds) → Viewer (Next.js · bot-engine): chat sessions
- Builder app (Next.js · oRPC) → PostgreSQL / MySQL (Prisma 7): Prisma
- Viewer (Next.js · bot-engine) → PostgreSQL / MySQL (Prisma 7): results
- Viewer (Next.js · bot-engine) → Redis (ioredis)
- Builder app (Next.js · oRPC) → Redis (ioredis)
- Viewer (Next.js · bot-engine) → Object storage (MinIO client (S3)): file uploads
- Viewer (Next.js · bot-engine) → Integrations (Forge blocks): run blocks
- Builder app (Next.js · oRPC) → Realtime (PartyKit): partysocket
- Viewer (Next.js · bot-engine) → Realtime (PartyKit): partysocket
- Workflows (Effect on Bun) → PostgreSQL / MySQL (Prisma 7): @effect/sql-pg
Key architectural decisions
6 decisions- 01
Builder and viewer are separate Next.js apps and separate containers
apps/builder is the editor and apps/viewer serves chats. One Dockerfile builds either through ARG SCOPE, and docker-compose.yml runs them as typebot-builder (8080) and typebot-viewer (8081) against the same Postgres and Redis, so the public chat runtime scales and deploys apart from the editor.
- 02
Integrations are workspace packages built on the Forge framework
The root workspaces include packages/forge/* and packages/forge/blocks/*, and apps/viewer depends on @typebot.io/forge and @typebot.io/forge-repository. Each integration block ships as its own package against one framework, and a create-new-block script scaffolds new ones.
- 03
Effect 4 runs through the codebase, and background jobs run on Bun
packages/lib, auth, config, emails, prisma and shared-core all depend on effect 4.0.0-beta. apps/workflows is a Bun program (@effect/platform-bun, @effect/sql-pg) with its own Dockerfile and deploy-workflows.yml, and daily, hourly and monthly workflows schedule recurring jobs.
- 04
One Prisma schema serves PostgreSQL or MySQL
packages/prisma ships @prisma/adapter-pg and @prisma/adapter-planetscale, a db:generate:mysql script and @prisma/extension-read-replicas, so self-hosters can use Postgres while the same code also runs on MySQL-compatible PlanetScale.
- 05
PartyKit is a separately deployed realtime service
packages/partykit holds the PartyKit server and deploy-partykit.yml ships it on its own. partysocket is a dependency of packages/blocks/webhook, apps/builder and apps/viewer, so realtime traffic goes through PartyKit instead of the Next.js servers.
- 06
The repository is set up for coding agents
The root has AGENTS.md and CLAUDE.md, skills under .agents/skills, .claude/skills and .github/skills, and Codex and Zed config, plus a plans/ directory (plans/biome-off-rules-plan.md) and a setup-worktree script for parallel work.
How Typebot is built
How Typebot is structured
Typebot is one TypeScript monorepo. Bun manages packages (packageManager: bun@1.3.9) and Nx 22 orchestrates builds through the @nx/next, @nx/vite and @nx/js plugins in nx.json. The root package.json declares workspaces for apps/*, packages/*, packages/forge/*, packages/forge/blocks/*, packages/blocks/*, packages/embeds/*, packages/services/* and packages/deprecated/*.
The apps:
| Path | What it is |
|---|---|
apps/builder |
The editor where bots are designed, published and analysed (Next.js 16) |
apps/viewer |
The runtime that serves chats to visitors (Next.js 16) |
apps/workflows |
A Bun program for background jobs, built on Effect |
apps/landing-page |
The marketing site, a TanStack Start + Vite 8 app |
apps/docs |
The documentation site |
Most logic lives in packages that the apps share. packages/bot-engine executes a bot. packages/chat-api and packages/chat-session define the chat protocol and session state. packages/forge is the integration framework. packages/prisma owns the database schema. Smaller packages split the domain into conditions, variables, groups, results, credentials, workspaces, billing, emails and whatsapp.
Frontend
The builder uses React 19 with Tailwind CSS 4 (@tailwindcss/postcss). Flow editing relies on @dnd-kit/react for drag and drop and @use-gesture/react for canvas gestures. Code fields use CodeMirror through @uiw/react-codemirror. Client state is held in Zustand with shared-zustand. Server data flows through TanStack Query and the oRPC client (@orpc/tanstack-query). The builder is translated with Tolgee: there is a .tolgeerc file and @tolgee/react, plus sync-locales, pull-locales and push-locales scripts at the root. Media pickers pull from Giphy, Unsplash and Pexels.
Chats reach websites through embed libraries in packages/embeds. Two workflows, publish-typebot-js.yml and publish-typebot-react.yml, publish them, and check-embeds-version-bump.yml with scripts/assert-embeds-version-bumped.sh guards their versioning.
Backend & APIs
There is no separate API server; both Next.js apps carry their own server code. Procedures are defined with oRPC (@orpc/server, @orpc/zod, @orpc/openapi) in the builder, the viewer, packages/bot-engine and packages/billing, with Zod 4 schemas. The bot engine pulls in the block packages and the logic it needs at runtime: Stripe for payment inputs, google-spreadsheet for Sheets, nodemailer for email, openai for AI, and chrono-node and libphonenumber-js for parsing input.
AI blocks go through packages/ai, which wraps the Vercel AI SDK (ai 5) on top of Forge. Builder sign-in uses next-auth 5 (beta) in packages/auth, rate limited with @upstash/ratelimit. Outgoing webhooks from the builder use Svix. Transactional email is written with React Email in packages/emails.
Data & persistence
packages/prisma holds the Prisma 7 schema (the release image copies packages/prisma/postgresql) and the scripts db:generate, db:push, migrate:deploy and db:migrate. It loads two driver adapters, @prisma/adapter-pg and @prisma/adapter-planetscale, plus @prisma/extension-read-replicas. A db:generate:mysql script makes MySQL a supported target next to PostgreSQL. The workflows app skips Prisma at runtime and queries Postgres through @effect/sql-pg.
Redis is a hard dependency: in docker-compose.yml both app containers wait for typebot-redis to be healthy and get REDIS_URL, and packages/lib connects with ioredis. File storage is S3-compatible, reached through the MinIO client in packages/lib.
Realtime / collaboration
packages/partykit contains a PartyKit server that deploy-partykit.yml deploys separately from the Next.js apps. Three packages depend on partysocket: packages/blocks/webhook, apps/builder and apps/viewer. The audited files do not show the exact messages exchanged, but realtime connections go to PartyKit, not to the Next.js servers.
Build, test & deploy
The root Dockerfile builds the image in three stages: install Bun on a Node 24 base, build with bunx nx build ${SCOPE}, then copy the Next.js standalone output, the Prisma schema and scripts/${SCOPE}-entrypoint.sh into the release stage. apps/workflows/Dockerfile bundles the workflows app into a single dist/index.js that runs on oven/bun.
Biome formats and lints (biome.json, format-and-lint), and sherif checks the monorepo. Unit tests use Vitest (root vitest.config.ts, cached @nx/vitest:test targets). packages/config brings in @testcontainers/postgresql so tests can run against a real database. Playwright end-to-end tests live in packages/playwright and tests/, which has scenarios such as auth-redirect, webhook, preview-sessions and whatsapp-session-access. Errors go to Sentry, and the builder exports traces through the OpenTelemetry Node SDK, @effect/opentelemetry and @orpc/otel.
Self-hosting notes
docker-compose.yml is the self-hosting path. It starts four containers on one bridge network:
postgres:16redis:alpine(with--save 60 1)baptistearno/typebot-builderon port 8080baptistearno/typebot-vieweron port 8081
All four share a .env file, and .env.example documents the variables. Because builder and viewer are separate images, the viewer can run more replicas when chat traffic grows. The README calls the project Fair Source, and GitHub does not detect a standard SPDX license, so check LICENSE before running it commercially.
What to copy (and what not to)
Copy:
- One Dockerfile for several apps. A single Dockerfile with a
SCOPEargument turns each Next.js app into its ownstandaloneimage without duplicating build logic. - One package per integration. Making integrations workspace packages on a shared framework (
packages/forge,packages/forge/blocks/*) keeps each one small and lets a scaffolding script (create-new-block) set the conventions. - Background jobs outside the web apps. Moving background jobs into their own Bun process (
apps/workflows) keeps cron-like work out of request handlers.
Think twice:
- Effect 4 beta everywhere.
effectis pinned to the same beta in at least eight packages (the builder, workflows, lib, auth, config, emails, prisma and shared-core), so every upgrade touches the whole monorepo. - Two databases. Supporting PostgreSQL and MySQL from one Prisma schema doubles the database surface you have to test.
Sources & repo audit
- Audited
- Oct 5, 2026
- Commit
- b19de80
- License
- NOASSERTION
- Root package.json (Bun workspaces, Nx, Biome, scripts)
- apps/builder/package.json (editor app dependencies)
- apps/viewer/package.json (chat runtime dependencies)
- apps/workflows/package.json (Effect on Bun background app)
- packages/prisma/package.json (Prisma adapters and database scripts)
- Dockerfile (SCOPE-parameterised builder/viewer image)
- docker-compose.yml (self-hosting: Postgres 16, Redis, builder, viewer)
Independent analysis of repository at github.com/baptisteArno/typebot.io. Spotted an inaccuracy? Use the claim form to request a correction.
Show this stack on your README or website
[](https://stackitfast.com/project/typebot)Paste it into your README. It shows your current stack and links to this page.
Scaffold it with your agent
Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Typebot's architecture.
- 1Copy the promptThe full markdown spec, with every layer and decision.
- 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
- 3Paste and scaffoldUse it as the first instruction; review before you ship.
# MISSION: Scaffold "Typebot" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Typebot**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Typebot
- **What It Does**: Typebot is a chatbot builder: a visual editor for designing conversation flows, a separate runtime that serves the chats, and JavaScript and React embed libraries that put them on websites, with results collected per bot.
- **Domain & Category**: Conversational Form Builder
- **Production Scale**: Solo
- **Development Mode**: AI-AGENT
- **Architectural Rationale**: The editor and the chat runtime are separate Next.js apps built from one Dockerfile, so the public chat runtime scales apart from the editor. Bot logic, Forge integration blocks and the Prisma schema live in shared Bun workspace packages that both apps use.
- **Live Website Reference**: https://typebot.io
- **Source Repository**: https://github.com/baptisteArno/typebot.io
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: TypeScript, Next.js, React, Tailwind CSS, Prisma, PostgreSQL, MySQL, Redis, Docker, Bun, Nx, Effect, Zod, TanStack Start, Stripe, Vercel AI SDK, Sentry, OpenTelemetry, Playwright, Biome
- **Primary Language(s)**: TypeScript, MDX, CSS, JavaScript, PHP, Shell
- **License of the reference repo**: NOASSERTION
- **Frontend**: Next.js — Next.js 16 runs both the builder (apps/builder) and the chat runtime (apps/viewer) as separate apps.; React — React 19 renders the builder UI; drag and drop on the flow canvas uses @dnd-kit/react.; Tailwind CSS — Tailwind CSS 4 through @tailwindcss/postcss styles the builder.; Zustand — Client state in the builder, with shared-zustand to sync stores across tabs.; TanStack Start — The marketing site (apps/landing-page) is a separate TanStack Start + Vite 8 app with MDX via content-collections.
- **Backend & APIs**: TypeScript — The only application language; every app and package is a Bun workspace written in TypeScript 5.; oRPC — Typed procedures and OpenAPI output for the builder, viewer, bot engine and billing packages.; Effect — Effect 4 (beta) is used across lib, auth, config, emails, prisma and the Bun workflows app.; NextAuth.js — Sign-in for the builder through next-auth 5 (beta) in packages/auth, with Upstash rate limiting.; Vercel AI SDK — packages/ai wraps the ai package (v5) for AI blocks; the openai client is also used directly.; Stripe — Workspace billing in packages/billing and the payment input that chats can collect.
- **Data & persistence**: Prisma — Prisma 7 schema and migrations in packages/prisma, with pg and PlanetScale driver adapters and read replicas.; PostgreSQL — Default database; docker-compose.yml runs postgres:16 and the workflows app reads it through @effect/sql-pg.; MySQL — Supported as an alternative: packages/prisma has a db:generate:mysql script and a PlanetScale adapter.; Redis — Required by both containers in docker-compose.yml; packages/lib connects with ioredis.; MinIO — packages/lib uses the MinIO client to talk to S3-compatible object storage.
- **Infrastructure & deploy**: Docker — One parameterised Dockerfile (ARG SCOPE) builds either the builder or the viewer image from Next.js standalone output.; Bun — Package manager (bun@1.3.9), Docker base layer and the runtime for apps/workflows.; Nx — Nx 22 orchestrates builds and tests with cached esbuild and Vitest targets.; PartyKit — packages/partykit is deployed by its own workflow; the webhook block, builder and viewer use partysocket.; Sentry — Error reporting in the Next.js apps (@sentry/nextjs) and the Bun workflows app (@sentry/bun).; OpenTelemetry — Tracing through the OpenTelemetry Node SDK, @effect/opentelemetry and @orpc/otel in the builder.
- **Tooling, testing & ops**: Playwright — End-to-end tests in packages/playwright and the root tests/ directory.; Vitest — Unit tests (root vitest.config.ts, Nx Vitest targets); packages/config pulls in Testcontainers for Postgres.; Biome — Formatting and linting (biome.json, format-and-lint scripts) instead of ESLint and Prettier.; GitHub Actions — Typecheck, release, npm publishing of the embeds, PartyKit and workflows deploys, and daily/hourly/monthly jobs.; AGENTS.md — Root AGENTS.md and CLAUDE.md plus skills in .agents/skills, .claude/skills and .github/skills guide coding agents.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/baptisteArno/typebot.io @ b19de80)
1. **Builder and viewer are separate Next.js apps and separate containers**: apps/builder is the editor and apps/viewer serves chats. One Dockerfile builds either through ARG SCOPE, and docker-compose.yml runs them as typebot-builder (8080) and typebot-viewer (8081) against the same Postgres and Redis, so the public chat runtime scales and deploys apart from the editor.
2. **Integrations are workspace packages built on the Forge framework**: The root workspaces include packages/forge/* and packages/forge/blocks/*, and apps/viewer depends on @typebot.io/forge and @typebot.io/forge-repository. Each integration block ships as its own package against one framework, and a create-new-block script scaffolds new ones.
3. **Effect 4 runs through the codebase, and background jobs run on Bun**: packages/lib, auth, config, emails, prisma and shared-core all depend on effect 4.0.0-beta. apps/workflows is a Bun program (@effect/platform-bun, @effect/sql-pg) with its own Dockerfile and deploy-workflows.yml, and daily, hourly and monthly workflows schedule recurring jobs.
4. **One Prisma schema serves PostgreSQL or MySQL**: packages/prisma ships @prisma/adapter-pg and @prisma/adapter-planetscale, a db:generate:mysql script and @prisma/extension-read-replicas, so self-hosters can use Postgres while the same code also runs on MySQL-compatible PlanetScale.
5. **PartyKit is a separately deployed realtime service**: packages/partykit holds the PartyKit server and deploy-partykit.yml ships it on its own. partysocket is a dependency of packages/blocks/webhook, apps/builder and apps/viewer, so realtime traffic goes through PartyKit instead of the Next.js servers.
6. **The repository is set up for coding agents**: The root has AGENTS.md and CLAUDE.md, skills under .agents/skills, .claude/skills and .github/skills, and Codex and Zed config, plus a plans/ directory (plans/biome-off-rules-plan.md) and a setup-worktree script for parallel work.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
- Structure as a Turborepo monorepo with strict package boundaries:
- `apps/web`: Application UI, routing, layouts, and server endpoints.
- `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
- `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
- `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
- Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
- Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
- Utilize Next.js 15 App Router: default to React Server Components (RSC) for data fetching. Handle mutations through Server Actions with Zod validation. Keep 'use client' directives restricted strictly to interactive leaf components.
4. **Design System & Aesthetics**:
- Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
- Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
- Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
- Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (Prisma, PostgreSQL, MySQL, Redis, MinIO): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.Frequently asked about Typebot
What is Typebot built with?
Typebot is a TypeScript monorepo on Bun and Nx. The builder and the chat runtime are separate Next.js 16 apps with React 19, data goes through Prisma 7 to PostgreSQL (or MySQL), Redis is required at runtime, and background jobs run on Effect 4 in a Bun app.
Can I self-host Typebot?
Yes. The repository ships a docker-compose.yml that runs four containers: Postgres 16, Redis, the typebot-builder image on port 8080 and the typebot-viewer image on port 8081, configured from an .env file.
Does Typebot work with MySQL?
The Prisma package supports it: packages/prisma has a db:generate:mysql script and a PlanetScale driver adapter next to the pg adapter. PostgreSQL is the default in the bundled docker-compose.yml.
How are Typebot integrations built?
Integrations are blocks built on the Forge framework in packages/forge. Each block is its own workspace package under packages/forge/blocks, and the root create-new-block script scaffolds new ones.
What license is Typebot under?
The README describes Typebot as Fair Source. GitHub does not detect a standard SPDX license in its LICENSE file, so read that file before using the code commercially.
One email a month: new deep dives and stack trends
New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.
Similar architectures
- FormbricksAI-agentSurvey & Feedback SaaS · 2-5 peopleShares Next.js · TypeScript · Prisma
- TaxonomyAI-agentOpen-Source SaaS Template · 1-5 peopleShares Next.js · React · TypeScript
- Cal.comClassicScheduling SaaS · 6-20 peopleShares TypeScript · Next.js · React
- OpenSEOHybridOpen-Source SEO Research Platform · 2-5 peopleShares TypeScript · React · TanStack Start
- UmamiHybridWeb Analytics · SoloShares TypeScript · Next.js · React
- DocumensoAI-agentE-signature SaaS · 2-5 peopleShares React · TypeScript · Prisma