Scale TradeClaw with Supabase
Migrate from JSON files to managed Postgres in 5 minutes. Persistent data, real multi-user support, and a built-in dashboard.
3-Step Quick Start
Create a Supabase project
Sign up free at supabase.com. Create a new project — copy your Project URL and anon/service keys.
https://supabase.com/dashboard/newRun the schema
Recommended: paste schema.sql into the Supabase SQL Editor. If you prefer CLI, replace [PASSWORD] and [PROJECT-REF] with your database credentials.
psql "postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres" -f supabase/schema.sqlMigrate your data
Reads your existing data/*.json files and upserts everything into Supabase. Safe to run multiple times.
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co SUPABASE_SERVICE_ROLE_KEY=ey... node supabase/migrate.jsWhy Supabase?
Persistent Data
No more data loss on restart. Your signals, trades, and subscribers survive deploys and container rebuilds.
Real Multi-User
Row Level Security, proper auth, concurrent writes. Scale from solo to team without data corruption.
Handle 1M+ Rows
JSON files slow down at 10K records. Postgres handles millions with proper indexes and query planning.
Dashboard UI
Supabase Studio gives you a full admin panel — browse tables, run queries, manage RLS policies, view logs.
Schema Preview
-- Core tables (20+ total)
CREATE TABLE signal_history (
id TEXT PRIMARY KEY,
pair TEXT NOT NULL,
direction TEXT CHECK (direction IN ('BUY','SELL')),
confidence NUMERIC NOT NULL,
entry_price NUMERIC NOT NULL,
timestamp BIGINT NOT NULL,
outcomes JSONB DEFAULT '{}'
);
CREATE TABLE paper_trades (
id TEXT PRIMARY KEY,
symbol TEXT NOT NULL,
direction TEXT NOT NULL,
entry_price NUMERIC, exit_price NUMERIC,
pnl NUMERIC, pnl_percent NUMERIC,
opened_at TIMESTAMPTZ, closed_at TIMESTAMPTZ
);
CREATE TABLE webhooks (
id TEXT PRIMARY KEY,
name TEXT NOT NULL, url TEXT NOT NULL,
pairs JSONB DEFAULT '"all"',
min_confidence INTEGER DEFAULT 0,
enabled BOOLEAN DEFAULT true
);
-- + api_keys, users, email_subscribers,
-- telegram_subscribers, sms_subscribers,
-- plugins, price_alerts, votes, pledges,
-- push_subscriptions, slack_integrations,
-- app_users, subscriptions, and more...Migration Script
#!/usr/bin/env node
// Reads data/*.json → upserts into Supabase
node supabase/migrate.js # migrate all
node supabase/migrate.js --dry-run # preview only
node supabase/migrate.js --seed # seed data infoEnvironment Variables
| Variable | Description | Example |
|---|---|---|
| NEXT_PUBLIC_SUPABASE_URL | Your Supabase project URL | https://abc123.supabase.co |
| NEXT_PUBLIC_SUPABASE_ANON_KEY | Public anon key (safe for browser) | eyJhbGciOiJIUzI1NiIs... |
| SUPABASE_SERVICE_ROLE_KEY | Service role key (server-side only) | eyJhbGciOiJIUzI1NiIs... |
Deploy with Supabase
Full Documentation
Complete guide covering schema reference, RLS policies, troubleshooting, and FAQ.
Read docs/SUPABASE.md