Cross-platform console that ingests, normalizes, and analyzes event-level data from Pred (Base order-book) and Kash (social AMM on X), with incumbent benchmarks (Kalshi/Polymarket). Exposes liquidity, market-quality, and behavior metrics via a web dashboard and exportable artifacts.
- Database: Postgres (Supabase)
- API + UI: Next.js App Router (API routes + dashboard)
- Ingestion: TypeScript workers (viem + Supabase)
- Analytics: SQL/TypeScript jobs for aggregates
- Tooling: Bun
-
Secrets: Copy
.env.exampleto.envand fill in your values. Do not commit.envor real API keys. -
Supabase: Create a project, run migrations, set env vars.
cd supabase && supabase link # or apply migrations via Dashboard
Set
SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEY(orSUPABASE_ANON_KEY) and for dashboardNEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_ANON_KEY. -
Install
bun install
-
Apply migrations
bun run db:migrate
Requires
supabase link(or use a linked project). Or applysupabase/migrations/*.sqlmanually in the Supabase SQL editor. -
Ingestion (set contract addresses and RPC in env first; see
docs/pred-abi-and-events.md,docs/kash-abi-and-events.md):PRED_EXCHANGE_ADDRESS=0x... BASE_RPC_URL=... bun run ingest:pred KASH_AMM_ADDRESS=0x... bun run ingest:kash bun run ingest:incumbent bun run normalize
-
Analytics (normalize first, then run all analytics in one go)
bun run pipeline
Or step by step:
bun run normalizethenbun run analytics:daily,bun run analytics:snapshots,bun run analytics:trader.
To backfill market_daily_aggregates for a date range:BACKFILL_FROM=2025-01-01 BACKFILL_TO=2025-01-31 bun run analytics:backfill. -
Apply everything (migrations + full pipeline)
bun run apply
Use after ingestion has populated raw tables; runs
db:migratethenpipeline. -
Apply remaining steps (checklist)
Run in order: (1)bun run db:migrate, (2) start indexers and/or runingest:incumbent, (3)bun run normalize, (4)bun run pipeline. Then start the dashboard withbun run dev. -
Dashboard
bun run dev
Open http://localhost:3000.
Quick demo: To see the UI without running ingestion, run bun run dev and open http://localhost:3000/markets. The list may be empty until ingestion and the pipeline have run.
- Root Directory: In the Vercel project settings, set Root Directory to
apps/dashboard(monorepo). - Build: Vercel will run
next buildfrom that root; no extra config needed. - Environment variables: Add in Vercel → Settings → Environment Variables:
NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_ANON_KEY(required)- Optionally
SUPABASE_SERVICE_ROLE_KEYfor server-only export features
- The dashboard uses
vercel.jsoninapps/dashboardfor caching headers and security; API list/status/benchmarks revalidate every 30–60s.
Ready to show: Run bun run dev, open the app at http://localhost:3000, and use Markets, Benchmarks, and Docs (header). For the full narrative, use the example founder deck.
- Methodology & metrics — How spreads, depth, Gini, and volume are defined and computed; data freshness.
- API reference — Endpoints, query params, and response shapes.
- Data and privacy — What data is stored and how it is handled.
apps/dashboard– Next.js app (API routes + Overview, Market explorer, Participant view, Social view, CSV export)packages/db– Supabase clientpackages/ingestion/pred-indexer– Pred chain indexerpackages/ingestion/kash-indexer– Kash chain indexerpackages/ingestion/incumbent-collector– Kalshi/Polymarket API collectorpackages/ingestion/normalize– Raw → normalized (markets, orders, trades, amm_trades)packages/analytics/market-daily– market_daily_aggregatespackages/analytics/liquidity-snapshots– market_liquidity_snapshotspackages/analytics/trader-daily– trader_daily_statssupabase/migrations– Schema DDLdocs/– Recon (Pred/Kash/incumbent APIs), consulting drafts, deck template
See docs/API.md for the full reference. Summary:
GET /api/markets?platform=pred&category=sports– list markets with statsGET /api/markets/[id]/liquidity?interval=15m– liquidity time-seriesGET /api/markets/[id]/participants– top wallets by volumeGET /api/social/[marketId]– social posts and metrics for KashGET /api/export/market/[id]/daily– CSV download
- Example founder deck — Full narrative with traceable metrics (for demos/pitches).
docs/consulting/pred-liquidity-diagnostic.mddocs/consulting/kash-social-liquidity-report.mddocs/consulting/incumbent-benchmarking.mddocs/consulting/deck-template.md
Schema reference: .cursor/skills/liquidity-console-domain/reference.md.