Skip to content

Convex

Convex is the open-source reactive database designed to make life easy for web app developers, whether human or LLM. Fetch data and perform business logic with strong consistency by writing pure TypeScript.

References


Make directory

Terminal window
mkdir -p {{DOCKER_PATH_VAR}}/convex && cd {{DOCKER_PATH_VAR}}/convex

docker-compose.yml

Terminal window
nano docker-compose.yml
docker-compose.yml
services:
backend:
image: ghcr.io/get-convex/convex-backend:latest
env_file: .env
stop_grace_period: 10s
stop_signal: SIGINT
ports:
- "${PORT:-3210}:3210"
- "${SITE_PROXY_PORT:-3211}:3211"
volumes:
- data:/convex/data
healthcheck:
test: curl -f http://localhost:3210/version
interval: 5s
start_period: 10s
depends_on:
postgres:
condition: service_healthy
dashboard:
image: ghcr.io/get-convex/convex-dashboard:latest
env_file: .env
environment:
- PORT=6791
- HOST=0.0.0.0
stop_grace_period: 10s
stop_signal: SIGINT
ports:
- "${DASHBOARD_PORT:-6791}:6791"
depends_on:
backend:
condition: service_healthy
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
volumes:
data:
pgdata:

.env

Terminal window
nano .env
.env
# Ports
PORT=3210
SITE_PROXY_PORT=3211
DASHBOARD_PORT=6791
# POSTGRES
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=convex
POSTGRES_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432
# Required Convex environment variables
INSTANCE_NAME=${POSTGRES_DB}
INSTANCE_SECRET=your-secret # openssl rand -hex 32
CONVEX_RELEASE_VERSION_DEV=
ACTIONS_USER_TIMEOUT_SECS=30
CONVEX_CLOUD_ORIGIN=http://localhost:3210
CONVEX_SITE_ORIGIN=http://localhost:3211
DATABASE_URL=${POSTGRES_URL}
DISABLE_BEACON=1
REDACT_LOGS_TO_CLIENT=1
DO_NOT_REQUIRE_SSL=1
RUST_LOG=info
RUST_BACKTRACE=1
NEXT_PUBLIC_DEPLOYMENT_URL=http://localhost:3210

Start container

Terminal window
docker compose up -d

Generate admin keys

Terminal window
docker compose exec backend ./generate_admin_key.sh

.env.local

Terminal window
nano .env.local
.env.local
CONVEX_SELF_HOSTED_URL=http://localhost:3210
CONVEX_SELF_HOSTED_ADMIN_KEY=your-convex-admin-key

Open web ui

http://localhost:6791 or http://{{SERVER_IP_VAR}}:6791