gen types
scribase gen types --db-url <postgres-url> [--schema public,app] [--out FILE]
scribase gen types <org> <project> <env> [--schema public,app] [--out FILE]
scribase gen types --env <org>/<project>/<env> [--schema public,app] [--out FILE]Writes a TypeScript Database type in the shape supabase-js expects, so
createClient<Database>(url, key) gives typed tables, views, functions and
enums. gen typescript is an alias.
| Flag | Default | Meaning |
|---|---|---|
--schema |
public |
Comma-separated schemas to include |
--out |
standard output | Write the file here instead |
From an environment
scribase gen types acme my-app production --out src/database.types.tsThe control plane introspects the environment's database and returns the file. A CI job needs only an access token, not database credentials.
From a database URL
scribase gen types --db-url "$(scribase dev url)" --out src/database.types.tsWith --db-url the CLI reads the schema directly through psql (so psql
must be on the PATH). This works against a local scribase dev database, a
branch, or any Postgres.
Both paths run the same query and renderer, so they produce the same file for the same schema.
In CI
export SCRIBASE_API_URL=https://api.example.com
export SCRIBASE_ACCESS_TOKEN=${{ secrets.SCRIBASE_TOKEN }}
scribase gen types acme my-app production --out src/database.types.ts
git diff --exit-code src/database.types.ts # fail if the committed types are stale