Deep dives on software engineering, architecture, and the real-world decisions
This blog runs on software I wrote. Here's everything I learned doing it.
Latest posts
// Make sure it won't end up in production!!!
const TODO = "remove before production";TypeScript
How I Integrated Polar.sh Payments Into My SaaS With Better Auth - What the Docs Don't Tell You
May 8, 2026When I added subscription billing to timeli.sh, I chose Polar.sh as the payment layer and better-auth as the auth framework. On paper, both are excellent. In practice, there was one fundamental mismatch between how Polar + better-auth expect things to work and how timeli.sh is actually structured - and I spent more time fighting it than building the feature.
This post is the write-up I wish had existed before I started.
The problem: every guide assumes subscriptions belong to a user
Timeli.sh is a multi-tenant SaaS. A user creates an organization, and that organization is what subscribes. Multiple users can belong to an organization, so it would be wrong for the subscription to live on any individual user. The organization either has an active subscription or it doesn't - regardless of who's logged in.