npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

typegres

v0.2.0

Published

![Typegres playground demo](./assets/demo.gif)

Readme

Typegres

Typegres playground demo

  • Methods on Postgres tables = your API. No routes. No GraphQL. No auto-CRUD.
  • Every Postgres function, fully typed. All 77 base types, every operator, nullability tracked at the type level.
  • Clients compose typed SQL across the wire. Server validates the surface area you expose.
  • Live by default. .live() re-queries when the underlying data changes — pushed directly to clients.

typegres.com/play · demo.mp4 · docs/ARCHITECTURE.md

Usage

Developer preview — surface is settled, edges still being filed. Not yet recommended for production.

npm install typegres pg
import { typegres, Int8, Text, expose } from "typegres";

const db = await typegres({
  type: "pg",
  connectionString: process.env.DATABASE_URL!,
});

class Users extends db.Table("users") {
  @expose() id = (Int8<1>).column({ nonNull: true, generated: true });
  @expose() first_name = (Text<1>).column({ nonNull: true });
  @expose() last_name = (Text<1>).column({ nonNull: true });

  // Derived column — composes back into your typed query API.
  @expose() fullName() {
    return this.first_name["||"](" ")["||"](this.last_name);
  }
}

// `fullName()` works anywhere a column does — select, where, orderBy:
const rows = await Users.from()
  .select(({ users }) => ({
    id: users.id,
    name: users.fullName(),
  }))
  .execute(db);

console.log(rows);
await db.close();

For a complete scaffold with migrations + codegen, see examples/basic. Or try it interactively at typegres.com/play.

How it works

  1. Types codegen'd from the Postgres catalog. 77 base types, full method/operator coverage, nullability tracked at the type level.
  2. Object-capability queries. Clients can only reach what you've exposed as @expose methods — columns, relations, scoped reads, mutations. The class surface is the contract; the schema underneath is free to move.
  3. Object-capability RPC. The query builder ships to a constrained interpreter on the server; only @expose-marked methods reach evaluation.
  4. Live queries. .live() watches the predicates your query depends on and re-yields when committed mutations would change the result.

Deeper dive in docs/ARCHITECTURE.md.

Status

  • [x] Full pg type system + operator/function codegen
  • [x] Query builder (.select + .join + .where + .groupBy + .having + .orderBy + .limit)
  • [x] Mutations (.insert / .update / .delete / .returning)
  • [x] Subqueries, scalar/array aggregation
  • [x] Table codegen from live schema
  • [x] Live queries — .live() returns an async iterable that re-yields when committed mutations would change the result
  • [x] Capability-rooted RPC — closures composed against @expose-marked classes/methods are serialized, evaluated server-side under a constrained interpreter, and JSON-streamed back

Planned

  • [ ] SQLite backend (sql-builder is dialect-aware; adapter is stubbed)
  • [ ] pg_notify-driven live updates (currently a single shared polling loop, not per-subscription)
  • [ ] WAL-mode for live updates (currently uses an auxiliary table)
  • [ ] Cap'n Web transport (in-flight upstream PR; cloudflare/capnweb#162)

Development

Recommended: Nix the package manager

  • direnv. The .envrc (use flake) auto-activates the pinned toolchain when you cd into the repo, and bin/startpg works out of the box. Without Nix, point DATABASE_URL at any local Postgres and skip startpg.
./bin/startpg             # one-time dev Postgres socket (Nix)
npm install
npm run check             # lint + typecheck + tests

License

MIT — see LICENSE.