Dueloop
Full-stack Development & Product Engineering
FinTech / SaaS
Remote © 2026

Web (responsive), self-hosted
Ongoing
Oct 2026
About the project
Dueloop - Invoice follow-up that chases payment on a schedule you control and leaves every money decision to a person
Dueloop is invoice follow-up software for small businesses. It sends polite reminders by email or WhatsApp on a schedule the business controls, reads the replies that come back, records promises and disputes, takes payment through the business's own Stripe account, and keeps a ledger of every payment that lands.
I built it solo as a TypeScript monorepo - a Next.js dashboard, public customer pages and a REST API in front of twenty-odd domain packages - around one rule: the software proposes, a person decides. Every reminder can wait for an approval, a model may suggest what a reply means but can never change an invoice, and nothing is marked paid unless Stripe confirms it or an authorised person records it.
It runs self-hosted on Docker with Supabase underneath (Postgres with row-level security, pgmq queues and pg_cron), so a business keeps its own customer data on its own server.
The problem
Chasing late invoices is the job nobody in a small business wants, and handing it to software is usually worse than doing it by hand. An automated chaser that believes 'I already paid' closes a real debt; one that ignores a reply keeps badgering a customer who has done nothing wrong. Dueloop automates the follow-up and the record-keeping, then stops at exactly the points where a human judgement about money is needed.

Features
Technologies used
- Next.js 16
- React 19
- TypeScript
- Tailwind CSS
- Radix UI
- Node.js 24
- Supabase
- PostgreSQL + RLS
- pgmq & pg_cron
- pnpm monorepo
- Stripe
- WhatsApp Cloud API
- SMTP & IMAP
- Anthropic / OpenAI
- Docker
- Supabase Storage & Vault
- Playwright
- Vitest
Project goals
The aim was to automate the awkward part of getting paid without ever letting software make a decision about money. It needed to:
- -chase overdue invoices on a schedule, but never outside quiet hours, holidays or consent;
- -turn free-text replies into promises, disputes and tasks a person can work through;
- -take payment through the business's own Stripe account, so no card details pass through Dueloop;
- -keep a ledger where every receipt balances - money received equals amount applied plus credit.
Development journey
Domain Core First
Wrote the invoice state machine, the rule that decides what should happen next, money in integer minor units and send windows in real time zones as one pure package with no I/O and no clock - then drove it with a simulator before any UI existed.
Multi-tenant Data & Import
Built the Postgres schema with row-level security on every table, a role matrix for owner, accountant and collector, and a CSV import with a preview and an error report that changes nothing when the same file is uploaded twice.
Sending & Replies
Added the outbox: pg_cron enqueues due invoices, and a worker re-checks the invoice, consent, quiet hours and budget right before sending, then sends once. Inbound email and WhatsApp replies became promises, disputes and tasks, with AI suggestions optional.
Payments, Proofs & Operations
Shipped Stripe payment links, bank transfers and customer-uploaded proofs that a person checks, all landing in one balancing ledger - then the unglamorous half: health checks, heartbeats, a watchdog, data retention, erasure and a rehearsed backup restore.
Challenges & solutions
Never sending the same reminder twice
Sending runs through a pg_cron and pgmq outbox. The worker claims a job, drops it if the invoice was rescheduled since, reloads fresh context and re-runs the rules, then sends once. If the result of a send is unclear, the invoice parks itself and waits for a person instead of guessing.
Letting AI help without letting it decide
A model only ever attaches a suggestion to a reply. The rules in the pure core decide what actually happens, and with AI switched off every reply simply goes to a human. No model output can change an invoice or release a message.
Keeping each business's data its own
Every table carries a tenant id under row-level security, cross-table references carry it too, and dashboard mutations go through database functions that re-check role and tenant. A scripted check runs against the real schema, so a new table cannot ship unprotected.
Key learnings
- -A pure domain core with no I/O, no clock and no randomness - the current time is passed in as an argument - makes the hard rules about money testable and keeps them out of the UI.
- -Idempotency has to be designed into the queue, the import and the ledger at the same time; bolting it onto one of them just moves the duplicate somewhere else.
- -Putting the safety rules in the database as constraints, triggers and row-level security means a bug in the app layer cannot quietly corrupt money.
- -Approval-first workflows live or die on the approval screen: if it is slow, people turn the automation off entirely.
