Zenstack, TRPC and Kit
ongoingContributing to the Zenstack open source project with zenstack-trpc and zenstack-kit library proposals.
Notes
Since my early days as an engineer, I've obsessively looked for a convenient solution to accelerate backend work. Building an API from a database can be a bad idea, but also a very good one depending on the scope of the project and size of the team.
Over the years I've tried Deployed (OG!!), Nexus-Prisma, PostGraphile, Hasura, Supabase, Firebase, and more. But all those projects usually lack in one direction or another. Some required management of permissions in Postgres itself (RLS is powerful, but very hard to maintain declaratively and in a readable way), some made it very difficult to write version-controlled business logic or to expand your generated API.
I first discovered Zenstack in early 2023 when they were a Prisma wrapper, and didn't give it a proper look as I was following Drizzle's rise. But on a closer look it fits right in the sweet spot: code-first approach, schema-declared permissions, expandable endpoints and business logic, customizable generated API.
Fast forward to 2025, I started playing with it more, right when the team started efforts to move away from Prisma and be fully based on Kysely. Following the rewrite, and in discussions with the team, I worked on two companion libraries.
Zenstack TRPC is a TRPC API generator from the Zenstack schema. It produces the typings and procedures needed to have a fully-featured Prisma-like API over TRPC. It also provides custom composable types for the TRPC client, with return types that change depending on the selects and with in the query. Repo is here.
Zenstack Kit is a migration manager for Zenstack, akin to Drizzle Kit or Prisma Migrate. I always wanted to write one, and ironing out all the edge cases has been a real opportunity to learn. Repo is here.