Partner commissions on serverless Node and Postgres, with no server to run
说明与用途
Tandem CRM 通过仅使用 Postgres 和 Vercel 函数,在无服务器环境中实现合作伙伴佣金管理,无需专用服务器。
问题
Managing long‑term partner commissions with hold periods, rate changes, refunds, and deactivations is error‑prone on a serverless stack.
结果
Tandem CRM enables accurate, auditable partner commission management on a serverless stack without a dedicated server, reducing errors and simplifying maintenance.
工作流
- Install tandem-crm and run init to apply migrations and seed demo data
- Create a lead via createLead, passing workspace, partner, and config
- Record a payment via recordPayment, which creates a commission line with its own rate and hold period
- Scheduled cron job calls release_due_commissions() to release held commissions
- Handle refunds by reducing or clawing back matching commission lines
- Deactivate partners to move unpaid lines to a house account
证据
Tandem is an npm package plus a set of SQL migrations. You point it at a Postgres database you already have, and it adds a tandem schema with leads, agents, partners, commissions and payouts.
Each call is just a function that opens a database connection, does its work inside one transaction, and returns. Nothing holds state in memory between requests, so it does not care how many function instances you have or how often they start and stop.
The audits found real problems. A scheduled release job that could crash part way through. A case where a payment could silently produce no commission at all. Writes that were not safe if two requests arrived at the same moment.
- 记录日期: 2026-10-21T05:56:02.486Z