Types in. Stack out.
The CLI reads your TypeScript types. The schema engine, a Rust binary, compares them to the live database and works out the change. Here is the loop you work in.
See it in 70 seconds.
One set of types becomes the migration, the access policies, the API, the typed client and Studio.
schema/index.ts Declare the shape of your data
Plain TypeScript types. No builder functions, no decorators, no new language. Your editor already understands them, so autocomplete and go to definition work on your data model from the first line.
export type Club = Model<{ id: UUID name: string slug: Unique<Slug<"name">> description: Optional<RichText> organizer: SupatypeAuthUserId }, { access: { read: Public create: LoggedIn update: Owner<"organizer"> } }>
$ supatype diff 3 change(s): [+] create_table club (safe) [+] add_column club.description (safe) [!] drop_column club.legacy_ref (DANGER) 1 dangerous change(s). Review before pushing.
supatype diff See exactly what will change
The engine compares your types to the live database and marks each change safe, caution or danger. A rename is applied as a rename only when you have declared it. A push asks you once, or you run supatype rename. Nothing is renamed or dropped on a guess.
supatype push Apply it, with a way back
Each push is recorded in migration history with the reverse SQL, so supatype rollback can undo it. Row level security policies, indexes, check constraints and foreign keys all move in the same step.
$ supatype push [supatype] Diffing against database... 1 change(s): [+] create_table club (safe) [supatype] Applying migration... [supatype] Migration applied.
import { useQuery } from "@supatype/react" const { data, loading } = useQuery("club", { select: "name, slug", order: { column: "name" }, limit: 10, }) // data: rows of club, typed from the schema // data[0].title is a type error: club has no title
supatype generate The client knows your types
Row types are generated from the same declarations, and the client and hooks read them. A renamed field is a type error in every component that still uses the old name.
What ships in the box.
Database
Postgres with PostGIS and pgvector. Enums, composite types, relations and many-to-many joins are all written as types. Migration history and rollback sit underneath.
Auth and row level security
Email, magic links, OAuth and MFA. Access rules are declared per model and compiled into Postgres policies, so the database enforces them, not your API layer.
Studio
An editing UI and a database console in one app. Editors get rich text, blocks, media, relations, drafts and locales. You get the data browser, SQL runner and migration history.
Storage, realtime and functions
Buckets declared as types with their own access rules, WebSocket subscriptions that respect read access, and TypeScript functions on Deno deployed from the same CLI.
The boilerplate everyone rewrites, declared instead.
Once one set of types runs the whole stack, a lot of application plumbing can become an option on a model. These are designed but not built yet. We build them in the open and mark them here as they land.
Multi-tenancy
Mark a model tenanted and get the column, index, policy and subdomain routing.
Audit logging
Who changed what and when, with the before and after, kept for a set time.
Field-level encryption
Encrypt a column at rest by declaring it.
Declared webhooks
Fire on insert, update or delete, with retries and a delivery log.
Scheduled jobs
Jobs declared beside the data they work on, on the same runtime as your functions.
Preview environments
A branch database per pull request, with a schema diff on the PR.
One binary for the whole loop.
| Command | What it does |
|---|---|
| supatype init | Scaffold a new project |
| supatype dev | Start the local stack and apply the schema |
| supatype diff | Show planned changes without applying them |
| supatype push | Diff, confirm, apply the migration and generate types |
| supatype generate | Regenerate TypeScript types |
| supatype rename | Record a rename so the data is kept |
| supatype rollback | Undo the last applied migration |
| supatype migrate | Write the SQL a push would apply |
| supatype pull | Draft a schema from an existing database |
| supatype doctor | Report drift between the schema and the database |
| supatype seed | Run seed files |
| supatype keys | Generate API keys from the JWT secret |
| supatype functions | Scaffold, serve and deploy functions |
| supatype logs | Tail logs from the local stack |
| supatype self-host | Run the stack with Docker Compose |
| supatype deploy | Deploy schema and app to a linked project |
Every command and flag is in the CLI reference.
Change a field once.
Cloud starts with 2 projects, 500 MB database and 1 GB storage, free and with no card. Paid plans start at £25 a month.