Skip to content

Deployment

The generated project includes a Dockerfile and docker-compose.yml. This is the simplest way to deploy:

services:
postgres:
image: postgres:16-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 -d

Before deploying to production, ensure:

ItemDetails
JWT_SECRETUse a cryptographically strong random string (≥ 32 chars). Never reuse across environments.
DATABASE_URLUse a managed Postgres instance (Neon, Supabase, RDS) with TLS enabled
CORSConfigure allowed origins on your backend if frontend and backend are on different domains
Storage volumesMount persistent volumes for file uploads. Or switch to S3 for production.
HTTPSTerminate TLS at your reverse proxy (nginx, Cloudflare, load balancer)
RegistrationSet ALLOW_REGISTRATION=false after creating your admin account

In production, the backend can serve the frontend as a static SPA:

import { serveSPA } from "@rebasepro/backend";
// After initializeRebaseBackend()
serveSPA(app, "./frontend/dist");

Build the frontend first:

cd frontend && pnpm build

This way you only need to deploy one server that handles both SPA and API.

  1. Push your code to a Git repository
  2. Connect the repo to your cloud platform
  3. Set environment variables (DATABASE_URL, JWT_SECRET, etc.)
  4. The included Dockerfile will be auto-detected
# Build the container
docker build -t gcr.io/YOUR_PROJECT/rebase-backend ./backend
# Push to Container Registry
docker push gcr.io/YOUR_PROJECT/rebase-backend
# Deploy
gcloud run deploy rebase-backend \
--image gcr.io/YOUR_PROJECT/rebase-backend \
--set-env-vars DATABASE_URL=...,JWT_SECRET=... \
--allow-unauthenticated

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"
});