Never write database-related files by hand again!
Works out of the box. If you need it, you can customize the most important parts such as relation names.
Any Template Engine
You can use your favorite template engine! pg-generator is template engine agnostic.
CLI & API
pg-generator can be used via "pgen" command or directly in Node.js as a library.
# v5 is at the Alpha Stage
The new major version is at the alpha stage. Any feedback is appreciated.
$ 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 (opens new window), 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