• Public
  • Public/Protected
  • All


pg-generator logo
PostgreSQL Scaffolding
Never write database-related files by hand again!
pg-generator is an open-source, zero-config CLI & API scaffolding tool for PostgreSQL.
It generates files from your database structure using templates.

v5 is at the Alpha Stage

The new major version is at the alpha stage. Any feedback is appreciated.


Please see documenatation at pg-generator.com


$ npm install -g [email protected] pg-generator-example

Generate Models & Files

Generate your models, files, reports, documentation easily from your PostgreSQL database. Using pg-structure, pg-generator reverse engineers your database and executes templates for each corresponding database object.

$ pgen example --outDir models --clear --database db --user user --password password

Create Your Generators

Create your generators exactly tailored to fit your needs and publish them to npm. All you need is to add your templates and extend PgGenerator class with a render method that renders given template and context data using your favorite template engine.

$ pgen-scaffold nunjucks --outDir my-project

Generated using TypeDoc