gieter (Dutch for watering can) introspects a live database and emits typed source code from it. It reads your schema, tables, columns, enums, keys, etc. and turns it into a neutral intermediate representation, then hands that to pluggable emitters to generate code in the language of your choice.
Today it ships a PostgreSQL source and a TypeScript emitter.
Features
- Live introspection of PostgreSQL schemas (tables, columns, enums, primary & foreign keys, comments).
- Typed TypeScript output with configurable
type/interface, enum, casing, and null styles. - Branded ID types; nominal types for primary/foreign keys so a
UserIdcan't be passed where aPostIdbelongs. - Scalar type overrides with automatic import hoisting.
- Flexible file layout; split kinds across files or emit everything into one.
- Extensible by design; sources and emitters are just crates implementing a
gieter_coretrait.
Missing features
Things that are currently not supported by gieter but are planned are:
- composite types and domain types for PostgreSQL.
- Python emitter.
- Zod emitter.
- Rust emitter.
- Plugin system so you can create external schema sources and emitters, then load them via config options.
Install
Or build from source:
Quick start
Create a gieter.toml:
[]
= "postgres://user:password@localhost:5432/db"
= ["public"]
[[]]
= "typescript"
= "src/db"
= "schema.ts"
Then run:
The database URL may be read from the environment with url = "env:DATABASE_URL".
See examples/ for a fully-annotated config.
Extending gieter
Everything hangs off gieter_core, which defines the schema IR plus the Source and Emitter traits. To target a new language or database, depend on it directly:
[]
= "0.1"
Implement Emitter (or Source), and register it with the pipeline.
License
Licensed under either of MIT or Apache-2.0 at your option.