Deployment
Docker Compose (Recommended)
Section titled “Docker Compose (Recommended)”The generated project includes a Dockerfile and docker-compose.yml. This is the simplest way to deploy:
services: postgres: image: postgres:18-alpine environment: POSTGRES_USER: rebase POSTGRES_PASSWORD: rebase POSTGRES_DB: rebase volumes: - pgdata:/var/lib/postgresql/data ports: - "5432:5432"
app: build: ./backend ports: - "3001:3001" environment: DATABASE_URL: postgresql://rebase:rebase@postgres:5432/rebase JWT_SECRET: ${JWT_SECRET} NODE_ENV: production depends_on: - postgres volumes: - uploads:/app/uploads
volumes: pgdata: uploads:docker compose up -dProduction Checklist
Section titled “Production Checklist”Before deploying to production, ensure:
| Item | Details |
|---|---|
| JWT_SECRET | Use a cryptographically strong random string (≥ 32 chars). Never reuse across environments. |
| DATABASE_URL | Use a managed Postgres instance (Neon, Supabase, RDS) with TLS enabled |
| CORS | Configure allowed origins on your backend if frontend and backend are on different domains |
| Storage volumes | Mount persistent volumes for file uploads. Or switch to S3 for production. |
| HTTPS | Terminate TLS at your reverse proxy (nginx, Cloudflare, load balancer) |
| Registration | Set ALLOW_REGISTRATION=false after creating your admin account |
Serving the Frontend
Section titled “Serving the Frontend”In production, the backend can serve the frontend as a static SPA:
import { serveSPA } from "@rebasepro/server";import path from "path";
// After initializeRebaseBackend()serveSPA(app, { frontendPath: path.resolve(process.cwd(), "../frontend/dist") });Build the frontend first:
cd frontend && pnpm buildThis way you only need to deploy one server that handles both SPA and API.
Platform Deployment Guides
Section titled “Platform Deployment Guides”Detailed step-by-step guides for each platform:
| Platform | Type | Guide |
|---|---|---|
| AWS | App Runner / ECS + RDS | Deploy on AWS → |
| Google Cloud | Cloud Run + Cloud SQL | Deploy on GCP → |
| Azure | Container Apps + PostgreSQL | Deploy on Azure → |
| Hetzner Cloud | VPS + Docker Compose | Deploy on Hetzner → |
| Scaleway | Serverless Containers | Deploy on Scaleway → |
| Railway | PaaS (auto-detect Dockerfile) | Deploy on Railway → |
| Fly.io | Container runtime | Deploy on Fly.io → |
Changing the Base URL
Section titled “Changing the Base URL”If you want Rebase to run at a sub-path (e.g., /admin):
Frontend — Update the BrowserRouter basename:
<BrowserRouter basename="/admin"> <App /></BrowserRouter>Backend — Update the base path:
await initializeRebaseBackend({ // ... basePath: "/admin/api"});Next Steps
Section titled “Next Steps”- Backend Overview — Full backend configuration
- Storage Configuration — S3 setup for production