Skip to content

Self-Hosted Guide

A production-ready checklist for deploying FlagBridge on your own infrastructure.

Prerequisites

  • PostgreSQL 15+ (recommended: managed service like AWS RDS, Supabase, or Neon)
  • Docker or Go 1.22+ runtime
  • Reverse proxy (nginx, Caddy, or cloud load balancer) for TLS termination

Environment Variables

VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string
JWT_SECRETYesSecret for JWT token signing (min 32 chars)
API_KEY_SALTNoSalt for API key hashing
PORTNo8080API server port
ALLOWED_ORIGINSNolocalhost:3000CORS allowed origins (comma-separated)
SENTRY_DSNNoSentry error tracking DSN

DANGER

Generate JWT_SECRET with a cryptographically secure random value:

bash
openssl rand -hex 32

Never reuse secrets across environments.

Deployment Options

Use the docker-compose.yml from the repository. Customize the .env file:

bash
cp .env.example .env
# Edit .env with your production values
docker compose up -d

Go Binary

Download the latest release and run directly:

bash
# Download
curl -fsSL https://github.com/flagbridge/flagbridge/releases/latest/download/flagbridge-linux-amd64 -o flagbridge
chmod +x flagbridge

# Run migrations first
psql $DATABASE_URL -f migrations/001_initial.sql
psql $DATABASE_URL -f migrations/002_testing_sessions.sql
psql $DATABASE_URL -f migrations/003_webhooks.sql

# Start
DATABASE_URL=postgres://... JWT_SECRET=... ./flagbridge

Kubernetes (Helm)

bash
helm repo add flagbridge https://flagbridge.github.io/helm-charts
helm install flagbridge flagbridge/flagbridge \
  --set env.DATABASE_URL="postgres://..." \
  --set env.JWT_SECRET="..." \
  --set ingress.enabled=true \
  --set ingress.host=flags.yourdomain.com

See flagbridge/helm-charts for full values reference.

Production Checklist

  • [ ] Secrets: JWT_SECRET and API_KEY_SALT are unique, random, and stored securely
  • [ ] Database: PostgreSQL with automated backups enabled
  • [ ] TLS: API served over HTTPS via reverse proxy
  • [ ] CORS: ALLOWED_ORIGINS set to your Admin dashboard domain only
  • [ ] Admin password: Default admin password changed after first login
  • [ ] Monitoring: Health check at GET /v1/health monitored
  • [ ] Backups: PostgreSQL backup schedule configured

Updating

Pull the latest image and restart:

bash
docker compose pull
docker compose up -d

New migrations are applied automatically on startup via the init container.

Next steps