README.md
January 25, 2025 ยท View on GitHub
@pgtyped/example
This is an example app using pgtyped.
Example queries are stored in src/books/queries.sql, src/users/queries.ts and src/comments/queries.sql.
Try starting PgTyped and editing them to see live query type generation.
Usage with your own DB:
npm install- Save your config into
config.json npx pgtyped -w -c config.json
Using the dockerized example setup:
- Clone the whole pgtyped monorepo into some directory.
git clone git@github.com:adelsz/pgtyped.git pgtyped cd pgtyped/packages/examplenpm installnpm run builddocker compose run watch- Try editing queries in the SQL and TS files and see how PgTyped handles it.
The dockerized setup isn't required and is included for convenience.
It creates a PostgreSQL DB, loading it with the schema and seed records defined in sql/schema.sql.
After that it starts PgTyped in a separate container, connecting it to the DB.