Generate TypeScript, Dart, Swift or Kotlin types from your database schema, once or on every change.
Terminal
stitchdb gen types typescript --linked > src/database.types.ts
stitchdb gen types typescript --local -s public,api > src/database.types.tsThe output is a Database type with the Row, Insert and Update shape of every table and view, relationships, functions and enums. Pass it to the client:
TypeScript
import { createClient } from 'stitchdb-js'
import type { Database } from './database.types'
const stitchdb = createClient<Database>(url, anonKey)
const { data } = await stitchdb.from('todos').select('id, title') // typedUse gen types dart, gen types swift or gen types kotlin (with --package com.example.db) for the mobile SDKs, and -o <file> to write a file. stitchdb types --watch -o src/database.types.ts keeps the file up to date while you change the schema.
The same types are available without the CLI from the management API and the MCP tools, and StitchDB can regenerate them on every schema change and open a pull request: see Typed clients.