# SaaS Unit Economics Pack (Sheet + TypeScript)

Gross margin, LTV:CAC, CAC payback, the churn ceiling, break-even and runway, with AI inference and VM hours priced in as real cost of goods. The Google Sheets / Excel version and the zero-dependency TypeScript version run the same formulas, with tests that pin them to the same example.

Source: https://founder2.com/packs/unit-economics

---

<!-- file: README.md -->

## README.md

# SaaS Unit Economics Pack

The numbers that decide whether your SaaS works — **including the AI inference and sandbox costs** most templates leave out.
Two versions of the same model:

- `unit-economics.csv` — import into Google Sheets (File → Import → Upload) or open in Excel / Numbers. Column B rows 3–18
  are inputs; everything below is live formulas.
- `src/econ.ts` — the same math as a zero-dependency TypeScript module, with tests that pin it to the sheet's example.

## What it answers

| Question | Row |
| --- | --- |
| What does one customer actually cost me per month? | Total COGS per customer |
| Is my gross margin SaaS-shaped, or am I reselling tokens? | Gross margin |
| How long until a customer pays back what I spent to get them? | CAC payback |
| Where does growth stop if nothing changes? | Customer ceiling / MRR ceiling |
| How many customers until I stop losing money? | Customers to break even |
| How long can I keep going? | Runway |

## The churn ceiling, in one line

If you add **N** customers a month and lose **c** of your base each month, your base converges on **N ÷ c**.
30 new a month at 5% churn caps you at 600 customers, whatever you ship. Below the ceiling, acquisition is the lever;
near it, only churn is.

## Formulas

See `METHODOLOGY.md`. Short version: lifetime = 1 ÷ churn capped at 60 months; LTV = gross profit × lifetime;
payback = CAC ÷ monthly gross profit. Health bands (LTV:CAC < 1 critical, < 3 warn; payback > 18 months warn) are
rules of thumb, not laws.

## About @founderos/econ

`src/econ.ts` is extracted from `@founderos/econ`, the package Founder2 uses for every number it shows you.
The package itself lives in our monorepo; this file is the standalone version, so there is nothing to install.
Copy it into your codebase and own it.

---

<!-- file: unit-economics.csv -->

## unit-economics.csv

