An embeddable, event-sourced commission engine for Next.js. The event log is the source of truth. Escrow release runs on pg_cron. No servers, no workers, no vendor lock-in.
Every piece is a pure function you can test in isolation. The engine never touches money — it emits payout tasks.
One table. Typed events. No updates, no deletes. Every projection is a fold over this log.
Leads, payouts, and timelines derive from the event log. Drop a table, replay, done.
No floats. Commission math uses exact integer arithmetic. Rounding rules are explicit.
First-touch, last-touch, or custom. Sensible defaults, fully overridable via config.
Commissions sit in a held state. The database itself releases them on schedule. No worker process.
RLS policies check a session variable, not a provider-specific UID. Supabase adapter ships first.
Everything runs inside your existing Next.js app and Postgres database.
// Minimal install: engine + Postgres. Nothing else. import { init } from 'tandem-core'; const crm = init({ db: { connectionString: process.env.DATABASE_URL }, escrow: { holdDays: 30 }, attribution: { strategy: 'first-touch' }, }); // Adapters map external payloads to typed events. await crm.append({ type: 'commission.earned', payload: { /* ... */ }, partnerId: 'partner_123', }); // Escrow release runs on pg_cron inside Postgres. // No worker process. No external queue.
This is the honest current state. No features are promised before they exist.
The engine. Event log, projections, integer money math, idempotency, escrow release via pg_cron, Supabase auth adapter. Running in production.
The CRM surface. Contacts, kanban, timeline, and an optional shadcn/ui admin. Built on tandem-core.
Sales onboarding orchestration. Reads tandem-core events, ships its own event types.
Clawbacks, disputes, and payout blocking. The brakes on the commission engine.
For Neon and plain-Postgres users. Bring-your-own-auth, no Supabase required.
Managed hosting. Provisioning, monitoring, upgrades. Not started. Not before the open-source packages have real users.
MIT licensed. Self-host it, fork it, replace the UI, delete what you don't need.