Deploy to Production

Take POSVelo from running on your computer to live on a server, at your own domain with HTTPS, so every till, tablet and phone in your stores can reach it.

Why it's there

On your computer only you can open POSVelo. On a server, every store reaches the same system over the internet, and HTTPS keeps passwords and sales private on the way.

The recommended path uses the same Docker setup you already know, plus a reverse proxy that adds HTTPS.

Overview

A typical production layout:

                         ┌────────────────────────────┐
  https://yourdomain.com │  Nginx / Caddy (SSL)        │
  https://api.yourdomain ─►  reverse proxy             │
                         └─────┬───────────────┬───────┘
                               │               │
                        frontend:3000    backend:5000
                               │               │
                         (Docker network: postgres, redis)
  • Frontend served at https://yourdomain.com
  • Backend served at https://api.yourdomain.com
  • A reverse proxy (Nginx or Caddy) terminates HTTPS and forwards traffic

Step 1 — Get a server

Any VPS works (DigitalOcean, Hetzner, Linode, AWS Lightsail, etc.):

Point two DNS records at the server's IP:

  • yourdomain.com → frontend
  • api.yourdomain.com → backend

Step 2 — Upload the package & configure .env

Copy the Source-Code folder to the server, then create .env from the template and set production values:

# Strong, unique secrets — regenerate, do NOT reuse dev values
POSTGRES_PASSWORD=<strong unique password>
JWT_ACCESS_SECRET=<openssl rand -hex 32>
JWT_REFRESH_SECRET=<openssl rand -hex 32>
MASTER_ENCRYPTION_KEY=<openssl rand -hex 32>
SETUP_ACCESS_CODE=<your private setup code>

# Public URLs — NEXT_PUBLIC_API_URL must keep the /api/v1 suffix;
# NEXT_PUBLIC_API_ORIGIN is the same address without any path.
NEXT_PUBLIC_API_URL=https://api.yourdomain.com/api/v1
NEXT_PUBLIC_API_ORIGIN=https://api.yourdomain.com
CORS_ORIGINS=https://yourdomain.com

# Don't load sample data in production
RUN_SEED=false

# Cloudinary (recommended in production)
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=...
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...

NEXT_PUBLIC_API_URL is baked into the frontend at build time. If you change it later, rebuild with docker compose up -d --build.

Step 3 — Start the stack

docker compose up -d --build

The backend runs migrations automatically. Verify:

docker compose ps
docker compose logs -f

At this point the apps listen on the server's localhost:3000 and localhost:5000. Next, put HTTPS in front of them.

Step 4 — Add HTTPS with a reverse proxy

Option A — Caddy (simplest; automatic SSL)

Install Caddy, then create /etc/caddy/Caddyfile:

yourdomain.com {
    reverse_proxy localhost:3000
}

api.yourdomain.com {
    reverse_proxy localhost:5000
}
sudo systemctl reload caddy

Caddy automatically obtains and renews free Let's Encrypt certificates.

Option B — Nginx + Certbot

Example server blocks:

server {
    server_name yourdomain.com;
    location / { proxy_pass http://localhost:3000; proxy_set_header Host $host; }
}
server {
    server_name api.yourdomain.com;
    location / {
        proxy_pass http://localhost:5000;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;       # WebSocket (Socket.IO)
        proxy_set_header Connection "upgrade";
    }
}

Then issue certificates:

sudo certbot --nginx -d yourdomain.com -d api.yourdomain.com

POSVelo's real-time features (phone scanner, live updates) use WebSockets, so make sure the proxy forwards the Upgrade/Connection headers on the API host as shown above.

Step 5 — Go live

  1. Open https://yourdomain.com.
  2. Complete the first-run setup wizard with your real business details.
  3. Sign in as the admin and open Settings → System. Server check at the top flags the usual setup mistakes, each with what to change:
    • Debug mode: the backend runs with NODE_ENV=production (the Docker setup sets it).
    • Site address: the first entry of CORS_ORIGINS is the address you opened the page at. Links in emails use it.
    • HTTPS: the page was opened over https:// (not needed on localhost).
    • Email: an email server is set under Email on the same tab.
    • Background worker: the worker container (or npm run worker) has run in the last few minutes. Scheduled reports, online shop syncs and the nightly tasks need it.
  4. You're live.
Your live site: the sign-in page at your own domain.

Running without Docker (PM2)

If you prefer to run the compiled apps directly:

# Backend
cd Backend && npm ci && npm run build && npx prisma migrate deploy
pm2 start npm --name posvelo-api -- start
pm2 start npm --name posvelo-worker -- run worker

# Frontend
cd Frontend && npm ci && npm run build
pm2 start npm --name posvelo-web -- start
pm2 save && pm2 startup

You still need PostgreSQL and Redis available (managed service or Docker).

Production checklist

  • Unique, strong secrets for every *_SECRET / *_KEY / POSTGRES_PASSWORD
  • NEXT_PUBLIC_API_URL and CORS_ORIGINS point at your real domains
  • RUN_SEED=false
  • HTTPS enabled on both domains
  • Settings → System → Server check shows no warnings
  • MASTER_ENCRYPTION_KEY backed up somewhere safe (losing it makes encrypted HR data unreadable)
  • Regular database backups scheduled (see below)
  • Docker set to restart on reboot (restart: unless-stopped is already set)

Backups

Back up the PostgreSQL volume regularly:

# Create a backup
docker compose exec postgres pg_dump -U posvelo posvelo > backup_$(date +%F).sql

# Restore
cat backup.sql | docker compose exec -T postgres psql -U posvelo posvelo

Automate this with a cron job and store backups off-server.