Skip to content

RealOutcomes Deployment Guide

Overview

RealOutcomes is deployed on Railway using Docker. This guide covers deploying to Railway and setting up the required services.

Prerequisites

  • Railway account
  • Supabase account (for database, auth, and storage)
  • Stripe account
  • SendGrid account
  • OpenAI API key
  • Firecrawl API key

Step 1: Create Supabase Project

  1. Create a new Supabase project at supabase.com
  2. Note down:
  3. SUPABASE_URL - Project URL
  4. SUPABASE_ANON_KEY - Anon/Public key
  5. SUPABASE_SERVICE_ROLE_KEY - Service role key
  6. DATABASE_URL - PostgreSQL connection string (from Database Settings)

  7. Create a storage bucket named uploads (or your preferred name)

  8. Configure Auth providers as needed (email/password, Google, etc.)

Step 2: Create Railway Project

  1. Go to railway.app and create a new project
  2. Connect your GitHub repository
  3. Railway will auto-detect the Dockerfile

Step 3: Configure Environment Variables

In Railway project settings, add these environment variables:

Required

# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
DATABASE_URL=postgresql://postgres:password@db.your-project.supabase.co:5432/postgres

# Client (must match server values)
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key

# Session
SESSION_SECRET=your-secure-session-secret-at-least-32-chars

# App
NODE_ENV=production
PUBLIC_URL=https://realoutcomes.app
PORT=5000

# Stripe
STRIPE_SECRET_KEY=sk_live_...
STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_PRO_MONTHLY_PRICE_ID=price_...
STRIPE_PRO_YEARLY_PRICE_ID=price_...

# SendGrid
SENDGRID_API_KEY=SG....
SENDGRID_FROM_EMAIL=hello@realoutcomes.app

# OpenAI
OPENAI_API_KEY=sk-...

# Firecrawl
FIRECRAWL_API_KEY=fc-...

Optional

# Storage (if not using default bucket name)
SUPABASE_STORAGE_BUCKET=uploads

# FEC — free key at https://api.open.fec.gov/developers/
FEC_API_KEY=your-fec-api-key

# Last1 certification (hide until JSON API is live)
LAST1_CERT_REGISTRY_URL=false

Step 4: Database Migration

Run migrations against the Supabase Real Outcomes project (cpocwrygxlqhzvmlrpjv):

npm run supabase:db:push

Verified-source tables (org_data_provenance, schedule_i_grants, federal_awards, etc.) are in supabase/migrations/20260611120000_verified_sources.sql. Production also requires hub tables from migrations/20260309_fwa_financial_political.sql if not already applied.

Step 4b: Monthly IRS sync (BMF + Auto-Revocation List)

Create a second Railway service in the same project (same repo, no public domain):

Setting Value
Start command npm run import:monthly-irs
Cron schedule 0 3 1 * * (1st of month, 03:00 UTC)
Variables Same as web app (DATABASE_URL, etc.)

The script runs BMF import then ARL import (scripts/monthly-irs-sync.ts).

Manual run:

railway run npm run import:monthly-irs
# or ARL only:
railway run npm run import:arl

Step 5: Configure Custom Domain

  1. In Railway project settings, add custom domain realoutcomes.app
  2. Configure DNS:
  3. CNAME record pointing to Railway's provided hostname

Step 6: Stripe Webhook

  1. In Stripe Dashboard, create a webhook endpoint:
  2. URL: https://realoutcomes.app/api/stripe/webhook
  3. Events to listen for:

    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • checkout.session.completed
  4. Copy the webhook signing secret to STRIPE_WEBHOOK_SECRET

Deployment

Railway auto-deploys on push to main branch. To manually deploy:

railway up

Monitoring

  • Railway provides built-in logs and metrics
  • Check Railway dashboard for deployment status
  • Monitor Supabase dashboard for database performance

Troubleshooting

Build Fails

  • Check that all environment variables are set
  • Verify Dockerfile syntax
  • Check Railway build logs

Auth Issues

  • Verify Supabase URL and keys are correct
  • Check that Supabase Auth is properly configured
  • Ensure VITE_* variables match server values

Database Connection Issues

  • Verify DATABASE_URL format
  • Check that the database exists
  • Run migrations if needed

Storage Issues

  • Verify storage bucket exists in Supabase
  • Check service role key permissions
  • Verify bucket policies

Entity Information

RealOutcomes is operated by Last 1 Enterprises, LLC.

For support: support@realoutcomes.app