Deploy the feat/kpi-pipeline-feature-flags-synthetic branch from
https://github.com/Techtorch/revenue-leakage-v2
- Go to supabase.com → New Project
- Pick a region close to your Railway region (e.g. US East)
- Set a strong database password — you'll need it below
- Once created, go to Settings → Database → Connection string → URI
- Copy the connection string — it looks like:
postgresql://postgres.[project-ref]:[PASSWORD]@aws-0-us-east-1.pooler.supabase.com:6543/postgresUse the Transaction (port 6543) pooler URI for the backend.
-
Go to railway.app → New Project → Deploy from GitHub repo
-
Select
Techtorch/revenue-leakage-v2, branchfeat/kpi-pipeline-feature-flags-synthetic -
Settings:
- Root Directory:
rev-leak-agents - Builder: Dockerfile (auto-detected from
rev-leak-agents/Dockerfile) - Start Command: leave blank (Dockerfile CMD handles it)
- Root Directory:
-
Environment Variables:
Variable Value RL_DB_DSNpostgresql://postgres.[ref]:[PASSWORD]@aws-0-us-east-1.pooler.supabase.com:6543/postgresRL_RUN_MIGRATIONS_ON_STARTUPtrueRL_OPENAI_API_KEYsk-...(your OpenAI key for GPT-4o extraction)RL_CORS_ORIGINShttps://<frontend-domain>.up.railway.app(set after frontend deploys)RL_LOG_LEVELinfoPORT8001 -
Networking: Generate a public domain (e.g.
rev-leak-backend-production.up.railway.app) -
Deploy — first deploy runs Alembic migrations automatically
-
In the same Railway project → New Service → Deploy from GitHub repo
-
Select same repo + branch
-
Settings:
- Root Directory:
revenue-leakage-v2/remix-of-revenue-leakage-ui - Builder: Dockerfile (auto-detected)
- Root Directory:
-
Environment Variables:
Variable Value VITE_API_BASE_URLhttps://rev-leak-backend-production.up.railway.appThis gets baked in at build time. If you change the backend URL, redeploy the frontend.
-
Networking: Generate a public domain (e.g.
rev-leak-ui-production.up.railway.app) -
Deploy
- Update backend
RL_CORS_ORIGINSwith the actual frontend Railway URL - Hit
https://<backend>/health— should return{"status": "ok"} - Open frontend URL — dashboard should load (empty until you run pipeline)
- Click "Load CITI Data" on Ingestion page to process CITI documents
- Click "Process Synthetic" to run synthetic test documents through KPI pipeline
- Verify Dashboard shows KPI signals, leakage categories, and trend chart
- Verify Knowledge Graph shows document relationships (not all orphans)
To protect the API with HTTP Basic Auth, set these on the backend service:
| Variable | Value |
|---|---|
RL_BASIC_AUTH_USER |
your-username |
RL_BASIC_AUTH_PASS |
your-password |
The /health endpoint is excluded from auth (for Railway healthchecks).
┌─────────────┐ HTTPS ┌─────────────────┐ SQL ┌──────────┐
│ React/Vite │ ──────────────→ │ FastAPI Backend │ ───────────→ │ Supabase │
│ (Railway) │ VITE_API_URL │ (Railway) │ RL_DB_DSN │ Postgres │
└─────────────┘ └─────────────────┘ └──────────┘
│
│ RL_OPENAI_API_KEY
▼
┌──────────────┐
│ OpenAI API │
│ (GPT-4o) │
└──────────────┘
- Migrations fail: Check
RL_DB_DSNis correct and Supabase allows connections from Railway IPs - CORS errors: Ensure
RL_CORS_ORIGINSmatches the exact frontend URL (includinghttps://) - Empty dashboard: Run the pipeline first via Ingestion page buttons
- OpenAI errors: Verify
RL_OPENAI_API_KEYis set and has GPT-4o access


