All projects

Headroom

Headroom is a cash flow forecasting app for small businesses in Canada. It connects to the business's bank accounts, forecasts the combined balance 13 weeks ahead, and warns the owner before cash drops below a minimum they choose.

Headroom
  • Small businesses rarely fail because they are unprofitable on paper; they fail because cash runs out before money comes in. Headroom names the payments that cause each dip and suggests specific fixes, such as delaying a payment or collecting an invoice early. It is built for owner-operators of businesses with 2 to 50 employees and for the bookkeepers who serve them, and it works without accounting software through a bank-only mode.

    Features

    • 13-week combined cash forecast, refreshed by a nightly bank sync
    • Cash gap alerts that name the payments causing each drop below the owner's minimum balance
    • Suggested fixes, such as delaying a payment or collecting an invoice early
    • Bank connection through Plaid, with account selection and a minimum-balance setting
    • Recurring and expected payments, detected from transaction history or added by hand
    • Forecast accuracy scoring, and a synthetic sample business to explore without a bank connection

    Architecture & Design

    The project is built as 36 short specs in dependency order, and a spec can start only once the specs it depends on are done. The web app and the API are separate services:

    Next.js web app (server components, server-side calls only)
            │
            ▼
    FastAPI core ── accounts · bank_sync · forecasting · alerts · notifications
            │            (in-process event bus: transactions.synced → forecast.updated → alert.created)
            ▼
    PostgreSQL (Alembic migrations)        Hourly jobs (Railway): sync banks, score accuracy, retry emails
    

    Key design decisions:

    • Five independent API modules. Each module owns its slice of the domain and talks to the others through an in-process event bus, so a new bank sync triggers a forecast, and a new forecast triggers alerts, without the modules importing each other.
    • The browser never calls the API. The Next.js app loads data in server components and calls the API only from the server.
    • Tenant isolation by construction. Every row of customer data belongs to a business and every query filters on it.
    • Bank data stays on the backend. Plaid access tokens are encrypted before they are stored, and tokens, account numbers and raw provider data are never logged or returned.
    • A contract between the services. The OpenAPI contract is generated from the API and the typed client is generated from the contract, so the two sides cannot drift.

    Author: Felipe Viana

  • Scope

    • Pre-launch: specs 01 to 28 are done (setup and CI, design system, auth, bank connection, sync, forecast engine, alerts, dashboard, email foundation)
    • Not started yet: alert emails, the weekly digest, bookkeeper invitations and launch (specs 29 to 36)
    • The live app is behind sign-in, so the thumbnail shows the dashboard design with a synthetic business
    • Code, tests and fixtures use only synthetic data and the Plaid sandbox