https://github.com/kristiandupont/kanel
Generate Typescript types from Postgres
https://github.com/kristiandupont/kanel
Last synced: 20 days ago
JSON representation
Generate Typescript types from Postgres
- Host: GitHub
- URL: https://github.com/kristiandupont/kanel
- Owner: kristiandupont
- License: mit
- Created: 2020-02-18T19:08:09.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-10T09:02:03.000Z (23 days ago)
- Last Synced: 2025-05-10T09:03:35.599Z (23 days ago)
- Language: TypeScript
- Homepage: https://kristiandupont.github.io/kanel/
- Size: 7.06 MB
- Stars: 994
- Watchers: 5
- Forks: 69
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-typesafe - kristiandupont/kanel - Generate Typescript types from Postgres. (**1. Libraries** / Database)
README

Generate Typescript types from a live Postgres database.
This is for people who don't like ORM's but who do like intellisense and type checking for their database access code.
See the documentation [here](https://kristiandupont.github.io/kanel)
Introduction to the idea is outlined [here](https://medium.com/@kristiandupont/generating-typescript-types-from-postgres-48661868ef84).
## Usage
Install with:
```bash
$ npm i -D kanel
```To run, make sure you are in a folder that has a `.kanelrc.js` configuration file and that your database is running, and type:
```bash
$ npx kanel
```## Programmatical usage
Example of running generation from code:
```typescript
import { processDatabase } from "kanel";
import config from "./kanelrc";async function run() {
await processDatabase(config);
}run();
```## Example
To see an example of the result, check out the [/example](example) folder. It uses the [Sample Database](https://www.postgresqltutorial.com/postgresql-sample-database/) from www.postgresqltutorial.com.
---
---
## Contributors
Made with [contrib.rocks](https://contrib.rocks).