Tessera docs

Launch Tessera

Launch

Core concepts

Schema

Define tables, columns and relations in TypeScript. The schema drives the database, the API and the client.

Tables and columns

A table is a named collection of typed columns. Column builders map directly to Postgres types, and modifiers like .notNull() and .unique() become constraints.

schema.ts
import { table, uuid, text, integer, timestamp } from "tessera" export const projects = table("projects", {  id: uuid().primaryKey(),  name: text().notNull(),  slug: text().notNull().unique(),  seats: integer().default(5),  createdAt: timestamp().defaultNow(),})

Column types

Builder

Postgres type

TypeScript type

uuid()

uuid

string

text()

text

string

integer()

integer

number

boolean()

boolean

boolean

timestamp()

timestamptz

Date

json<T>()

jsonb

T

Relations

Use references() to link tables. Tessera creates the foreign key and adds typed helpers to the client for joins.

schema.ts
export const tasks = table("tasks", {  id: uuid().primaryKey(),  projectId: uuid().references(() => projects.id, { onDelete: "cascade" }),  title: text().notNull(),})

Rename safely

Renaming a column in the schema is detected as a rename, not a drop and add, so existing data is kept.

Was this helpful?

© 2026 Tessera, Inc.

Support

Status

Create a free website with Framer, the website builder loved by startups, designers and agencies.