Two Tiny Bun-Native Packages Trpc Over Bun.serve and a Kysely Postgres Dialect
Key topics
— trpc-bun (Bun-native tRPC adapter: HTTP + WebSocket) What: Run tRPC on Bun.serve with first-class HTTP and WS. How: HTTP via a fetch adapter + server.upgrade; WS via Bun’s websocket handler; one-liner server composer; optional reconnect broadcast. Reqs: Bun ≥ 1.3.0, @trpc/server ≥ 11.6.0, TS ≥ 5. Repo: https://github.com/lacion/trpc-bun
Highlights: • Uses only public tRPC server APIs (v11) • createTrpcBunFetchAdapter, createTrpcBunWebSocketAdapter, configureTrpcBunServer • Connection params over WS, subscriptions, mutations, error shaping • Duplicate-id protection, graceful stop/disconnect • bun test + GitHub Actions CI
— kysely-bun-sql (Kysely Postgres dialect backed by Bun SQL) What: Tiny, dependency-free Kysely dialect/driver using Bun’s native SQL client. How: Pooled SQL under the hood (reserve()/release()), Kysely’s Postgres adapter + query compiler. Reqs: Bun ≥ 1.1.31, Kysely ≥ 0.28, TS ≥ 5. Repo: https://github.com/lacion/kysely-bun-sql
Highlights: • Bun-native PostgreSQL via new SQL() or env auto-detection • Pooling, prepared statements, parameter binding via Bun SQL • Full Kysely integration (adapter, query compiler, introspector) • Transactions and savepoints through Kysely • No runtime deps, ESM only
I’ve been running both in real projects; publishing them to get more eyes on edge cases. Would love feedback on correctness, ergonomics, and Bun version quirks. Issues/PRs welcome. Thanks for taking a look.
The author shares two newly extracted Bun-native packages for tRPC and Kysely, seeking feedback on their correctness and ergonomics.
Snapshot generated from the HN discussion
Discussion Activity
No activity data yet
We're still syncing comments from Hacker News.
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Discussion hasn't started yet.