Presets
Start an app from a named preset or a design from /create, with every block it needs and the conventions it sets.
A preset is a block selection plus the conventions to install it with:
framework, platforms, casing, id type, scope, tenant name, access model, API
schema and integrations. Put a named preset or a code from
Create in your config, and
defineConfig expands it into blocks, with the blocks they require:
import { defineConfig } from "better-supabase/config";
export default defineConfig({
preset: "saas",
database: { sql: { api: "api" } },
blocks: { messaging: { options: { maxBodyLength: 5000 } }, tags: {} },
});The keys you set win. A block you name joins the preset, and its entry is
merged over the preset's settings for that block. gen.casing, database.sql.api and
adapters from the preset apply only when the config leaves them unset.
npx better-supabase upgrade then writes the files of every block the
preset expands to, and supabase db schema declarative sync turns them into
a migration (SQL modules).
Instances in a preset
A preset can also write blocks entries, under instances: the nouns of a
block it selects, and blocks it installs a second time under another key.
helpdesk and itsm name the tasks block's work items ticket and its
projects issue, cms and pim make the attachments bucket public for
media, and property adds a maintenance instance of tasks for
maintenance requests:
export default defineConfig({
preset: {
blocks: ["assets", "leases", "contacts"],
instances: {
maintenance: {
block: "tasks",
names: { task: "maintenance_request" },
tables: { projects: null, iterations: null },
},
},
},
});An instance takes the keys of a blocks entry that describe what it is:
block, names, options, tables, on and uses
(Instances). An instance named after a
block selects that block; one with another block installs only what that
block requires next to it. Your own blocks entry for the same key is
merged over the preset's.
subjects gives the subjects an instance registers a record team and a read
log: care sets subjects: { person: { team: { actions: ["read", "write"] }, auditReads: true } }
on contacts, and it expands to those keys on the person entity
(Record teams). Renaming the entity in your
own config keeps them.
A new project starts from a preset with
npx better-supabase init --preset saas, which writes the config, the module
files and lib/blocks.ts in one step. better-supabase add --preset crm
applies one to a project you have, and better-supabase config --preset shows
how your config differs from its preset (CLI).
Composites in presets
A preset can list a composite in place of its parts: saas stands for the eleven workspace blocks, and the people and field-service presets list recruiting and service. resolvePreset expands each composite to its parts, so the closure is what the parts alone would give, plus the blocks a composite adds. A test pins that closure for every named preset.
Named presets
| Preset | Group | Blocks |
|---|---|---|
minimal | Starters | profiles |
saas | Starters | organizations, invitations, teams, profiles, billing, entitlements, notifications, audit, api-keys, settings, onboarding, outbox |
consumer | Starters | profiles, identities, mfa, sessions, notifications, push, with scope: "user" |
crm | Products | saas plus parties, pipelines, deals, quotes, targets, activities, mail-sync, sequences, segments, assignment, enrichment, forecasts, lead-scoring, jobs, tags, comments, custom-fields, saved-views, search |
projects | Products | saas plus tags, comments, attachments, state-machine, rank, reminders, time-entries |
helpdesk | Products | saas plus inbox, tasks as tickets, sla, comments, attachments, tags, saved-views, knowledge, search, automations, jobs |
chat | Products | saas plus messaging, channels, reactions, attachments |
commerce | Products | saas plus catalog, inventory, orders, promotions |
cms | Products | saas plus content, versions, approvals, public attachments, tags, comments, search, jobs |
erp | Products | saas plus parties, catalog, inventory, assets, quotes, orders, invoices with purchase bills, numbering, accounting, banking, approvals, employees, time-entries, leave, expenses, saved-views, automations with quote to order on |
manufacturing | Products | erp plus manufacturing, inspections, cases, qualifications, with receipt inspections and requisitions from material requirements |
pim | Products | saas plus catalog, public attachments, custom-fields, imports, bulk, tags, saved-views, search |
marketplace | Products | saas plus parties, catalog, orders, invoices, reactions, share-links |
scheduling | Products | saas plus calendar, bookings, reminders |
people | Products | saas plus employees, hiring, time-entries, approvals, calendar, documents, automations |
psa | Products | saas plus contacts, tasks, time-entries, billable-time, shifts, expenses, approvals, quotes, contracts, invoices, numbering, comments, attachments, tags, saved-views, search, automations |
ats | Products | saas plus hiring, employees, forms, calendar, bookings, templates, signatures, approvals, reminders, comments, attachments, tags, saved-views, search, automations |
intranet | Products | saas plus announcements, knowledge, drive, channels, reactions, comments, employees, calendar, acknowledgements, attachments, tags, saved-views, search |
drive | Products | saas plus drive, attachments, share-links, versions, trash, search |
docs | Products | saas plus documents, versions, comments, reactions, templates, search, share-links |
invoicing | Products | saas plus parties, quotes, invoices, numbering |
forms | Products | saas plus forms, templates, imports |
property | Verticals | saas plus assets, leases, ledger, parties, guests, comments, attachments, reminders, a maintenance tasks instance |
field-service | Verticals | saas plus parties, dispatch, assets, inventory, quotes, invoices, forms, signatures, attachments |
clinic | Verticals | saas plus calendar, bookings, forms, templates, signatures, custom-fields, field-encryption, guests, reminders |
care | Verticals | saas plus contacts with client record teams and read logs, guests, field-encryption, data-lifecycle, consents, activities, care-plans, observations, medications, forms, bookings, calendar, reminders, time-entries, funding, shifts, qualifications, courses, cases, acknowledgements, drive with controlled documents, signatures |
lms | Verticals | saas plus courses, enrollments, forms, comments, attachments |
events | Verticals | saas plus catalog, orders, bookings, passes, signing-keys, waitlist, reminders |
legal | Verticals | saas plus parties, time-entries, billable-time, invoices, ledger, documents, versions, signatures |
filings | Verticals | saas plus contacts, relations, imports, document-templates, numbering, versions, signatures, approvals, attachments, shipments, ledger, cases, reminders, governance |
spend | Verticals | saas plus expenses, approvals, attachments, ai-files |
contracts | Verticals | saas plus contracts, parties, signatures, versions, reminders |
customer-success | Verticals | saas plus parties, activities, scores, metrics, rules, forms, enrollments, reminders |
logistics | Verticals | saas plus parties, orders, shipments, assets |
pos | Verticals | saas plus catalog, orders, inventory, bookings, promotions, ledger |
fitness | Verticals | saas plus calendar, bookings, passes, signing-keys, reminders |
nonprofit | Verticals | saas plus parties, donations, ledger, numbering, targets, saved-views |
itsm | Verticals | saas plus tasks as tickets, sla, approvals, assets, relations, incidents, knowledge, jobs |
compliance | Verticals | saas plus compliance, attachments |
qms | Verticals | saas plus drive with controlled documents, attachments, versions, signatures, approvals, state-machine, numbering, pipelines, tasks, forms, relations, compliance, acknowledgements, cases, inspections, risks, qualifications, courses, enrollments, employees, contacts, assets, metrics, posts |
ehs | Verticals | qms without document control and posts |
isms | Verticals | saas plus compliance, risks, inspections, cases, acknowledgements, drive |
construction | Verticals | saas plus tasks, assets, forms, attachments, versions, comments, approvals |
claims | Verticals | saas plus parties, state-machine, approvals, attachments, sla, comments, jobs |
community | Verticals | saas plus posts, messaging, channels, comments, reactions, moderation, scores, tags, search |
feedback | Verticals | saas plus posts, comments, reactions, moderation, tasks, relations, tags, search |
ai | AI | saas plus ai-chat, ai-files, knowledge, memory, agents, ai-schedules, jobs |
ai-chat | AI | saas plus ai-chat, ai-files, knowledge, memory, ai-keys, usage, jobs |
ai-agents | AI | saas plus agents, ai-schedules, approvals, connectors, credentials, workflows, metrics, jobs |
developer-api | Platforms | saas plus webhooks, usage, service-accounts, signing-keys |
automation | Platforms | saas plus workflow-editor, workflows, jobs, webhooks, connectors, credentials, automations |
enterprise | Platforms | saas plus sso, mfa, sessions, access-requests, impersonation, data-lifecycle, grants |
admin | Platforms | saas plus flags, metrics, approvals, saved-views, bulk |
everything | Everything | every block, for demos and tests |
Each one also installs what its blocks require (tenant, access,
updated-at, ...). The named presets use the default conventions, except
consumer, which scopes rows to the user (scope: "user") and so leaves out
the blocks that need tenants, such as billing and settings. The /create
preset picker and init list them in these groups.
tests/validation-presets renders each one, applies it to the local stack
as one migration, and typechecks the lib/blocks.ts it generates.
Vertical presets
The presets in the Verticals group each start one kind of business app.
Each page lists the blocks the preset adds to saas and how they connect.
| Vertical | Preset | In the style of |
|---|---|---|
| Property management | property | AppFolio, Buildium |
| Field service | field-service | ServiceTitan, Jobber |
| Clinic and therapy | clinic | Jane, SimplePractice |
| Care | care | Nedap Ons, ECD systems |
| Courses and learning | lms | Teachable, Canvas |
| Events and ticketing | events | Eventbrite, Luma |
| Legal practice | legal | Clio |
| Expenses and spend | spend | Ramp, Expensify |
| Contracts | contracts | Ironclad |
| Customer success | customer-success | Gainsight, Vitally |
| Logistics and fleet | logistics | Shippo, Samsara |
| Restaurants and POS | pos | Toast, Square |
| Fitness and memberships | fitness | Mindbody |
| Nonprofit fundraising | nonprofit | Bloomerang |
| IT service management | itsm | ServiceNow, Jira Service Management |
| Compliance | compliance | Vanta, Drata |
| Quality management | qms | MasterControl, Qualio |
| Environment, health and safety | ehs | Intelex, SafetyCulture |
| Information security | isms | ISMS.online, Hyperproof |
| Construction | construction | Procore |
| Insurance and claims | claims | Guidewire |
| Community | community | Discourse, Circle |
| Product feedback | feedback | Canny, Productboard |
Apps built on a preset
These pages start from a preset and add the subject (a table of their own or
a block's), the options and the event flow of one product. tests/validation-recipes installs each
config on the local stack and drives the flows end to end.
| App | Preset | Subject | Adds |
|---|---|---|---|
| CRM | crm | deal | reminders |
| Projects | projects | task | numbering, the state machine's workflow |
| Drive | saas | document | comments, tags, attachments, share-links, rank |
| Scheduling | scheduling | booking | custom-fields, share-links, state-machine |
| Commerce | commerce | order | imports, numbering, search, saved-views, metrics, approvals |
The CMS, ERP,
manufacturing,
product information, care,
professional services, applicant tracking
and intranet pages describe the cms, erp,
manufacturing, pim, care, psa, ats and intranet presets and how
their blocks connect. HR and people operations are the people preset, and a
help desk is helpdesk; there is no separate HRIS or ticketing preset.
tests/validation-presets installs each one and checks those links on the
local stack.
Designs and Create
Create builds a design in the browser
and keeps it in the URL: /create?preset=<name> for an unchanged named
preset, /create?design=<code> otherwise, with the preset inside the design.
init --preset and add --preset take the whole URL, and the config's
preset key takes the name or the preset object the design holds. See
Designs and the resolver for the format and the
better-supabase/preset API.
Create runs in the better-supabase cloud app and needs no account for the
canvas, Get code and Deploy to Supabase. Signing in adds the AI chat, saved
projects with version history, designs too large for a link, deploy
history and the cloud MCP server at https://app.bettersupabase.com/api/mcp.
That server edits your saved designs; the docs MCP server at
https://bettersupabase.com/mcp answers questions about these docs. Old
bettersupabase.com/create links redirect to the app with their query
string, so links you already shared keep opening.
To skip the blank canvas, pick "Start from a template" under Preset. Each template sets a named preset, adds the blocks its tables use and draws the app tables with their relations and features. The templates are projects and tasks, a content calendar, an asset register, event planning, a feedback board and a course catalog. Starting from one replaces the canvas, and Undo brings the previous design back.
The Data tab on the table inspector shows eight sample rows for an app table. The values follow each column's format, options and bounds, a reference shows a row title from the table it points to, and a nullable column is empty in some rows. The rows are generated in the browser and never reach a database.
The Computed section at the end of the Columns tab adds rollups and lookups. A rollup counts, sums or takes the min, max or average of the rows that link to the table, optionally only the rows with one select value. A lookup shows a column of the row the table links to. You pick each part from the links the design already has, so there is no SQL to type, and the table's node lists them under its columns. Deleting or retyping a column a rollup reads removes the rollup.
The Changes tab in Get code lists what you changed in the app tables since
the page loaded the design in its link. Each change is marked safe or
breaking, and a breaking one (a dropped, renamed or retyped column, or a
column made required without a default) lists the expand-and-contract steps
that add --preset prints before it refuses
to write the design.
The shared wiring
Three pieces connect the blocks in every recipe.
The subject is declared once in config.recordTypes. Comments, tags, custom
fields, share links and reminders all read it from the
subject registry, and rank reads its rank entry.
A state machine is named after its subject (deal, task, booking). The
machine name is the subjectType of its history rows and of
status.changed, so a status change reaches the same watchers as a comment.
A cron route hands the outbox to the watchers. watcherHandler reads the
actor from each outbox row, so whoever acts is not notified of their own
change. Comments need no entry: the comments module sends comment.posted
to a record's followers itself.
import { watcherHandler } from "better-supabase/blocks/notifications";
const watchers = watcherHandler(notifications, {
types: {
"subject.tagged": "subject.tagged",
"status.changed": "subject.moved",
"share_link.created": "subject.shared",
"field_value.set": "subject.field_changed",
},
});
export const GET = outbox.relayRoute({
secret: process.env.CRON_SECRET,
consumers: { watchers },
});Users follow a row with notifications.subscribe({ subject, level }).
Watchers at level all get every mapped event. See
watchers for rules with activity,
recipients and summary.
Reminders deliver through the notifications block, the notifier port,
when the reminders block has a notification type. The reminder's owner and the subject's watchers get
one notification per occurrence:
const { comments, reminders, stateMachine } = createBlocks(
{ transport, service },
{
notifications: notificationsBlock.using((options) =>
createNotifications({ ...options, types }),
),
comments: commentsBlock,
reminders: remindersBlock.with({ notification: "reminder.due" }),
stateMachine: stateMachineBlock,
},
);reminders.job runs as the handler of the reminders.deliver queue
(delivery).
Last updated on