My 14-Year Journey Away from ORMs — How pGenie Puts SQL Back in Charge

April 15, 2026
Two colleagues collaborate on a marketing strategy using a whiteboard, focusing on user-generated content.
Photo by Walls.io on Pexels

Nikita Volkov has published the first part of a short series called “pGenie in Production,” recounting a 14‑year arc that begins with shipping an ORM and ends with an open‑source, SQL‑first Postgres code generator. He says he once wrote SORM for Scala, later abandoned it, and then doubled down on raw SQL tooling — building hasql and the hasql‑th syntax checker along the way. It has been reported that hasql is one of the main PostgreSQL drivers in the Haskell ecosystem and is used in projects like PostgREST and IHP. The emotional pivot is clear: after a decade-plus of “schema‑drift fires,” allegedly more than he cares to count, Volkov decided the database should be the single source of truth.

Three defining insights

Volkov outlines three simple but stubborn ideas that unmade his ORM mindset. First: don’t replace SQL; make integration with it safer and more convenient. Second: treat the query as the integration point — not the application’s User type, not a row struct, but the query itself, because it defines parameters and returns. Third: treat migrations plus queries as the database API — migrations are the contract (think OpenAPI for REST), queries are the operations. Sounds obvious in retrospect, but it’s a different worldview. Why fight the database when you can make it the authoritative spec?

From tools to pGenie

Those ideas led to tooling: hasql for safe, composable raw SQL, hasql‑th for compile‑time syntax checks, and now pGenie — a SQL‑first code generator that derives types, encoders/decoders, and even index suggestions from your migrations and .sql queries. It has been reported that Volkov initially experimented with pGenie as a closed SaaS before moving to open source between 2022 and 2026. The promise is straightforward: put schema and queries under version control, validate them in CI, and auto‑generate the plumbing so developers stop inventing yet another DSL that masks SQL’s semantics.

If you’ve ever cursed an ORM for leaking complexity or watched a schema drift into chaos, this will read like vindication. Volkov’s piece is part war story, part manifesto, and part roadmap — a call to treat the database as a first‑class citizen again. Read the full Part 1 on his blog for examples and the technical baggage that got him here.

Sources: nikita-volkov.github.io, Lobsters