# Typebot

Build chatbots visually and embed them anywhere, with bots and results stored in your own Postgres.

- Repository: https://github.com/render-examples/typebot
- URL: https://render.com/templates/typebot

## Why deploy Typebot on Render?

Typebot is an open-source visual chatbot builder that lets you design conversational flows through a drag-and-drop editor and deploy them via embeds, APIs, and webhooks. It solves the problem of building and hosting chatbots without writing custom code, while letting you self-host the application and retain full control of your data in your own database.

This template wires up Typebot's split builder/viewer architecture as two Docker-based web services against a managed Render Postgres instance—and handles the parts that usually break a manual setup: it generates the encryption key for stored credentials, cross-injects each service's public URL into the other so embeds and the chat API resolve correctly, and runs `prisma migrate deploy` on boot. Instead of hand-provisioning a database, managing migration order, and reconciling two services' env vars, you click Deploy, supply your SMTP credentials and admin email, and both services come up connected. Version upgrades are a one-line tag change in `render.yaml`—push it and the Blueprint redeploys the builder and viewer together.

## Architecture

```mermaid
flowchart LR
    classDef default fill:#1a1a2e,stroke:#a78bfa,color:#fff

    Admin([Admin / Editor])
    Visitor([Bot Visitor])
    SMTP([SMTP Server])

    Builder[typebot-builder]
    Viewer[typebot-viewer]
    DB[(typebot-db)]

    Admin -->|dashboard & API| Builder
    Visitor -->|chat API| Viewer
    Builder -->|magic link email| SMTP
    Builder -->|queries| DB
    Viewer -->|queries| DB
    Builder -.->|shared ENCRYPTION_SEED| Viewer
```

## What you can build

You'll have a self-hosted Typebot instance where you can visually build chatbots, publish them, and embed them on your own sites, with all bot definitions, responses, and user data stored in a Postgres database you control. The editor runs separately from the public-facing viewer that serves your live bots and handles the chat API embeds call, and sign-in works over your own SMTP provider using email magic links. From there you can connect blocks like OpenAI, Google Sheets, and Zapier, and invite teammates to an unlimited workspace.

## Key features

- *Split builder/viewer services*: Deploys separate typebot-builder (editor and API) and typebot-viewer (serves published bots) web services that share one Postgres database.
- *Pinned Docker images*: Both services pull official baptistearno/typebot-* images at a pinned 3.19.1 tag, so upgrades are done by changing the tag in render.yaml and pushing.
- *Automatic encryption key handling*: Generates a shared ENCRYPTION_SEED once and exports its first 32 characters as the required ENCRYPTION_SECRET on both services at start.
- *Auto-wired service config*: On Apply, Render provisions the database, generates the encryption key, and injects each service's public URL (NEXTAUTH_URL, NEXT_PUBLIC_VIEWER_URL) into the other.
- *Boot-time DB migrations*: The builder runs prisma migrate deploy on startup, so schema migrations are applied automatically before the app starts.

## Use cases

- Startup founder builds a lead-qualification chatbot embedded on the marketing site
- Support team deploys a self-hosted FAQ bot keeping customer data private
- Marketer launches a quiz funnel capturing responses in their own Postgres
- Developer embeds an OpenAI-powered onboarding bot with webhooks into Sheets

## What's included

| Service | Type | Purpose |
|---------|------|---------|
| typebot-builder | Web Service | Editor, dashboard, and API. Runs database migrations on boot |
| typebot-viewer | Web Service | Serves published bots and the chat API |
| typebot-db | PostgreSQL | Bots, results, users, and encrypted credentials |

## Prerequisites

- *Admin Email*: The email address that will receive an unlimited workspace and be used to sign in to the Typebot builder.
- *[SMTP Host](https://resend.com/docs/send-with-smtp)*: The hostname of your SMTP email provider used to send sign-in links and notifications.
- *[SMTP Username](https://resend.com/docs/send-with-smtp)*: The username for authenticating with your SMTP email provider.
- *[SMTP Password](https://resend.com/docs/send-with-smtp)*: The password or API key for authenticating with your SMTP email provider.
- *SMTP From Address*: The sender name and email address shown on outgoing emails, e.g. 'Typebot' <typebot@example.com>.

## Next steps

1. Open the typebot-builder URL, enter your ADMIN_EMAIL, and click the sign-in link in your inbox — You should land in an unlimited workspace dashboard; if no email arrives, check the SMTP values and logs on typebot-builder
2. Build a simple bot in the editor and click Publish, then open the generated share link — The bot should load and respond from the typebot-viewer URL (NEXT_PUBLIC_VIEWER_URL), confirming the builder and viewer share the same encryption key
3. Test a chat on the published bot and then open the Results tab in the builder — The submitted answers should appear there within a few seconds, confirming both services are reading and writing to typebot-db

## Resources

- [Typebot official site](https://github.com/baptisteArno/typebot.io)
