Deployment Guide

Vercel, Railway, and VPS with Nginx and SSL

Dev Only
ServiceProviderWhy
Frontend (Next.js)VercelZero-config Next.js hosting. Auto SSL. Deploy on git push.
Backend (Node.js API)Railway or RenderOne-click Node.js deploy. Easy environment variables.
PostgreSQLNeon or SupabaseServerless Postgres. Generous free tier. Auto-backups.
RedisUpstashServerless Redis. Pay-per-request. Free tier available.
ImagesCloudinaryAlready configured in the app. No change needed.
DNS & SSLCloudflareFree SSL certificates. DDoS protection. Easy DNS.

Option A — Deploy Frontend to Vercel

The easiest approach for the Next.js frontend.

1

Create a Vercel account

Go to vercel.com and log in (or create an account).

2

Import your repository

Click Add New Project and import your saas-pos-frontend repository from GitHub.

3

Deploy

Vercel auto-detects Next.js. Click Deploy — it builds and deploys automatically.

4

Set environment variables

After deployment, go to Settings › Environment Variables and add all variables from your .env.local file (including the four Cloudinary values). Set NEXT_PUBLIC_API_URL to your production backend URL — keep the /api/v1 suffix, e.g. https://api.yourdomain.com/api/v1.

5

Redeploy

Click Redeploy to apply the environment changes. Your frontend is live at your-project.vercel.app (or your custom domain).

Option B — Deploy Backend to Railway

1

Create a Railway account

Go to railway.app and create an account.

2

Deploy from GitHub

Click New Project › Deploy from GitHub repo and select saas-pos-backend.

3

Configure variables

In the Variables tab, add every key from your .env file.

4

Set networking

In Settings › Networking, add a custom domain or use the auto-generated railway.app URL.

5

Set build commands

Set the build and start commands:

Option C — Deploy to a VPS

For full control — deploy to an Ubuntu VPS with Nginx and PM2.

1 — Initial Server Setup

bash

2 — Clone, Configure, and Start

bash

3 — Nginx Reverse Proxy

/etc/nginx/sites-available/saas-pos-backend
bash

4 — Free SSL with Certbot

bash

Production .env Checklist

VariableProduction Notes
NODE_ENV RequiredMust be exactly: production
DATABASE_URL RequiredUse production Neon/Supabase URL with ?sslmode=require
REDIS_URL RequiredUse Upstash production URL — starts with rediss://
JWT_ACCESS_SECRET RequiredGenerate a fresh 64-char secret. Never reuse the dev value.
JWT_REFRESH_SECRET RequiredGenerate another fresh 64-char secret. Must differ from access secret.
CORS_ORIGINS RequiredYour real frontend origin: https://pos.yourdomain.com (comma-separate multiple origins)
PORT RequiredThe port your platform expects the server to bind (Railway/Render inject this automatically).
SETUP_ACCESS_CODE RequiredStrong random string — required before the first-run setup wizard can create the first business.
MASTER_ENCRYPTION_KEYSet a fresh 64-char hex value in production — encrypts stored third-party credentials.
CLOUDINARY_*Cloudinary credentials live in the FRONTEND environment (.env.local / Vercel project settings), not the backend.
Warning

Never reuse development JWT secrets in production. Regenerate them with the crypto command from the Backend Configuration section.