Modules
Docs

A CRM and partner
commissions inside
your own app.

An open source library and set of SQL migrations that adds leads, sales activity, agents and lifetime partner commissions to your own Node app and your own Postgres. No separate server, worker or second login.

npx tandem-crm init --database-url "$DATABASE_URL" --sample-data
// ONE SALES CYCLE, END TO END

From first lead
to a clean payout record.

▲ Capture a lead. Route it to the right agent. Keep the sales trail. Hold and release commission. Resolve disputes with a record you can replay. Tandem gives your app the workflow primitives; you keep the decisions.

Hand-drawn canyon expedition scene with a nest, hikers, trail fork, river, and distant summit
// NOTHING EXTRA TO RUN

No servers to manage.
It lives in your app and your database.

Tandem is a library, not a service. There is no separate server, worker, container or queue to deploy.

01 / WHERE IT RUNS

In your Node app

Camp mounts into your Next.js app as one route and runs on Node, like the rest of your app. It does not run on the edge runtime.

02 / WHAT IT NEEDS

A Postgres you already have

On serverless, use a pooled connection. Tandem needs a role it can switch into for row-level security, and init checks that for you.

03 / ONE SCHEDULED CALL

Release held commissions

One database function, release_due_commissions(), releases commissions whose hold has ended. Call it from pg_cron or your host's cron.

// HOW IT COMPARES

A CRM you adopt,
or a CRM you embed.

Tandem is for developers building a product where partners, agents or resellers are part of the business. If you want a CRM your team logs into today, use a hosted one. If you want a CRM and commissions inside your own product, with your own login and your own data, that is what Tandem is for.

TandemTwentyHubSpot, PipedriveRewardful, FirstPromoterBuild it yourself
What it isA library you embedAn app you adoptA hosted appA hosted affiliate toolYour own code
Extra server to runNoneSelf-hosted: yes. Or use their cloudNone, it is theirsNone, it is theirsUp to you
Inside your app and loginYesNo, a separate appNoNoYes
Data in your own PostgresYesIf self-hostedNoNoYes
Lifetime commissions, holds, clawbacksBuilt inNoNot built inRecurring, within their settingsYou write it
History that is never overwrittenYesVariesVariesLimitedYou write it
Team app ready on day oneBasic (Camp)Yes, polishedYesYesNo
Email sync, imports, integrationsNot yetYesYesSomeNo
SetupA developer, about an hourMediumMinutesMinutesWeeks
CostFree, MITFree self-hosted, or paid cloudPaid per seatPaid monthlyYour time

We list what Tandem does not do on purpose. If you need email sync, a long integration list or a polished team app on day one, pick one of the tools above. If you need a CRM and commissions that live inside your own product, that is the gap Tandem fills.

IN USE

Utuh partner commissions

Tandem has run the sales-partner commission ledger for Utuh, our fleet compliance product, since 20 October 2026.

BUILT ON TANDEM

Sunbear

Sunbear, a CRM for sales agents, is built on Tandem. It is open source, so you can fork it, change it and build something better. See Sunbear →

// WHAT IT DOES

A CRM foundation
for your app.

Tandem keeps a clear record in Postgres so your app can show the whole sales journey and your team can trace what happened.

01 / EVENT LOG

Append-only source of truth

Every important change is a typed event. You can trace the story without losing earlier decisions.

02 / PROJECTIONS

Rebuildable state

Lead, payout, and activity views build from events. Rebuild them whenever you need to.

03 / MONEY

Integer minor units

Commission amounts use whole cents or sen. Rounding is part of the rule, so the numbers stay clear.

04 / RULES

Qualification & routing

Set a qualification threshold. Choose round robin, least loaded, or manual assignment for each lead.

05 / LIFETIME

Commission on every payment

Each payment earns its own commission line, held until it is ready. Rates can step down as a customer ages, and refunds and clawbacks follow the money. How it works →

06 / AUTH

Vendor-neutral RLS

Use Supabase, plain Postgres, or your own identity provider. Tandem keeps each workspace separate.

// HOW IT WORKS

Start with your app
and Postgres.

Create a lead, record a payment. That is the whole write path. Every step is one function call inside a transaction you control. See the full walkthrough.

signup-and-pay.ts
import {
  createTandemPool, withTandemSession, createLead, appendLeadEvents, recordPayment,
} from 'tandem-crm/db';
import { defineTandemConfig } from 'tandem-crm';

