BETASDKs MIT, CLI and services Apache 2.0, schema engine BSL 1.1. Cloud is a closed beta: create an account to request access.
HOW IT WORKS

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.

Closed beta: creating an account requests access. We email you when you are in.

PRODUCT DEMO

See it in 70 seconds.

One set of types becomes the migration, the access policies, the API, the typed client and Studio.

supatype product demo · 1:11
01
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.

schema/index.ts
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
$ 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.
02
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.

03
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 push
[supatype] Diffing against database...

1 change(s):

  [+] create_table club  (safe)

[supatype] Applying migration...
[supatype] Migration applied.
Clubs.tsx
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
04
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.

PLANNED

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.

THE CLI

One binary for the whole loop.

CommandWhat it does
supatype initScaffold a new project
supatype devStart the local stack and apply the schema
supatype diffShow planned changes without applying them
supatype pushDiff, confirm, apply the migration and generate types
supatype generateRegenerate TypeScript types
supatype renameRecord a rename so the data is kept
supatype rollbackUndo the last applied migration
supatype migrateWrite the SQL a push would apply
supatype pullDraft a schema from an existing database
supatype doctorReport drift between the schema and the database
supatype seedRun seed files
supatype keysGenerate API keys from the JWT secret
supatype functionsScaffold, serve and deploy functions
supatype logsTail logs from the local stack
supatype self-hostRun the stack with Docker Compose
supatype deployDeploy 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.

Closed beta: creating an account requests access. We email you when you are in.