Fresh Leads: local business leads, verified the moment you search

A live SaaS I designed and built end to end. You type a trade and a town, like “dentists in Austin”, and it finds the real businesses, checks that their phone numbers and emails work, confirms they are still trading, and grades each one 0–100 for what you sell.

Next.js 15React 19TypeScript (strict)Supabase Postgres + RLSStripeClaude APIMCPVercel

Visit the live site (opens in new tab) · Read the engineering write-up: My crawler said 1 in 7 websites were down (opens in new tab)

The problem

People who sell to local businesses, such as web designers, SEO agencies and card-terminal resellers, buy lead lists that were scraped months ago. Half the numbers are dead, and the list is the same for everyone. A dentist with a broken website is a great lead for a web designer and irrelevant to someone selling payment terminals.

What it does

Architecture

One Next.js application on Vercel serves the marketing site, the dashboard, an operator panel, a public REST API and an MCP connector. All state lives in one Supabase Postgres database. The dashboard, REST API and MCP connector share one code path: an API key or MCP token is just another way to resolve “who is this user”, so a machine caller can never do more than the same customer can on screen.

Key engineering decisions

DecisionWhy
Money rules live in Postgres, not app code“Never charge twice” and “never double-grant a redelivered webhook” must hold across concurrent serverless instances. A unique index holds; an if in TypeScript doesn’t.
Idempotent paid actionsUnlocks are keyed on (user, business) and credit grants on the Stripe session, so retries, double-clicks and redeliveries are no-ops.
Expensive checks at unlock, not at searchA search can return 500 businesses. Only the few that are opened pay for phone and mailbox verification.
Owned business index for big metrosDiscovery from our own table takes 2.6–5.1 s against about 11 s for a rate-limited public API.
Stripe webhook is the only source of truthIt re-reads the purchase from Stripe rather than trusting the payload. A valid signature proves who sent it, not that the session exists.
Fail closed on spend, fail open on limitsAnything that spends money refuses when in doubt. A rate limiter that can’t reach the database lets the request through.

Built for AI agents: the MCP connector

Customers can connect Fresh Leads to Claude, ChatGPT or Cursor and ask, “find me 20 dentists in Austin with no website and open the best 5.” Sign-in uses a stateless OAuth flow (HMAC-signed clients and codes, the token is an ordinary revocable API key). Because an AI reading business websites can be prompt-injected, an AI can spend at most 30 credits per action, checked before it runs and failing closed, and it can never pay on its own. Slow searches return a ticket immediately and keep running in the background.

Security

A lesson from production

The crawler reported about 14% of websites as “down” when they were really blocking datacentre IP addresses. Measuring the retry stage showed it recovered zero of them while costing 22% of every search, so I deleted it. The fix was to keep the network error code and make “reachable” three-valued: proven down, up, or unknown. Full write-up on dev.to (opens in new tab).

Testing

Every Vercel build runs a guard, typecheck, lint and the unit suite (1,590+ tests covering scoring, deduplication, access rules, pricing, TOTP against RFC vectors, passkey attacks, the MCP protocol and the OAuth rules). Separate SQL tests run the credit functions against a throwaway Postgres to prove double unlocks, redelivered webhooks and parallel spend are safe.

Get in touch Open Fresh Leads (opens in new tab)