const pool = createTandemPool(process.env.DATABASE_URL);
const config = defineTandemConfig({
  qualification: { automatedSetupMaxQualificationMetric: 15 },
  commission: {
    holdDays: 30,
    rateSchedule: [
      { fromMonth: 0, basisPoints: 2500 },
      { fromMonth: 12, basisPoints: 2000 },
    ],
  },
});

// 1. A customer signs up, referred by a partner.
const { leadId } = await withTandemSession(pool, adminUserId, (client) =>
  createLead(client, {
    workspaceId, companyName: 'Aman Logistics', contactPhone: '+60 12-345 6789',
    qualificationMetric: 0, productTag: 'starter', partnerId: 'partner-1', config,
  })
);

// 2. They say yes.
await withTandemSession(pool, adminUserId, (client) =>
  appendLeadEvents(client, {
    workspaceId, leadId, events: [{ type: 'conversion.confirmed', data: {} }],
  })
);

// 3. They pay. Every payment earns its own commission line, held for 30 days.
await withTandemSession(pool, adminUserId, (client) =>
  recordPayment(client, {
    workspaceId, leadId, config, source: 'stripe',
    payment: {
      paymentId: 'inv_001', amountMinor: 10000, currency: 'MYR',
      confirmedAt: new Date().toISOString(),
    },
    partnerStatus: async (id) => ({ id, active: true }),
  })
);
// 10,000 sen at 25% is 2,500 sen of commission, held.

// release_due_commissions() runs inside Postgres. Wire it to pg_cron
// or any scheduler you already have. No separate worker process.
// THE ADMIN SCREENS

A working CRM interface,
in one route.

Camp is the optional admin UI. It mounts into your Next.js app and shows leads, agents, commissions and disputes. The screens below run on sample data. Set it up in a few minutes.

A 16 second tour of Camp running on sample data.
Camp's Payouts screen with one commission line per payment, each showing its rate, and a house account line
Payouts: one commission line per payment, with its rate. A partner who left has their unpaid lines moved to the house account.
Camp's Overview screen showing open leads, wins, pending payouts and a pipeline breakdown
Overview: open leads, pending payouts and the pipeline at a glance.
Camp's Leads screen listing eight customers with their status and qualification metric
Leads: every customer with its status, sales stage and qualification.
// TESTED ON

Works with the Postgres
you already have.

Every push runs the security and money tests on Postgres 14 to 18, and again with a limited admin account like the ones managed hosts give you.

WherePostgresResultDate
Postgres 14, 15, 16, 17, 1814 to 18Passes on every pushEvery push
Limited admin account, not a superuser17Passes on every pushEvery push
Neon, pooled connection18Passed14 Oct 2026
Supabase17.11Passed17 Oct 2026
Layerbase, pooled connection18.6Passed17 Oct 2026
Aiven18.6Passed, using the host's CA certificate17 Oct 2026

In use: Tandem has run the sales-partner commissions for Utuh since 20 October 2026. It was checked end to end on the live Stripe account, with a real card payment and a real refund. Still early and pre-1.0: no outside developers use it yet.

Other hosts have not been tested yet. Run npx tandem-crm init against yours: it checks the one thing that differs between hosts and tells you what to change if it fails. Some hosts, Aiven among them, secure connections with their own certificate authority, which needs one setting. See the database guide. If it does not work on your host, tell us.

// MODULES

The customer journey,
kept together.

A customer's journey from first lead to a clear, lasting record.

Live

Terrain

The ground truth beneath the CRM: leads, typed event history, rebuildable state, exact money math, and tenant-safe Postgres access.

Live

Ascent

Agent onboarding and certification. Teams define the checkpoints; agents complete them; your app decides what certification unlocks.

Live

Camp

A full CRM interface for your team: leads, agents, sales activity, commissions, disputes. It mounts into your own Next.js app in one catch-all route.

Live

Trail

Lightweight sales activity for a real CRM: calls, emails, visits, confidence, stages, corrections, and retractions without deleting history. Log CHAMP qualification when you want it: challenges, authority, money, prioritization.

Live

Waypoint

Territory-aware recommendations for who should own a lead: round-robin, least-loaded, or manual. Terrain records what is true; Waypoint recommends where to go next.

Live

Belay

A safe place to handle commission disputes. It holds a payout while a case is open and records the operator's decision.

// READ THE CODE

One runtime dependency,
small enough to read in an afternoon.

It's MIT licensed, so you can self-host it, fork it, swap out the UI, or strip out whatever you don't need.

View on GitHub Read the docs