Railway is the recommended platform for production pilot deployments of the Workforce Intelligence & Execution OS. A complete deployment consists of five Railway services: a managed PostgreSQL database, a managed Redis instance, the FastAPI backend, the Next.js frontend, and a Celery background worker. This guide walks through provisioning each service, setting the correct environment variables, and verifying the deployment with a smoke-test checklist.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Paramount-Intelligence/HR_Monitoring_System/llms.txt
Use this file to discover all available pages before exploring further.
Required Railway Services
| Service | Type | Purpose |
|---|---|---|
| PostgreSQL | Managed database | Primary transactional store |
| Redis | Managed cache | Celery message broker |
| Backend API | GitHub deployment | FastAPI application + auto-migrations |
| Frontend | GitHub deployment | Next.js web application |
| Worker | GitHub deployment | Celery background task processor |
Deployment Steps
Create a Railway project
Log in to Railway and create a new project. Give it a name that reflects your organisation — for example,
workforce-os-production.Provision PostgreSQL and Redis
From the project canvas, click New Service → Database and add:
- PostgreSQL — Railway injects
DATABASE_URLandDATABASE_PUBLIC_URLautomatically into any service that references it. - Redis — Railway injects
REDIS_URLautomatically.
Ensure the PostgreSQL database is created with UTF-8 encoding to support emoji and Unicode in messages and call logs. Railway’s managed Postgres uses UTF-8 by default, so no extra configuration is needed for provisioned databases.
Add the Backend API service
Click New Service → GitHub Repo, select your repository, and set:Set the following environment variables on the Backend API service:RequiredOptional (but recommended for production)
- Root Directory:
apps/api - Build Command:
pip install -r requirements.txt - Start Command: read from
Procfile(Railway picks this up automatically)
Procfile in apps/api defines the web process:Procfile
alembic upgrade head runs automatically on every deploy before gunicorn starts, keeping the schema current without a separate migration step.Add the Frontend service
Click New Service → GitHub Repo, select the same repository, and set:
- Root Directory:
apps/web - Build Command:
npm run build - Start Command:
npm run start
NEXT_PUBLIC_* values are baked into the client bundle at build time:Add the Worker service
Click New Service → GitHub Repo, select the same repository, and set:
- Root Directory:
apps/api - Start Command:
celery -A app.core.celery_app worker --loglevel=info
DATABASE_URL, REDIS_URL, and APP_SECRET_KEY as the API service. Share them via Railway’s variable references:Call Recording Storage (S3-Compatible)
For production call recording uploads, configure an S3-compatible bucket on the Backend API service:railway_bucket or railway as aliases for s3.
Multiple Frontend Domains
If more than one frontend domain needs API access, provide a comma-separated list forCORS_ORIGINS:
FRONTEND_BASE_URL must also be present in CORS_ORIGINS, or the API will refuse to start in production.
Post-Deployment Smoke Test
After all services are running, verify the deployment with this checklist:- API health:
GET https://<your-api>.up.railway.app/healthreturns200 OK - Frontend loads: the web app opens and can reach the API without console CORS errors
- Admin bootstrap: log in with your
BOOTSTRAP_ADMIN_EMAIL/BOOTSTRAP_ADMIN_PASSWORDcredentials — you should land on/admin/dashboard - User list: navigate to Users & Teams and confirm at least one user (the bootstrap admin) appears
- Attendance flow: run a single Check-In / Check-Out cycle and confirm it persists
- Worker health: inspect the Railway logs for the Worker service — it should print
celery@... readywith no connection errors
Important Production Notes
Enable automated backups. In the Railway dashboard, navigate to your PostgreSQL service → Settings → Backups and enable scheduled backups before going live. Railway retains multiple restore points and supports point-in-time recovery on paid plans.
Updating URLs After a Redeploy
If either service URL changes (for example, after linking a custom domain):- Update
FRONTEND_BASE_URLon the API service. - Update
CORS_ORIGINSon the API service to include the new frontend URL(s). - Update
NEXT_PUBLIC_API_URLandNEXT_PUBLIC_WS_URLon the Frontend service. - Redeploy both services — the Frontend must rebuild for
NEXT_PUBLIC_*changes to take effect.
