Deploy the backend on Railway and the frontend on Vercel. Set up Supabase first so the backend has a database.
- GitHub repo with this codebase
- Supabase project (create one if needed)
- Google AI API key (for LLM)
Do this before deploying the backend. The backend needs these tables and seed data to run.
- Go to supabase.com and sign in.
- New project → choose org, name, database password, region.
- Wait for the project to be ready.
- In Settings → API: copy Project URL and anon public key. You will use these as
SUPABASE_URLandSUPABASE_KEYin Railway and when running the seed script.
- In the Supabase dashboard, open SQL Editor.
- Open the file
backend/scripts/create_tables.sqlfrom this repo and copy its full contents. - Paste into the SQL Editor and click Run.
- Confirm there are no errors. This creates:
profiles,baselines,risk_state,transactions,compliance_state,rulebooks,new_regulations,compliance_drafts,agent_traces,agent_steps.
The seed script reads from backend/data/ and requires SUPABASE_URL and SUPABASE_KEY. Run it once from your machine (or any environment that has the repo and env vars).
-
From the repo root:
cd backend -
Create a
.envinbackend/with:SUPABASE_URL=https://your-project.supabase.co SUPABASE_KEY=your-anon-key
Use the same URL and anon key from step 0.1.
-
Install dependencies and run the seed script:
pip install -r requirements.txt python scripts/seed_supabase.py
Or with a virtualenv:
python -m venv .venv .venv\Scripts\activate # Windows # source .venv/bin/activate # macOS/Linux pip install -r requirements.txt python scripts/seed_supabase.py
-
The script expects these files under
backend/data/(they are in the repo):users.json— user profilesbaselines.json— user baselinesinitial_risk_state.json— optional; initial risk statehistorical_transactions.json— optional; historical transactionscompliance/malta.json,compliance/uae.json,compliance/cayman.json— compliance state and rulebookscompliance/new_regulations/malta_v2.json,uae_v2.json,cayman_v2.json— new regulations to push
If a file is missing, the script skips that part and continues.
-
When it finishes, you should see messages like “Seeded N profiles”, “Seeded compliance state…”, etc. The app will then work with real data once the backend is deployed.
Summary: Run backend/scripts/create_tables.sql in the Supabase SQL Editor once, then run backend/scripts/seed_supabase.py once from your machine (with backend/.env set). After that, you only need to deploy Railway and Vercel; no need to run these again unless you reset the database.
To undo experiments (data injection, anomaly detection, regulatory pushes) and restore everything to the initial seed state:
From the repo root:
cd backend
python scripts/reset_supabase_regulatory.pyRequires SUPABASE_URL and SUPABASE_KEY in backend/.env. The script:
- Clears agent_steps and agent_traces
- Clears all transactions
- Clears compliance_drafts and rulebooks
- Re-seeds profiles, baselines, risk_state (all users set to CLEAN/0), historical_transactions, compliance_state and v1 rulebooks from
backend/data/ - Sets all new_regulations.is_pushed to
false
After the reset, users, baselines, risk scores, transactions, and regulatory state match the initial seed.
-
Go to railway.app and sign in with GitHub.
-
New Project → Deploy from GitHub repo → select your ComplAI repo.
-
Set root directory
In the service: Settings → Source → Root Directory → set tobackend. -
Environment variables
In the service: Variables → add:Variable Value LLM_API_KEYYour Google AI API key LLM_MODELgemini-2.0-flashLLM_BASE_URLhttps://api.openai.com/v1SUPABASE_URLYour Supabase project URL SUPABASE_KEYYour Supabase anon key FRONTEND_URL(Set after Vercel deploy) -
Deploy
Railway uses Nixpacks, installs fromrequirements.txt, and runs theProcfile.PORTis set automatically. -
Public URL
Settings → Networking → Public Networking → Generate Domain.
Copy the URL (e.g.complai-backend-production.up.railway.app). You will use it for the frontend and forFRONTEND_URLafter Vercel is live.
-
Go to vercel.com and sign in with GitHub.
-
Add New → Project → import your ComplAI repo.
-
Root Directory
Set tofrontend(or leave default and configure build to usefrontend). -
Environment variables
Add:Variable Value NEXT_PUBLIC_API_URLhttps://<your-railway-domain>(no slash)Example:
https://complai-backend-production.up.railway.app -
Deploy
Vercel runsnext buildand deploys. Copy your Vercel URL (e.g.https://complai.vercel.app). -
CORS
In Railway, set Variables →FRONTEND_URLto your Vercel URL (e.g.https://complai.vercel.app).
Redeploy the backend or wait for the next restart so CORS allows the frontend origin.
- Supabase: Create project → run
backend/scripts/create_tables.sqlin SQL Editor → runbackend/scripts/seed_supabase.pylocally withbackend/.envset. - Deploy backend on Railway (use same
SUPABASE_URLandSUPABASE_KEY). - Copy Railway public URL.
- Deploy frontend on Vercel with
NEXT_PUBLIC_API_URL= Railway URL. - Copy Vercel URL.
- In Railway, set
FRONTEND_URLto Vercel URL and redeploy (or let it pick up on next deploy).
- Backend: Open
https://<railway-domain>/api/health— should return JSON with"status": "ok". - Frontend: Open your Vercel URL, go to Regulatory Hub, and confirm it loads compliance data (no CORS errors in the browser console).
- Data: If Regulatory Hub or Monitor show no data, ensure Supabase setup (section 0) was completed: tables created and
seed_supabase.pyrun successfully.
-
Backend: From repo root,
cd backendthenuvicorn main:app --reload --port 8000.
Use a.envinbackend/(seebackend/.env.example). -
Frontend: From repo root,
cd frontendthennpm run dev.
SetNEXT_PUBLIC_API_URL=http://localhost:8000infrontend/.env.local(or leave unset to default to localhost).