All Docs
FeaturesSaaS FactoryUpdated February 19, 2026

Deal Pipeline & AI-Powered Lead Scoring

Deal Pipeline & AI-Powered Lead Scoring

The SaaS Factory platform includes a fully autonomous deal pipeline with a built-in, deterministic lead scoring engine. From the moment a lead enters the system to the point a deal is closed, every step is tracked, scored, and automated — with no human sales team required.


Overview

The deal pipeline system consists of three core components:

  1. Lead management — capture, score, and qualify inbound prospects.
  2. Deal management — advance qualified leads through pipeline stages to close.
  3. Automation — Inngest events trigger downstream workflows at key lifecycle moments.

Lead Scoring Model

Every lead is automatically assigned a score out of 100 points using computeLeadScore(). The model is fully deterministic and transparent — no black-box ML. Scores are broken into four dimensions:

DimensionMax PointsWhat It Measures
Firmographic30Company size, industry presence, company-level signals
BANT25Budget, Authority, Need, and Timeline qualification
ICP Match25Title seniority, role relevance, and industry ICP alignment
Engagement20Lead source quality and engagement behaviour

Rescoring

Scores can be recalculated at any time by calling the rescoreLead endpoint. This is useful after enriching a lead record with new data or after a qualification call updates BANT signals.

Aggregate Stats

Use getLeadStats to retrieve aggregate scoring statistics across your lead pool — useful for pipeline health monitoring and conversion rate analysis.


Deal Pipeline

Stage Management

Deals are created from qualified leads and progress through configurable pipeline stages. When a deal is created:

  • Stage probability defaults are applied automatically based on the starting stage.
  • Every subsequent stage change is recorded in the activity log, providing a full audit trail.

Pipeline Summary

The getPipelineSummary endpoint returns an aggregated view of all deals across stages — total value, count, and weighted pipeline value based on stage probabilities.

Kanban Dashboard

The DealPipelineDashboard component renders a live Kanban board view of the deal pipeline. It polls tRPC queries every 30 seconds to keep the board current without requiring a manual refresh.


API Reference (tRPC Router: deals)

Lead Endpoints

ProcedureDescription
createLeadCreate a new lead and trigger scoring
listLeadsList all leads with optional filters
getLeadFetch a single lead by ID
updateLeadUpdate lead fields (triggers rescore where relevant)
rescoreLeadRecalculate the lead score on demand
getLeadStatsRetrieve aggregate lead scoring statistics

Deal Endpoints

ProcedureDescription
createDealCreate a deal from a lead; applies stage probability defaults
listDealsList all deals, optionally filtered by stage
getDealFetch a single deal by ID
advanceDealMove a deal to the next pipeline stage; writes activity log
updateDealUpdate deal fields
addActivityManually add an activity entry to the deal log
getPipelineSummaryAggregate pipeline view across all stages

Automation via Inngest

The following Inngest events are fired automatically and can be used to trigger downstream workflows:

EventFired When
leads/createdA new lead is added to the pipeline
leads/convertedA lead is converted into a deal

These events integrate with the platform's broader automation infrastructure. Example downstream workflows include:

  • Triggering an onboarding sequence after conversion.
  • Suppressing converted leads from marketing campaigns.
  • Notifying customer health monitoring systems of new accounts.

Database Schema

Three tables back the deal pipeline:

  • leads — stores lead records, firmographic data, BANT signals, ICP fields, and computed scores.
  • deals — stores deal records, associated lead, current stage, probability, and value.
  • dealActivities — append-only activity log recording every stage change and manual activity entry.

Related