Extend

Extend SaaScaffold without forking the base

Your code, copy and tables live apart from the base, so you can build your own product on it and still merge every base update.

Your files and the base files

Change the files marked yours. Leave the base files alone, and updates merge cleanly.

PathWhat it holdsOwner
apps/web/src/site/config.tsYour settings, plus your own navigation, footer and SEO entriesYours
apps/web/src/site/messages.tsYour copy, and overrides of any base wordingYours
packages/db/src/schema/site/Your own tablesYours
packages/db/migrations/site/The migrations for your tablesYours
site/Your site profile, checklist, deployment state and run recordsYours
apps/web/src/i18n/messages.tsBase wording. To change it, repeat the key in src/site/messages.tsBase
apps/web/src/config/site-config.base.tsBase navigation, SEO paths and config checksBase
packages/db/src/schema/pg/, sqlite/Base tables, one file per moduleBase
packages/db/migrations/pg/, d1/Base migrations and their historyBase

Two migration channels

The base and your site keep separate migration histories, so your tables never collide with base updates.

DatabaseBase historyYour history
PostgreSQLdrizzle.__drizzle_migrationsdrizzle.__drizzle_site_migrations
Cloudflare D1d1_migrationsd1_site_migrations

pnpm db:migrate and pnpm release run the base migrations first, then yours.

Merging a base update

Updates arrive as Git commits on an upstream branch.

  1. Merge the update

    Merge the upstream branch and keep your changes. Your own files rarely conflict.

  2. Apply migrations

    pnpm db:migrate applies the new base migrations to your local database.

  3. Run the tests

    Run the unit tests, then the full check before you deploy.

  4. Release

    pnpm release migrates and deploys once you authorise it.

Adding a provider

A new payment or AI provider is new code at the edge. The business rules in the middle stay as they are.

A payment provider

You write

  • An adapter for checkout, notifications and refunds
  • Where its keys and settings are read from
  • Its labels in the admin and order screens
  • The subscription operations it really supports

You reuse unchanged

  • Order snapshots and server-side checks
  • Duplicate-safe event handling
  • The atomic payment-and-credits step
  • The ledger, the refund flow and admin orders

An AI provider

You write

  • Request and result mapping for its API
  • An honest declaration of what it can do
  • Catalog rows for the models it serves
  • The keys it needs in your Worker

You reuse unchanged

  • Quotes and credit reservations
  • The queue, leases and five-minute sweep
  • Output checks and optional moderation
  • Private delivery and settlement

Rules that keep it extendable

A few conventions do most of the work.

  • Routes stay thin. Server actions check access and input; each module keeps its data in repository.ts and its rules in service.server.ts.
  • Writes that must happen together, such as a payment and its credits, go in one atomic call.
  • Need a field on a base table? Add your own table keyed on the base table’s ID, such as site_user_profiles.user_id.
  • A published subscription product never changes. A new price is a new product ID, so existing subscribers keep their terms.

Get the SaaScaffold source code

Buy once, then claim access to the private repository with your GitHub username.

BuySee how agents work with it