Get your API key

Lesson 2 of 5

Build leads, notes and the Today list

Add-lead form with Indian mobile checks, a searchable list, a lead page with notes and status history, and the Today and Overdue follow-ups.

8 min Log in to open
One step at a time, like flipping pages.

By the end of this lesson your mini CRM will add leads with a checked Indian mobile number, list and filter them, keep a timeline of notes and status changes, and show today's and overdue follow-ups.

You need: the mini-crm folder with an approved PRD.md from lesson 1, your coding agent · Time: 8 minutes

  1. You will build every screen with fake leads saved in the browser (localStorage) first. Real customer data goes in only after lesson 4 adds logins and database rules.

    Here is the data you are building. One leads table holds the fields from lesson 1; two small tables keep the history:

    Three tables. leads has name, phone, source, interest, budget_inr, status, next_follow_up, owner_id and created_at. notes has lead_id, text and created_at. status_changes has lead_id, from and to status, and changed_at. Lines connect both small tables to leads.
    One row per enquiry, plus two history tables.
    Prompt · copy it into your AI agent
    Read PRD.md first.
    Goal: Create the mini CRM project and its data layer. No screens yet.
    Context: I am a beginner; you write all the code. This folder has PRD.md.
    Details:
    - Create a Vite + React app in this folder with the official create command. Keep PRD.md.
    - Put ALL data reading and writing in one file, src/lib/leadsStore.ts, so we can swap localStorage for Supabase later without touching the screens.
    - Data: leads (id, name, phone, source, interest, budget_inr, status, next_follow_up as YYYY-MM-DD, owner_id, created_at, updated_at), notes (id, lead_id, text, created_at), status_changes (id, lead_id, from_status, to_status, changed_at).
    - For now save everything in localStorage under the key "mini-crm-v1".
    Rules: Ask me before installing any package other than what the create command installs. Do not build any screens yet.
    Done when: the app starts with npm run dev, and you show me the list of functions in leadsStore.ts with one line each on what it does.

    Then make your first save point, as in Build screen by screen: git init, git add -A, git commit -m "Project and data layer".

    Why?

    Fake data in the browser means a bug can never leak a real customer's phone number. Keeping all data code in one file makes lesson 4 a single, small swap instead of a rewrite of every screen.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. The Add lead form, with Indian mobile checks
  2. The Leads list with search and filters
  3. Lead detail: notes and status history
  4. The Today screen: due and overdue
  5. Fill it with fake test data
  6. Recap