```csv
Metric,Value,Unit,How it's computed / notes
INPUTS — edit column B,,,
Price per customer per month (ARPA),49,USD,Blended across plans. Annual plans: divide by 12.
Paying customers today,120,count,
Payment processing fee,0.029,%,Your processor's percentage fee as a fraction (0.029 = 2.9%).
Payment processing fixed fee,0.3,USD,Per charge.
AI tokens per customer per month,2,millions,"Input + output, all models. Pull it from your provider's usage export ÷ active customers."
Blended price per 1M tokens,3,USD,Weighted by how much traffic each model gets.
Sandbox / VM hours per customer per month,10,hours,"Agents, code runners, browsers. 0 if you have none."
Cost per VM hour,0.08,USD,
Other COGS per customer per month,1.5,USD,"Hosting share, email sends, support tooling, third-party APIs."
Monthly logo churn,0.05,%,Customers lost this month ÷ customers at the start of the month.
Monthly expansion,0.01,%,Expansion MRR ÷ starting MRR. 0 if you don't upsell.
CAC (cost to acquire one paying customer),150,USD,All sales + marketing spend ÷ new paying customers. Include your own time if you want the truth.
New paying customers per month,30,count,
Fixed monthly costs,4000,USD,"Salaries (including yours), tools, rent. Not per-customer."
Cash in bank,50000,USD,
Target MRR,10000,USD,
,,,
"OUTPUTS — formulas, don't edit",,,
Payment fees per customer,=B3*B5+B6,USD,price × fee% + fixed fee
AI inference cost per customer,=B7*B8,USD,tokens (M) × $/M
Sandbox / VM cost per customer,=B9*B10,USD,hours × $/hour
Total COGS per customer,=B21+B22+B23+B11,USD,
Gross profit per customer per month,=B3-B24,USD,
Gross margin,"=IF(B3=0,0,B25/B3)",%,Classic SaaS runs 75–85%. AI-heavy products often land far lower; this is the line that tells you.
Customer lifetime,"=IF(B12<=0,60,MIN(1/B12,60))",months,"1 ÷ churn, capped at 60 months"
LTV (gross profit),=B25*B27,USD,gross profit × lifetime
LTV with expansion,"=B25*IF(B12-B13<=0,60,MIN(1/(B12-B13),60))",USD,revenue decays at (churn − expansion)
LTV : CAC,"=IF(B14=0,""n/a"",B28/B14)",ratio,
LTV : CAC health,"=IF(B14=0,""unknown"",IF(B30<1,""critical"",IF(B30<3,""warn"",""ok"")))",,"< 1 critical, < 3 warn (rule of thumb)"
CAC payback,"=IF(B25<=0,""never"",B14/B25)",months,CAC ÷ gross profit per month
Payback health,"=IF(B25<=0,""unknown"",IF(B32>18,""warn"",""ok""))",,> 18 months warns (SMB rule of thumb)
Customer ceiling,"=IF(B12<=0,""none"",B15/B12)",count,Where new customers = churned customers. You stop growing here.
MRR ceiling,"=IF(B12<=0,""none"",B34*B3)",USD,The number your current acquisition + churn converge on.
MRR today,=B4*B3,USD,
Monthly net (gross profit − fixed costs),=B4*B25-B16,USD,Ignores acquisition spend; subtract it if you pay for growth.
Customers to break even,"=IF(B25<=0,""never"",ROUNDUP(B16/B25,0))",count,
Runway at today's numbers,"=IF(B37>=0,""profitable"",B17/-B37)",months,Flat MRR. The TypeScript version can model growth.
Customers for target MRR,"=IF(B18<=0,0,IF(B3<=0,""n/a"",ROUNDUP(B18/B3,0)))",count,
Target reachable before the ceiling?,"=IF(B12<=0,""yes"",IF(B18<=B35,""yes"",""no — fix churn or acquisition first""))",,
```

---

<!-- file: METHODOLOGY.md -->

## METHODOLOGY.md

# Methodology

All values are per customer per month unless stated. Rates are fractions.

## COGS

```
payment fees   = price × fee% + fixed fee
AI inference   = tokens per customer (millions) × blended $ per 1M tokens
sandbox / VM   = VM hours per customer × $ per hour
COGS           = payment fees + AI inference + sandbox + other COGS
gross profit   = price − COGS
gross margin   = gross profit ÷ price
```

**Measuring tokens per customer:** export last month's usage from each model provider, sum input + output tokens,
divide by customers active that month. Use the median customer, then rerun with your 90th-percentile customer:
if the heavy user's gross profit goes negative, you need a usage cap or a usage-based tier, not a bigger price.

**Blended price per 1M tokens:** weight each model's price by its share of your tokens. Output tokens usually cost
several times input tokens, so weight them separately if your ratio is lopsided.

## Lifetime and LTV

```
lifetime            = min(1 ÷ churn, 60)        (60 when churn is 0)
LTV                 = gross profit × lifetime
LTV with expansion  = gross profit × min(1 ÷ (churn − expansion), 60)
```

The 60-month cap stops a lucky low-churn month from producing an LTV you can't bank. LTV here is gross-profit LTV,
not revenue LTV — revenue LTV flatters AI products the most.

## Acquisition

```
LTV : CAC     = LTV ÷ CAC
CAC payback   = CAC ÷ gross profit per month
```

## Growth ceiling

```
customer ceiling = new customers per month ÷ churn
MRR ceiling      = customer ceiling × price
```

This is the steady state where churned customers equal new ones. It assumes constant acquisition and churn, which is
exactly why it is useful: it shows where today's machine ends up.

## Cash

```
monthly net        = customers × gross profit − fixed costs
break-even         = ceil(fixed costs ÷ gross profit)
runway (sheet)     = cash ÷ −monthly net     (flat MRR)
runway (TS)        = month-by-month with optional MRR growth
```

