> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typebot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manual

> [!WARNING]
>
> This doc is for deploying Typebot on a server manually. If you're looking for
> running Typebot locally, for development purposes, check out the [local
> installation guide](https://docs.typebot.com/contribute/guides/local-installation.md).

> [!NOTE]
>
> The easiest way to get started with Typebot is with [the official managed
> service in the Cloud](https://app.typebot.io). You'll have high availability,
> backups, security, and maintenance all managed for you by me, Baptiste,
> Typebot's founder. The cloud version can save a substantial amount of
> developer time and resources. For most sites this ends up being the best value
> option and the revenue goes to funding the maintenance and further development
> of Typebot. So you'll be supporting fair source software and getting a great
> service!

## Requirements

* A Postgres database hosted somewhere. For production, [Neon](https://typebot.com/neon) is my provider of choice. This is not an affiliate link; it is simply the provider I use and recommend for a production database. You can also use any compatible Postgres provider or host Postgres yourself.
* A server with Node.js 24.x (24.22.1 or later, which fixes CVE-2026-111497), [bun](https://bun.sh/docs/installation), Nginx, and PM2 installed.
* Experience in deploying Next.js applications with PM2. Check out [this guide](https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server/) for more information.

## Getting Started

1. Fork/clone the repository and checkout the latest stable version.

```sh theme={null}
git clone git@github.com:<username>/typebot.io.git
cd typebot.io
git checkout latest
```

2. Setup environment variables by copying the example files and following the [configuration guide](https://docs.typebot.com/self-hosting/configuration.md) to fill in the missing values.

```sh theme={null}
cp .env.example .env
```

> [!NOTE]
>
> The database user should have the `SUPERUSER` role. You can setup and migrate
> the database with the `bunx nx db:migrate prisma` command.

3. Install dependencies

```sh theme={null}
bun install
```

4. Run the database migrations

```sh theme={null}
bunx nx db:migrate prisma
```

5. Build the builder and viewer

```sh theme={null}
bunx nx run-many -t build -p builder,viewer
```

> [!NOTE]
>
> If you face the issue `Node ran out of memory`, then you should increase the
> memory limit for Node.js. For example,`NODE_OPTIONS=--max-old-space-size=4096`
> will increase the memory limit to 4GB. Check [this stackoverflow
> answer](https://stackoverflow.com/questions/53230823/fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-failed-javas)
> for more information.

## Deployments

### Deploy the builder

From the repository root, start the builder with PM2:

```sh theme={null}
pm2 start bunx --name=typebot-builder -- nx start builder -- -p 3000
```

### Deploy the viewer

From the repository root, start the viewer with PM2:

```sh theme={null}
pm2 start bunx --name=typebot-viewer -- nx start viewer -- -p 3001
```

> [!NOTE]
>
> You can change the ports passed after `-p`. The PM2 commands must be run from
> the repository root so Nx can resolve the workspace.

## Nginx configuration

You can use the following configuration to serve the builder and viewer with Nginx. Make sure to replace the `server_name` values with the respective domain names for your Typebot instance. They should match `NEXTAUTH_URL` and `NEXT_PUBLIC_VIEWER_URL`. Check out [this guide](https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server/) for a step-by-step guide on how to setup Nginx and PM2.

```nginx theme={null}
server {
     listen 80;
     server_name typebot.example.com;
     return 301 https://typebot.example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name typebot.example.com;

    # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/typebot.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/typebot.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    location ^~ / {
         proxy_pass http://localhost:3000;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_cache_bypass $http_upgrade;
    }
}

server {
     listen 80;
     server_name bot.example.com;
     return 301 https://bot.example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name bot.example.com;

    # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/bot.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/bot.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    location ^~ / {
         proxy_pass http://localhost:3001;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_cache_bypass $http_upgrade;

         # Necessary to enable message streaming
         proxy_buffering off;
    }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.