This guide covers a standard production deployment with Bun, Nginx, MySQL, and Redis.
bun run build
bun run startThe production process runs through server.mjs, which serves Next.js and Socket.IO in one runtime.
At minimum:
AUTH_URL=https://your-domainALLOWED_ORIGIN=https://your-domainHOSTNAME=0.0.0.0PORT=3000- all required auth/database/redis variables from setup guide
Use a proxy config that supports WebSocket upgrades. Route both normal HTTP and /api/ws traffic to the app process.
Key points:
- set
proxy_http_version 1.1 - forward
UpgradeandConnectionheaders for websocket path - forward
HostandX-Forwarded-*headers - terminate TLS at Nginx
PM2 example:
npm install -g pm2
pm2 start --interpreter bun server.mjs --name softora-queue --env production
pm2 save
pm2 startupYou can also use systemd or container orchestration if preferred.
Before first production start (and after schema changes):
bunx prisma generate
bunx prisma db pushIn fivem/softora-queue/config.lua, ensure:
Config.ApiUrlpoints to public production URLConfig.ApiKeymatches server record in admin panelConfig.QueueUrlpoints to user-facing queue URL
- DNS and TLS certificates are active
- MySQL and Redis are reachable from app host
- Discord OAuth callback uses production domain
- proxy supports websocket upgrades
- API keys are unique per server and stored securely
- logs are collected and monitored
- backup strategy exists for MySQL