APIs & setup
The system depends on four external services. Three are quick free signups, one is a $5/month minimum for Cloudflare, one is pay-as-you-go for the LLM classifier. Total monthly running cost lands somewhere between £60 and £125 once everything is wired together.
Cloudflare runs everything. Neon stores everything. Two external APIs — Companies House and Anthropic — supply the signals. The dashboard reads from Neon; the workers write to Neon. That’s the whole topology.
┌─────────────────────────────┐
│ YOUR LAPTOP │
│ wrangler deploy / secrets │
└──────────────┬──────────────┘
│
┌──────────────────────────┼──────────────────────────┐
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ CLOUDFLARE│◄──reads───►│ NEON │◄──reads─────►│ DASHBOARD │
│ Workers │ writes │ Postgres │ │ Pages │
└─────┬─────┘ └───────────┘ └───────────┘
│
│ fetches
▼
┌──────────────────────────────────────────┐
│ COMPANIES HOUSE ANTHROPIC │
│ (filings, charges) (classifier) │
└──────────────────────────────────────────┘
Workers run the five background jobs. Pages hosts the dashboard. Queues pass messages between workers. KV holds the Companies House rate-limit counter. R2 stores the daily finance CSVs.
npm install -g wrangler && wrangler login. A browser tab opens; click authorise.All merchants, signals, invoices and exposure snapshots live here. Workers write; the dashboard reads. Neon is serverless Postgres — cheap to start, branchable for safe schema changes, scales when you need it.
redbrain-risk. Region: eu-west-2 (London) — closest to Cloudflare’s London edge.-pooler in the hostname. Save it somewhere safe.DATABASE_URL. You’ll paste it into Cloudflare six times during deploy.Filings, charges, officer changes, gazette notices, accounts overdue flags. The most reliable signal in the whole system — it’s the official register, and merchants can’t hide from it.
CH_API_KEY.Claude Haiku reads each scraped news article and answers: which merchants are mentioned, how severe is the distress signal, what kind. Cheap and fast at scale. The system would work without it — you’d just lose press signals.
ANTHROPIC_API_KEY.Four secrets, six places. Once you have the keys, deploy is mostly copy-paste.
| Secret | Used by | How to set it |
|---|---|---|
DATABASE_URL |
All 5 workers + dashboard | wrangler secret put (workers)wrangler pages secret put (dashboard) |
CH_API_KEY |
Companies House worker only | wrangler secret put in workers/companies-house/ |
ANTHROPIC_API_KEY |
Classifier worker only | wrangler secret put in workers/classifier/ |
DASHBOARD_PASSWORD |
Dashboard only | wrangler pages secret put |
Variable component is the LLM classifier — scales with article volume. Everything else is roughly fixed.
Don’t try to do everything in one sitting. The signups can be done over a cuppa. The deploy needs a focused afternoon.
About 30 minutes. Have card details ready for Cloudflare and Anthropic. Save the four keys/strings in a password manager or local notes file.
Either via psql on your laptop, or paste into the Neon SQL editor in your browser. Five minutes. Populates 11 sample merchants so the dashboard has data on day one.
wrangler login.Browser tab opens. Click authorise. Now your laptop can deploy to Cloudflare.
Roughly 10 minutes per worker. For each: cd workers/<name>, npm install, wrangler secret put DATABASE_URL, wrangler deploy. The Companies House worker also takes CH_API_KEY; the classifier also takes ANTHROPIC_API_KEY.
cd dashboard, npm install, npm run pages:deploy. Set DATABASE_URL and DASHBOARD_PASSWORD. Redeploy once more so the env vars take effect.
Log in with your password. You should see all 11 seeded merchants on the finance view. Wait ~6 hours for the first Companies House sync, ~30 minutes for the first news scrape.
DEPLOY.md in the repo has the exact commands. This page is the why; DEPLOY.md is the how.