All projects
Cloudflare Workers · D1 · AI triage

Every Lead Saved, Sorted and Answered, Day or Night

A multi-tenant lead system on Cloudflare Workers: one deployment serves many businesses, each with its own key, settings and data. A form sends the lead; the system saves it and answers the form at once, then classifies it and alerts the owner in the background.

  • Live system
  • Cloudflare Workers
  • D1 (SQLite)
  • KV
  • Gemini + Workers AI
  • Web Push
How it connects
  1. Website form any site or landing page
  2. Intake saved first, answered at once
  3. AI triage hot / warm / junk + reply draft
  4. Owner alert phone push · WhatsApp · email
  5. Reminders + report 15 / 60 min · weekly
Your tools The backend I build Where the data lands Alert
Saved first The lead is stored before the AI runs, so an AI outage can't lose it
15 / 60 min Reminders until someone replies; night leads wait for the morning
The case

How It Works

  1. 01

    Why speed matters

    Leads contacted within 5 minutes are 21× more likely to qualify than leads contacted after 30 minutes (MIT / InsideSales lead response study). Most small businesses reply hours later, or never.

  2. 02

    What happens to a lead

    The form gets its answer straight away. In the background the AI reads the message, marks it hot, warm or junk, writes a one-line summary and drafts the reply. The owner gets a phone notification with the draft ready to send.

  3. 03

    Until someone answers

    Every 10 minutes the system looks for leads nobody has answered and reminds the owner at 15 and 60 minutes. A day after a reply it asks "Won or lost?", and every Monday it sends a short report.

Reliability

Built to Keep Running, Not Just to Demo

The same rules I check in every health check, and how this system handles them.

Errors

Each step runs on its own. If the AI fails, the alert still goes out with a plain reply draft, and the failure is logged.

Retries

If the main AI model is slow or fails, a second model starts at once in parallel and the first good answer wins. A model that keeps failing is skipped for a while. A form that sends the same lead twice is saved once.

Alerts

WhatsApp first when it's set up for the business, then a phone push notification if nothing got through, plus an optional email.

Keys

Each business has its own intake key, stored only as a hash.

Logs

Every AI fallback, failure and over-limit lead is written to an event log for that business.

When Traffic Grows

  • One deployment serves many businesses. Every database query is scoped to one business, so no business can see another's leads.
  • Runs on Cloudflare's network, so there is no server to keep up. Daily and monthly limits per business stop a spam flood from running up AI costs.

Keys and Client Data

  • Per-business intake keys, stored as hashes.
  • Every query is scoped by business, so data never mixes between clients.
  • Rate limits on the public demo and lead limits per business.