Skip to content
Rushikesh Panchal

All selected work

LeadHub CRM

A B2B sales CRM whose pipeline and lead-scoring rules live in one TypeScript domain layer shared by client and server.

The problem

LeadHub is a sales CRM for teams that sell custom software, AI solutions and technology consulting: capture leads, qualify them, run the pipeline, send proposals and close deals in one place. Pipeline value, win rate and lead scores have to give the same answer on the dashboard and on the server.

Architecture

How LeadHub is put together

  1. Browser

    • React app, screens loaded on demand
    • Public inquiry form
  2. shared/, used by client and server

    • model.ts: stages and statuses
    • calc.ts: weighted pipeline, win rate, scoring
    • schemas.ts: Zod schema for every write
  3. Express 5 server

    • Sessions, scrypt hashing and roles
    • CSP, headers and rate limits
    • Business rules, activity log, duplicate checks
  4. SQLite via Turso (libSQL)

    • Versioned, append-only migrations
    • Foreign keys guard deletes
The React app and the Express 5 server both import one shared TypeScript layer of domain model, calculations and Zod schemas. The server adds sessions, roles, security headers and business rules, and stores data in SQLite through libSQL with versioned migrations and foreign keys.

Key decisions

One source of truth for the rules.
Every calculation lives in shared/calc.ts and every write’s validation in shared/schemas.ts, so the dashboard and the server always agree: the server enforces the schemas, the client shows the same field errors.
The database refuses bad deletes.
A company cannot be deleted while it has leads, opportunities or invoices, and a lead’s primary contact cannot be deleted. The server also rejects a lead whose contact belongs to a different company.
Migrations only move forward.
Schema changes are appended to a list in server/db.ts, and each runs once, inside a transaction.
Status follows the work.
Logging the first call moves a lead to Contacted and booking discovery moves it to Discovery Scheduled; leads only move forward, and every change is written to the record’s timeline.

Proof

Every number opens its source. Every claim links to the code.

What it doesn’t do yet

  • It does not send email, calendar invites or push notifications yet; reminders stay in the app.
  • Proposal documents are not generated, and their views are not tracked.
  • There is no CSV import or export, and one installation serves one organisation.
  • The live CRM holds a real team’s data, so sign-in is by invitation; the public inquiry form is open to try.