Deploy to Railway
Railway is the recommended deployment path for NestForge Pro. You can go from zero to production in under 10 minutes with automatic builds, managed PostgreSQL, and zero DevOps.
Prerequisites
- A Railway account
- Your NestForge Pro repository pushed to GitHub
Steps
1. Create a Railway project
Log in to Railway and click New Project. Select Deploy from GitHub repo and connect your NestForge Pro repository.
2. Add a PostgreSQL service
In your project dashboard, click New and select Database > PostgreSQL. Railway provisions a managed Postgres instance and automatically sets the DATABASE_URL variable on any linked services.
3. Add a Redis service (optional)
If you use BullMQ for background jobs (email queue, etc.), add a Redis service the same way: New > Database > Redis. Railway sets the REDIS_URL variable automatically.
4. Configure the API service
Railway auto-detects the repository, but you need to point it at the API app. In the service settings, set:
Build command:
cd apps/api && npx prisma generate && npm run build
Start command:
node apps/api/dist/main.js
5. Set environment variables
Railway auto-injects DATABASE_URL and REDIS_URL from the linked services. Add the remaining variables in the service Variables tab:
| Variable | Example |
|---|---|
JWT_SECRET | Generate with openssl rand -base64 32 |
JWT_REFRESH_SECRET | Generate with openssl rand -base64 32 |
STRIPE_SECRET_KEY | sk_live_... or sk_test_... |
STRIPE_WEBHOOK_SECRET | whsec_... |
STRIPE_PRICE | price_... |
RESEND_API_KEY | re_... |
EMAIL_FROM | hello@yourdomain.com |
APP_URL | https://your-web.up.railway.app |
API_URL | https://your-api.up.railway.app |
NODE_ENV | production |
6. Run database migrations
Open the Railway CLI or use the service shell:
cd apps/api && npx prisma migrate deploy
Railway runs this in the context of your service, so DATABASE_URL is already available.
7. Deploy the frontend
Add a second service in the same Railway project for the web app.
Build command:
cd apps/web && npm run build
Start command (static serving):
npx serve apps/web/dist -s -l 3000
Alternatively, deploy apps/web as a static site. Set the Publish directory to apps/web/dist.
Set the VITE_API_URL variable to your API service URL so the frontend knows where to send requests.
8. Add a custom domain (optional)
In each service's Settings > Networking, add your custom domain and update your DNS records.
Verify
Once deployed, visit your API URL at /health to confirm the service is running:
https://your-api.up.railway.app/health
Note: Railway is the simplest deployment path. For production workloads at scale, see the AWS CDK deployment guide.