Acquisition spend is not in monthly net. If you pay for growth, add it to fixed costs.

---

<!-- file: src/econ.ts -->

## src/econ.ts

```ts
/**
 * SaaS unit economics with AI inference and sandbox COGS. Zero dependencies.
 * Same formulas as unit-economics.csv and Founder2's @founderos/econ package.
 * Source: https://founder2.com/packs/unit-economics (CC0)
 *
 * All rates are fractions (0.05 = 5%). All money is in one currency, per month.
 */

export const HORIZON_MONTHS = 60;
export const LTV_CAC_CRITICAL = 1;
export const LTV_CAC_WARN = 3;
export const PAYBACK_WARN_MONTHS = 18;

export type Health = "unknown" | "critical" | "warn" | "ok";

export interface EconInputs {
  price: number;
  currentCustomers: number;
  feePct: number;
  feeFixed: number;
  tokensM: number;
  pricePerM: number;
  vmHours: number;
  vmRate: number;
  otherCogs: number;
  churn: number;
  expansion: number;
  cac: number;
  newPerMonth: number;
  fixedCosts: number;
  cash: number;
  targetMrr: number;
  /** Optional monthly MRR growth for the runway model (0.05 = 5%). Default 0, matching the sheet. */
  mrrGrowth?: number;
}

export function safeDivide(n: number, d: number): number | null {
  if (!Number.isFinite(n) || !Number.isFinite(d) || d === 0) return null;
  const q = n / d;
  return Number.isFinite(q) ? q : null;
}

/** 1 / churn, capped at the horizon. Zero or negative churn gives the horizon. */
export function lifetimeMonths(monthlyChurn: number, horizon = HORIZON_MONTHS): number {
  if (monthlyChurn <= 0) return horizon;
  return Math.min(1 / monthlyChurn, horizon);
}

export function ltvCacHealth(ratio: number | null): Health {
  if (ratio === null) return "unknown";
  if (ratio < LTV_CAC_CRITICAL) return "critical";
  if (ratio < LTV_CAC_WARN) return "warn";
  return "ok";
}

/**
 * Months until cash runs out. Month t earns mrr × (1 + growth)^(t − 1) of gross profit
 * against fixed costs. Returns null when cash outlasts maxMonths (profitable or close to it).
 */
export function runwayMonths(args: { cash: number; monthlyGrossProfit: number; fixedCosts: number; growth?: number; maxMonths?: number }): number | null {
  const { cash, monthlyGrossProfit, fixedCosts, growth = 0, maxMonths = 600 } = args;
  if (growth <= -1) return null;
  let balance = cash;
  for (let month = 1; month <= maxMonths; month += 1) {
    const net = monthlyGrossProfit * Math.pow(1 + growth, month - 1) - fixedCosts;
    if (net >= 0) {
      balance += net;
      continue;
    }
    if (balance + net < 0) return month - 1 + balance / -net;
    balance += net;
  }
  return null;
}

export function computeUnitEconomics(i: EconInputs) {
  const paymentFees = i.price * i.feePct + i.feeFixed;
  const aiCogs = i.tokensM * i.pricePerM;
  const vmCogs = i.vmHours * i.vmRate;
  const cogs = paymentFees + aiCogs + vmCogs + i.otherCogs;
  const grossProfit = i.price - cogs;
  const grossMargin = i.price === 0 ? 0 : grossProfit / i.price;
  const lifetime = lifetimeMonths(i.churn);
  const ltv = grossProfit * lifetime;
  const ltvExpansion = grossProfit * lifetimeMonths(i.churn - i.expansion);
  const ltvCac = safeDivide(ltv, i.cac);
  const payback = grossProfit > 0 ? i.cac / grossProfit : null;
  const customerCeiling = i.churn > 0 ? i.newPerMonth / i.churn : null;
  const mrrCeiling = customerCeiling === null ? null : customerCeiling * i.price;
  const currentMrr = i.currentCustomers * i.price;
  const monthlyNet = i.currentCustomers * grossProfit - i.fixedCosts;
  const customersForTarget = i.targetMrr <= 0 ? 0 : i.price <= 0 ? null : Math.ceil(i.targetMrr / i.price - 1e-9);
  return {
    paymentFees,
    aiCogs,
    vmCogs,
    cogs,
    grossProfit,
    grossMargin,
    lifetime,
    ltv,
    ltvExpansion,
    ltvCac,
    ltvCacStatus: ltvCacHealth(ltvCac),
    payback,
    paybackStatus: (payback === null ? "unknown" : payback > PAYBACK_WARN_MONTHS ? "warn" : "ok") as Health,
    customerCeiling,
    mrrCeiling,
    currentMrr,
    monthlyNet,
    breakEven: grossProfit > 0 ? Math.ceil(i.fixedCosts / grossProfit - 1e-9) : null,
    runway: runwayMonths({ cash: i.cash, monthlyGrossProfit: i.currentCustomers * grossProfit, fixedCosts: i.fixedCosts, growth: i.mrrGrowth }),
    customersForTarget,
    targetReachable: mrrCeiling === null || i.targetMrr <= mrrCeiling,
  };
}

/** The sheet's example inputs, so you can check the two agree. */
export const EXAMPLE: EconInputs = {
  price: 49,
  currentCustomers: 120,
  feePct: 0.029,
  feeFixed: 0.3,
  tokensM: 2,
  pricePerM: 3,
  vmHours: 10,
  vmRate: 0.08,
  otherCogs: 1.5,
  churn: 0.05,
  expansion: 0.01,
  cac: 150,
  newPerMonth: 30,
  fixedCosts: 4000,
  cash: 50000,
  targetMrr: 10000
};
```

