Boilerplate
← Back to blog

Introducing the Boilerplate

The Team1 min read

Every SaaS starts from the same checklist: auth, billing, teams, emails, an admin panel, and a place to publish content. Most teams rebuild it from scratch. We didn't want to — so we built a boilerplate where every external dependency lives behind a swappable interface, selected at runtime.

One pattern, everywhere

Billing, mailers, SMS, analytics, monitoring — and now the CMS behind this very post — all follow the same three layers:

  1. Core contract — an abstract class plus zod schemas. The app imports only this.
  2. Gateway — a registry that lazily loads the selected provider.
  3. Provider — a small package implementing the contract against a real service.

Switching from Stripe to Lemon Squeezy, or from local markdown to a headless CMS, is a one-line config change with no call-site edits.

This blog is dogfooding the CMS

The post you're reading is a markdown file with frontmatter, rendered through the @repo/cms gateway. Point CMS_PROVIDER at a different backend and the same blog pages keep working. That's the whole idea: build once, swap freely.

Grab the repo, set your environment variables, and ship.