This app ingests SF 911 call data from data.sfgov.org (gnap-fj3t) every minute and displays:
- Latest 200 calls (fast)
- Load more button for older calls
- Realtime updates via Supabase Realtime
It can also (optionally) push new calls to Discord via a Discord Webhook from the ingest cron.
In Supabase SQL Editor, run:
supabase/schema.sql
Copy env.example to .env.local (Next.js convention) and fill:
SOCRATA_APP_TOKENNEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYINGEST_SECRETNEXT_PUBLIC_DISCORD_INVITE_URL(optional; adds a “Discord (live)” link in the UI)DISCORD_WEBHOOK_URL(optional)
npm install
npm run devcurl -X POST "http://localhost:3000/api/ingest?secret=$INGEST_SECRET"Create a Vercel Cron Job to hit:
/api/ingest?secret=YOUR_INGEST_SECRET
Run it every 1 minute.
If you set DISCORD_WEBHOOK_URL, each ingest run will post up to DISCORD_MAX_POSTS_PER_INGEST calls that have not been posted yet (tracked by discord_posted_at on public.calls).
Notes:
- Treat the webhook URL like a password: don’t commit it and rotate it if it leaks.
- Calls with
sensitive_call=truewill not include map coordinates.