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.
| Path | What it holds | Owner |
|---|---|---|
apps/web/src/site/config.ts | Your settings, plus your own navigation, footer and SEO entries | Yours |
apps/web/src/site/messages.ts | Your copy, and overrides of any base wording | Yours |
packages/db/src/schema/site/ | Your own tables | Yours |
packages/db/migrations/site/ | The migrations for your tables | Yours |
site/ | Your site profile, checklist, deployment state and run records | Yours |
apps/web/src/i18n/messages.ts | Base wording. To change it, repeat the key in src/site/messages.ts | Base |
apps/web/src/config/site-config.base.ts | Base navigation, SEO paths and config checks | Base |
packages/db/src/schema/pg/, sqlite/ | Base tables, one file per module | Base |
packages/db/migrations/pg/, d1/ | Base migrations and their history | Base |
Two migration channels
The base and your site keep separate migration histories, so your tables never collide with base updates.
| Database | Base history | Your history |
|---|---|---|
| PostgreSQL | drizzle.__drizzle_migrations | drizzle.__drizzle_site_migrations |
| Cloudflare D1 | d1_migrations | d1_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.
Merge the update
Merge the upstream branch and keep your changes. Your own files rarely conflict.
Apply migrations
pnpm db:migrate applies the new base migrations to your local database.
Run the tests
Run the unit tests, then the full check before you deploy.
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