Master Guides

Deployment

Two services, your choice of hosts.

A Master app is two deployable services — the Next.js frontend and the MasterController API. Run them on one box or split them; both are plain Node processes.

Build & run together#

terminal
$ npm install
$ master build # builds the Next.js frontend
$ NODE_ENV=production master start

Environment & migrations#

Set production secrets and run migrations as a release step:

terminal
$ NODE_ENV=production master db migrate

Configure NEXT_PUBLIC_API_URL (public backend URL), FRONTEND_URL (for CORS), and your database credentials in env.production.json.

Process manager (PM2)#

terminal
$ npm install -g pm2
$
$ cd backend && NODE_ENV=production PORT=3001 pm2 start server.js --name app-api
$ cd frontend && PORT=3000 NEXT_PUBLIC_API_URL=https://api.example.com pm2 start "npm run start" --name app-web
$
$ pm2 save && pm2 startup

Reverse proxy#

text
https://example.com/       -> Next.js   (:3000)
https://api.example.com/   -> MasterController (:3001)
Split deployments
Host the frontend on a platform like Vercel and the API on a Node host (Render, Fly, a VPS) — just point NEXT_PUBLIC_API_URLat the API and add the frontend origin to the backend’s CORS list.