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

@gigamusic/db

v4.4.0

Published

Drizzle schema + a typed query factory for the gigamusic platform.

Readme

@gigamusic/db

Drizzle schema + a typed createQueries(db) factory for the gigamusic platform. Consumers import the schema objects into their own Drizzle setup and pass a drizzle() instance into the factory.

import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import { createQueries } from "@gigamusic/db";
import * as schema from "@gigamusic/db/schema";

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const db = drizzle(pool, { schema });

export const queries = createQueries(db);

For Neon: import drizzle from drizzle-orm/neon-serverless instead and pass a @neondatabase/serverless Pool. The Queries interface is the same.

Schema subpath

@gigamusic/db/schema exports the table objects, relations, and column shapes:

import {
  releases, tracks, trackFiles,
  orders, orderItems, downloadTokens,
  siteSettings, links, rateLimits,
  releasesRelations, tracksRelations, /* ... */
  releaseColumns, trackColumns, /* ... */
} from "@gigamusic/db/schema";

Pass the full namespace import (import * as schema from "@gigamusic/db/schema") into drizzle(pool, { schema }) so the relational query API (db.query.releases.findFirst(...)) works.

Extending tables

If you want to add columns to a bundled table, declare your own pgTable using the exported column object:

import { releaseColumns } from "@gigamusic/db/schema";
import { pgTable, text } from "drizzle-orm/pg-core";

export const releases = pgTable("releases", {
  ...releaseColumns,
  vinylSku: text("vinyl_sku"),
});

Library queries (createQueries) close over the base table, so they only read/write the base columns. Provide your own queries for the extended columns.

Reserved names (don't redeclare these in consumer schemas)

Tables (pgTable first-arg targets): releases, tracks, track_files, orders, order_items, download_tokens, site_settings, links, rate_limits, link_pages, link_page_items

Enums: ReleaseType, OrderStatus

link_pages / link_page_items are part of this package's schema and createQueries; @gigamusic/links owns the link-page admin handlers + UI helpers on top of them.

What this package does not own

  • The Drizzle client construction (drizzle(pool, { schema })) — consumers build their own with whatever adapter (node-postgres, neon-serverless, etc.).
  • Migrations — consumers run drizzle-kit push (or generate + migrate) themselves.
  • Database connection state — the db instance is passed into createQueries; this package never reads process.env.