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

@setupless/drizzle

v0.4.3

Published

Small, typed helpers for defining Drizzle ORM schemas

Readme

@setupless/drizzle

Setup less for your Drizzle ORM schemas. Drop in IDs, timestamps, and soft-delete columns with a few spreads.

Install

In your project that already uses Drizzle:

npm install @setupless/drizzle
# or
bun add @setupless/drizzle

Add helpers to a schema

A PostgreSQL schema using plain Drizzle:

import { sql } from "drizzle-orm";
import { integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
  id: integer("id").primaryKey().generatedAlwaysAsIdentity(),
  name: text("name").notNull(),
  createdAt: timestamp("created_at").notNull().defaultNow(),
  updatedAt: timestamp("updated_at")
    .notNull()
    .defaultNow()
    .$onUpdate(() => sql`now()`),
  deletedAt: timestamp("deleted_at"),
});

The same columns and runtime behaviour with helpers:

import { pgTable, text } from "drizzle-orm/pg-core";
import { deletedAt, id, timestamps } from "@setupless/drizzle/pg";

export const users = pgTable("users", {
  ...id(),
  name: text("name").notNull(),
  ...timestamps(),
  ...deletedAt(),
});

Keep using properties such as users.createdAt in your queries. The database column names, defaults, and update behaviour are the same in both examples. If you add columns or change their definitions, apply those changes through your usual Drizzle migration workflow.

Choose the import for your database. Keep your existing table definition and columns:

| Database | Import helpers from | | ---------- | --------------------------- | | PostgreSQL | @setupless/drizzle/pg | | SQLite | @setupless/drizzle/sqlite | | MySQL | @setupless/drizzle/mysql |

Use only the helpers you need. Already have an ID? Keep it. Already have createdAt? Add ...updatedAt() instead of ...timestamps() to avoid replacing its definition.

Helpers

Each helper returns columns to spread into your table, using the same syntax as ...timestamps() above.

| Helper | Adds | | -------------- | ----------------------------------------------------------------- | | id() | An auto-incrementing integer primary key | | id("uuid") | A generated UUID primary key | | createdAt() | A non-null created_at column, defaulting to the current time | | updatedAt() | A non-null updated_at column, set on insert and Drizzle updates | | timestamps() | Both createdAt() and updatedAt() | | deletedAt() | A nullable deleted_at column for soft deletion |

updatedAt() fills in the update time when you omit it from a Drizzle update. Explicit values take precedence. Updates outside Drizzle do not set it automatically.

To soft-delete a row, set deletedAt to the deletion time. Set it to null to restore the row. Filter queries explicitly; the helper does not hide deleted rows.

Database differences

  • PostgreSQL: Pass { withTimezone: true } to createdAt, updatedAt, timestamps, or deletedAt for timestamp with time zone. The default is timestamp without time zone.
  • SQLite: Timestamps are UTC text in YYYY-MM-DD HH:MM:SS format.
  • MySQL: Timestamps use UTC with millisecond precision. Requires MySQL 8.0.13+ and an engine that supports expression defaults, such as InnoDB. Supply UTC dates when writing timestamps through raw SQL.

PostgreSQL generates UUIDs in the database. SQLite and MySQL generate them in Drizzle, so inserts outside Drizzle must supply their own UUID.

Licensed under Apache 2.0.