---

<!-- file: src/econ.test.ts -->

## src/econ.test.ts

```ts
import { describe, expect, it } from "vitest";
import { computeUnitEconomics, EXAMPLE, lifetimeMonths, runwayMonths } from "./econ";

describe("unit economics (example inputs = the sheet's defaults)", () => {
  const out = computeUnitEconomics(EXAMPLE);

  it("prices COGS the way the sheet does", () => {
    expect(out.paymentFees).toBeCloseTo(49 * 0.029 + 0.3, 6); // 1.721
    expect(out.aiCogs).toBe(6);
    expect(out.vmCogs).toBeCloseTo(0.8, 6);
    expect(out.cogs).toBeCloseTo(10.021, 6);
    expect(out.grossProfit).toBeCloseTo(38.979, 6);
    expect(out.grossMargin).toBeCloseTo(0.7955, 4);
  });

  it("computes LTV, LTV:CAC and payback", () => {
    expect(out.lifetime).toBe(20);
    expect(out.ltv).toBeCloseTo(779.58, 2);
    expect(out.ltvCac).toBeCloseTo(5.197, 3);
    expect(out.ltvCacStatus).toBe("ok");
    expect(out.payback).toBeCloseTo(3.848, 3);
  });

  it("finds the churn ceiling", () => {
    expect(out.customerCeiling).toBeCloseTo(600, 6);
    expect(out.mrrCeiling).toBeCloseTo(29400, 6);
    expect(out.targetReachable).toBe(true);
  });

  it("break-even and runway", () => {
    expect(out.monthlyNet).toBeCloseTo(120 * 38.979 - 4000, 6); // +677.48: profitable
    expect(out.breakEven).toBe(103);
    expect(out.runway).toBeNull();
  });

  it("caps lifetime at 60 months", () => {
    expect(lifetimeMonths(0)).toBe(60);
    expect(lifetimeMonths(0.01)).toBe(60);
  });

  it("models runway with growth", () => {
    expect(runwayMonths({ cash: 10000, monthlyGrossProfit: 0, fixedCosts: 1000 })).toBeCloseTo(10, 6);
    const flat = runwayMonths({ cash: 10000, monthlyGrossProfit: 500, fixedCosts: 1500 })!;
    const growing = runwayMonths({ cash: 10000, monthlyGrossProfit: 500, fixedCosts: 1500, growth: 0.1 });
    expect(flat).toBeCloseTo(10, 6);
    expect(growing === null || growing > flat).toBe(true);
  });
});
```
