I just published Kanel v4. Kanel was born as a tool for generating Typescript types from a live PostgreSQL database. V4 changes the architecture around so you can have multiple distinct generators.
It comes with a new built-in generator for Markdown. This can be used to document your data model for your fellow team members, but the primary use case that I picture is LLM consumption. I’ve used an MCP server for my developer database which does work, but it feels slightly clumsy to me, and including a markdown with with an @-tag when pointing something out feels very natural.
Thanks for reading stdout! Subscribe for free to receive new posts and support my work.
I’ve created an example for the dvd-rental database. You can see the result here.
](https://images.unsplash.com/photo-1468779036391-52341f60b55d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMDAzMzh8MHwxfHNlYXJjaHw0fHxkb2N1bWVudHxlbnwwfHx8fDE3NzUxMTc1OTl8MA&ixlib=rb-4.1.0&q=80&w=1080)
Photo by Beatriz Pérez Moya on Unsplash
Even if you are using an ORM that mirrors the database schema in some way, those files often miss some of the finer nuances that are possible with Postgres. With Kanel, you can construct documentation that goes into just about as much detail as you could want. The engine has access to everything that extract-pg-schema exposes, which allows you to document indices, procedures, ranges, domains and most other Postgres-specific features.
Setting it up requires a bit of configuration work, as I don’t think I would be able to write a general-purpose template that would suit all teams. It works with Handlebars templates which will be used to generate the final result.
Thanks for reading stdout! Subscribe for free to receive new posts and support my work.
Top comments (0)