Schemint

paste PostgreSQL or JSON, get your schema reviewed like a senior would

PostgreSQL CREATE TABLE to TypeScript interface

Paste a CREATE TABLE, get a typed interface. Nothing you paste is stored.

Paste a PostgreSQL CREATE TABLE and get a matching TypeScript interface. Nullable columns map to optional properties, the primary key stays required, and you choose whether BIGINT and NUMERIC come out as number or string (JavaScript loses precision past 2^53, so string is the safe call for money and large ids).

It reads your real DDL, so the names, optionality and types match the table you actually have, not a guess. Runs on the server and is discarded after the response.

Try it on your own schema

Example

PostgreSQL in:

CREATE TABLE product (
    id BIGSERIAL PRIMARY KEY,
    sku VARCHAR(40) UNIQUE NOT NULL,
    name VARCHAR(200) NOT NULL,
    price NUMERIC(12, 2) NOT NULL,
    in_stock BOOLEAN NOT NULL DEFAULT true,
    created_at TIMESTAMP NOT NULL DEFAULT now()
);

Generated:

Product.ts

export interface Product {
  id: number;
  sku: string;
  name: string;
  price: number;
  inStock: boolean;
  createdAt: string;
}

Related