Skip to main content

Prerequisites

Shared server baseline

sudo apt update && sudo apt upgrade -y
sudo timedatectl set-timezone UTC

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable

Option A: Node.js + systemd + Nginx

1

Install runtime packages

curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt install -y nodejs build-essential git nginx certbot python3-certbot-nginx
2

Clone the repository and create .env

sudo mkdir -p /opt/kuest
sudo chown \"$USER\":\"$USER\" /opt/kuest
cd /opt/kuest
git clone https://github.com/<your-org>/prediction-market.git
cd prediction-market
cp .env.example .env
3

Build and migrate

npm ci
npm run build
npm run db:push
4

Create the systemd service and Nginx site

Set the service working directory to /opt/kuest/prediction-market, proxy Nginx to port 3000, then issue TLS with Certbot.

Option B: Docker Compose + Caddy

1

Install Docker Engine and Compose

Install Docker Engine, Compose plugin, and Git on the server.
2

Clone the repository and create .env

Use the same /opt/kuest/prediction-market layout as the Node.js path.
3

Set domain variables

Add:
CADDY_DOMAIN=markets.example.com
SITE_URL=https://markets.example.com
4

Start production compose

docker compose --env-file .env -f infra/docker/docker-compose.production.yml up -d --build
5

Run database migrations

docker compose --env-file .env -f infra/docker/docker-compose.production.yml exec web npm run db:push

Scheduler on VPS

If you are not using Supabase mode, create Linux cron jobs that follow Scheduled Jobs. Keep that page as the single source of truth for the exact cron expressions.
Keep only one scheduler backend active for /api/sync/*.