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
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
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
Build and migrate
npm ci
npm run build
npm run db:push
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
Install Docker Engine and Compose
Install Docker Engine, Compose plugin, and Git on the server.
Clone the repository and create .env
Use the same /opt/kuest/prediction-market layout as the Node.js path.
Set domain variables
Add:CADDY_DOMAIN=markets.example.com
SITE_URL=https://markets.example.com
Start production compose
docker compose --env-file .env -f infra/docker/docker-compose.production.yml up -d --build
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/*.