June 23, 2026

SQL without the relationship drama

Show HN: Bun-sqlgen – Type-safe raw SQL for Bun, no ORM

Coders cheer the no-nonsense shortcut, then instantly ask if Bun can survive real-world use

TLDR: bun-sqlgen is a new tool that lets Bun developers keep writing simple database queries while catching mistakes before release. Commenters loved the no-framework approach, but the real drama was over whether Bun itself is ready for serious production use and if the tool can handle more unusual setups.

A new tool called bun-sqlgen just strutted onto Show HN with a very specific promise: let people write plain old database requests instead of using giant app frameworks, while still getting warned about mistakes before anything goes live. In normal-person terms, it’s trying to stop the classic “everything looked fine until the app exploded” problem. The creator’s pitch was basically: why fake it with bulky middlemen when you can write the real thing and still get safety rails? That instantly won over the raw-SQL crowd, with one commenter dropping a breezy “pretty cool” and another saying they’d been waiting for this exact thing “for quite a while.” Minimalist developers? Absolutely fed.

But of course, this is the internet, so the applause lasted about five seconds before the interrogation began. The biggest mood swing came from people asking whether this shiny helper works outside Bun, the newer JavaScript runtime it’s built for. One commenter went straight for the jugular: “Bun is not really suitable for production.” Oof. Suddenly the conversation wasn’t just about the tool — it was about whether the house it lives in is sturdy enough to stand in. Others piled on with practical demands: can it work with a different Postgres client, and what about PostGIS, the mapping-heavy database extension beloved by geo nerds? In other words: “Cool demo, now can it survive my weird setup?” The vibe is classic hacker drama — half “finally, someone gets it,” half “nice toy, but can it handle the messy real world?”

Key Points

  • bun-sqlgen generates type-safe, null-safe typings for named raw SQL queries used with Bun.sql.
  • The tool validates queries against a real Postgres or SQLite database during code generation, without requiring Docker.
  • Schemas are based on SQL migration files, which the article describes as the source of truth.
  • The generation command creates a `queries.gen.d.ts` file that should be committed and used by plain TypeScript compilation.
  • The project is published as `@ilbertt/bun-sqlgen`, and its README is described as covering dialect support, nullability overrides, transactions, configuration, and examples.

Hottest takes

"Bun is not really suitable for production" — sHooKDT
"Support for postgis?" — psc007
"pretty cool" — danr4
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.