Turn a PostgreSQL schema into TypeScript types

Generate TypeScript interfaces from a database schema, with nullable fields, JSON, arrays and vocabularies mapped by Trellis’s real exporter.

target
TypeScript types
access
Pro export
source specimen
3 of 13 tables · seed/schema.json

Trellis exports a schema drafted on its canvas using PostgreSQL types. This page does not claim to parse a PostgreSQL dump or a live database.

01 / contracts

Database fields become application contracts

Three complete interfaces show the mappings that matter at the boundary: arrays, JSON, nullable values, numeric precision and fixed vocabularies.

type map
uuid / textstring
numericstring
jsonbunknown
nullable| null
vocabularyliteral union
actual exporter output3 of 13 tables · article, subscription, daily_metric
export interface article {
  id: string
  author_id: string
  title: string
  slug: string
  body: string
  labels: ("guide" | "reference" | "tutorial" | "release-note")[]
  search_vector: string | null
  published_at: string | null
  created_at: string
  updated_at: string
  // references author_id -> account — The account credited as the author.
}

export interface subscription {
  id: string
  account_id: string
  plan: "free" | "pro" | "team" | "enterprise"
  state: "active" | "paused" | "cancelled"
  period: string
  seats: number
  created_at: string
  // references account_id -> account — Who is subscribed.
}

export interface daily_metric {
  metric_key: string
  day: string
  value: string
  computed_at: string
  // composite primary key: metric_key, day
}
02 / artifact boundary

A compile-time artifact, not a runtime client

The exporter produces plain TypeScript interfaces. It adds no query methods, validation runtime, generated client or framework wrapper.