Skip to main content
This guide shows you how to deploy Convex using Docker Compose, the easiest way to get started with self-hosting.

Prerequisites

  • Docker and Docker Compose installed
  • Latest version of the Convex npm package (convex@latest)

Quick start

1

Download docker-compose.yml

Download the official docker-compose.yml file:
2

Start the services

Start the backend and dashboard:
This will:
  • Start the Convex backend on http://127.0.0.1:3210
  • Expose HTTP actions on http://127.0.0.1:3211
  • Start the dashboard on http://localhost:6791
  • Create a Docker volume for persistent data storage
3

Generate an admin key

Once the backend is running, generate an admin key for the dashboard and CLI:
Keep this admin key secure. It provides full administrative access to your Convex deployment.
4

Configure your Convex project

In your Convex project directory, create a .env.local file with your deployment URL and admin key:
.env.local
Do not commit .env.local to source control. Add it to your .gitignore file.
5

Install the latest Convex package

Update to the latest version of Convex:
6

Deploy your code

Push code, run queries, import data, and more:

Docker Compose configuration

The docker-compose.yml file includes two services:

Backend service

Dashboard service

Customizing ports

You can customize the default ports by creating a .env file next to docker-compose.yml:
.env

Persistent storage

By default, data is stored in a Docker-managed volume named data. This volume persists even when containers are stopped or removed.
When deploying to cloud hosting platforms (AWS, GCP, Azure, etc.), ensure you configure persistent storage (e.g., AWS EBS volumes) to prevent data loss.

Pinning to a specific version

For production deployments, pin to a specific version instead of using latest:
Then set the version in your .env file:
.env

Health checks

The backend includes a built-in health check endpoint:
The dashboard depends on the backend being healthy before starting.

Accessing the dashboard

Visit http://localhost:6791 in your browser. You’ll need to authenticate using the admin key generated in step 3.

Hosting on your own infrastructure

To run Convex on your own servers with custom domains:
1

Download docker-compose.yml to your server

2

Set up routing

Configure your reverse proxy (nginx, Caddy, etc.) to forward requests:
  • https://api.my-domain.comhttp://localhost:3210
  • https://my-domain.comhttp://localhost:3211
  • https://dashboard.my-domain.comhttp://localhost:6791
3

Configure environment variables

Create a .env file with your domain configuration:
.env
4

Start the services

5

Generate and use admin key

In your Convex project’s .env.local:
.env.local

Next steps

Configuration

Configure environment variables and runtime options

Database setup

Connect to PostgreSQL or MySQL for production

Storage

Configure S3-compatible storage

Upgrading

Learn how to upgrade your self-hosted deployment