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

@hedystia/db

v2.4.0

Published

Next-gen TypeScript ORM for building type-safe database layers at lightspeed

Readme

@hedystia/db

Type-safe database primitives for SQLite, MySQL, PostgreSQL, JSON files, and S3-backed storage.

Install

pnpm add @hedystia/db

Install the driver used by the application separately: better-sqlite3, sqlite3, sql.js, mysql2, mysql, pg, or @aws-sdk/client-s3.

Schema and typed inserts

import { database, integer, table, varchar } from "@hedystia/db";

const users = table("users", {
  id: integer().primaryKey().autoIncrement(),
  name: varchar(255).notNull(),
});

const db = database({
  schemas: [users],
  database: "sqlite",
  connection: { filename: "./app.db" },
  syncSchemas: true,
});

await db.initialize();
const user = await db.users.insert({ name: "Alice" });
await db.users.insertMany([{ name: "Bob" }, { name: "Cara" }]);

InferInsert<typeof users> makes auto-increment columns optional while keeping non-generated columns required. The same insert type is used by repositories, insertMany, and upsert.create.

Queries and migrations

const rows = await db.users.find({
  where: { name: { like: "%a%" } },
  orderBy: { id: "desc" },
});

const addIndex = migration("users_name_index", {
  async up({ schema }) {
    await schema.addIndex("users", ["name"]);
  },
  async down({ schema }) {
    await schema.dropIndex("users", "users_name_index");
  },
});

Each migration is tracked by name and executed inside the driver's transaction boundary. SQL drivers use native transactions. File and S3 drivers provide a snapshot-based rollback and remove newly created table artifacts when a migration fails; storage-level failures should still be monitored because object storage is not a relational transaction engine.

Migration names must be unique. Indexes are supported by SQLite, MySQL, and PostgreSQL. File and S3 drivers reject index operations explicitly.

Drivers

| Driver | Transaction model | Indexes | | --- | --- | --- | | SQLite | Native transaction | Yes | | MySQL/MariaDB | Connection transaction | Yes | | PostgreSQL | Client transaction | Yes | | File | In-memory snapshot + flush | No | | S3 | In-memory snapshot + object flush | No |

Documentation

MIT License © 2026 Hedystia