Pg-typesafe – Strongly typed queries for PostgreSQL and TypeScript
Throughout my career, I tried many tools to query PostgreSQL, and in the end, concluded that for what I do, the simplest is almost always the best: raw SQL queries. Until now, I typed the results manually and relied on tests to catch problems. While this is OK in e.g., GoLang, it is quite annoying in TypeScript. First, because of the more powerful type system (it's easier to guess that updated_at is a date than it is to guess whether it's nullable or not), second, because of idiosyncrasies (INT4s are deserialised as JS numbers, but INT8s are deserialised as strings). So I wrote pg-typesafe,…
Pg-typesafe – Strongly typed queries for PostgreSQL and TypeScript launched on February 17, 2026 with 69 votes, #530 of 16,628 launches that month and more than 95% of that year's launches.
In plain words
Pg-typesafe is a TypeScript library that provides automatic type safety for raw PostgreSQL queries without requiring manual type definitions. It works like the standard node-pg driver but automatically infers result types from SQL queries, catching type mismatches and handling PostgreSQL-to-JavaScript type conversions. The tool is designed for developers who prefer writing raw SQL but want TypeScript's type checking to prevent bugs related to nullable fields and numeric type serialization quirks.
written from the facts on this page · September 2026
From the sources
Strongly typed queries for PostgreSQL and TypeScript - n-e/pg-typesafe
pg-typesafe generates TypeScript types for PostgreSQL queries. pg-typesafe does so with no runtime dependencies, and zero additional verbosity. const { rows } = client . query ( "select id, name, last_modified from tbl where id = $1" , [ 42 ] , ) ; This query looks the same as a normal query with pg , but is fully typed: npm exec pg-typesafe -- --connectionString postgres://postgres:example@localhost This will generate the file src/defs.gen.ts that contains the pg-typesafe types. import type { TypesafePool } from "./defs.gen.ts" ; export const pool = new Pool ( ) as TypesafePool ; This will allow pg-typesafe to find you queries, and also type them properly. npm exec pg-typesafe --…from github.com
In the maker’s words, at launch
Throughout my career, I tried many tools to query PostgreSQL, and in the end, concluded that for what I do, the simplest is almost always the best: raw SQL queries. Until now, I typed the results manually and relied on tests to catch problems. While this is OK in e.g., GoLang, it is quite annoying in TypeScript.…
Does a similar job
all alternatives →
PgTyped – Typesafe SQL in TypeScript and Postgres2020 · github.com · ▲269pgTyped - Typesafe SQL in TypeScript. Contribute to adelsz/pgtyped development by creating an account on GitHub.
Parse your Postgres queries into a fully-typed AST in TypeScript2024 · github.com · ▲116Hey all, I'm the creator of @pg-nano/pg-parser. I'm using it in pg-nano[1] to statically analyze Postgres schemas spread across multiple SQL files for a couple of reasons: 1. Each CREATE statement needs to be in topological order, so pg-nano's dev command can execute them without issue. 2. pg-nano has a plugin system like Vite that allows SQL generation based on the parsed schema. Probably to the surprise of no one, working with an untyped AST feels like you're back in the days of JavaScript, because well... you are. Most of you know by now just how great TypeScript and static types in…
A SQL database implemented purely in TypeScript type annotations2020 · github.com · ▲426A SQL database implemented purely in TypeScript type annotations. - codemix/ts-sql
PgTyped – Typesafe SQL – TypeScript types generator for raw SQL queries2019 · github.com · ▲9pgTyped - Typesafe SQL in TypeScript. Contribute to adelsz/pgtyped development by creating an account on GitHub.
PGlite – in-browser WASM Postgres with pgvector and live sync2024 · pglite.dev · ▲509Hey, Sam and the team from ElectricSQL here. PGlite is a WASM Postgres build packaged into a TypeScript/JavaScript client library, that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It's 3mb Gzipped, now has support for many Postgres extensions, including pgvector, and it has a reactive "live query" API. It's also fast, with CRUD style queries executing in under 0.3 ms, and larger, multi-row select queries occurring within a fraction of a single frame. PGlite started as an experimental project we shared on X, and the…
Typed Postgres CRUD Queries2021 · github.com · ▲29Contribute to yasserf/postgres-typed development by creating an account on GitHub.
More dev tools this month
the category →

open-source IDE for thoughtful software design. Contribute to devdotfast/whiteboard development by creating an account on GitHub.
Dev tools · 27d ago · github.com

Contribute to reladraw/reladraw development by creating an account on GitHub.
Dev tools · 25d ago · github.com
OpenBot▲362Grok Bot alternative: free, local, open-source, multiplayer
Dev tools · 22d ago · openbot.run
Talanoa▲340Hi HN, I’m a fullstack developer, and honestly, I’ve lost count of how many side projects I’ve worked on over the years. But one idea kept coming back to me: a different kind of email client. It first came to me in 2014: “What if we could handle emails more like conversations?” Every year, I’d revisit this concept in my “Build Notes.” Ten years later, no one had built exactly what I had in mind — so I finally decided to do it myself. That’s how Talanoa was born. I wanted something focused on people, not timelines. I was tired of marking messages as unread just to remember to reply later, or…
Dev tools · 20d ago · talanoa.email
CoreSpeed▲332One MCP for everything your agents need: apps, memory, tools
Dev tools · 27d ago · corespeed.io
Source: Show HN post ↗ · launch text quoted in part
Launched alongside, February 2026
the whole month →



Lovon AI Therapy▲801Feel closer and have more fun with your partner every day!
AI · Feb 2026 · lovon.app

Hello my name is Ben Ward for the past 3 years I have been remastering the financial game Wall Street Raider created by Michael Jenkins originally on DOS in 1986. It has been a rough journey but I finally see the light at the end of the tunnel. I just recently redid the website and thought maybe the full story of how this project came to be would interest you all. Thank you for reading.
Work · Feb 2026 · wallstreetraider.com