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

@mikstack/notifications

v0.3.0

Published

Code-first notification infrastructure for mikstack projects. Factory function, plugin-based channels, Drizzle table mapping, type-safe notification definitions.

Readme

@mikstack/notifications

Code-first notification infrastructure for mikstack projects. Factory function, plugin-based channels, Drizzle table mapping, type-safe notification definitions.

Install

bun add @mikstack/notifications

Peer dependency: drizzle-orm (>=0.38.0)

Quick Start

1. Define your schema (copy to your schema.ts)

export const notificationDelivery = pgTable("notification_delivery", {
  id: text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
  userId: text("user_id").notNull().references(() => user.id),
  type: text("type").notNull(),
  channel: text("channel").notNull(),
  status: text("status", { enum: ["pending", "sent", "delivered", "failed"] }).notNull().default("pending"),
  content: jsonb("content"),
  error: text("error"),
  retryOf: text("retry_of"),
  retriesLeft: integer("retries_left").notNull().default(0),
  recipientEmail: text("recipient_email"),
  externalId: text("external_id"),
  createdAt: timestamp("created_at").notNull().defaultNow(),
  updatedAt: timestamp("updated_at").notNull().defaultNow(),
});

export const inAppNotification = pgTable("in_app_notification", { ... });
export const notificationPreference = pgTable("notification_preference", { ... });

2. Define notifications

import { defineNotification } from "@mikstack/notifications";

export const notifications = {
  "magic-link": defineNotification({
    key: "magic-link",
    critical: true,
    channels: {
      email: (data: { url: string }) => magicLinkEmail(data.url),
    },
  }),
  "welcome": defineNotification({
    key: "welcome",
    channels: {
      "in-app": (data: { userName: string }) => ({
        title: `Welcome, ${data.userName}!`,
        body: "Get started by creating your first note.",
      }),
    },
  }),
} as const;

3. Create instance

import { createNotifications, emailChannel, inAppChannel } from "@mikstack/notifications";

const notif = createNotifications({
  database: { db, schema, provider: "pg" },
  channels: [
    emailChannel({
      sendEmail: async ({ to, subject, html, text }) => { /* your SMTP logic */ },
    }),
    inAppChannel(),
  ],
  notifications,
});

4. Send notifications

await notif.send({
  type: "welcome",
  userId: user.id,
  data: { userName: user.name },
});

API

| Method | Purpose | |---|---| | notif.send({ type, userId, data }) | Send notification across channels | | notif.list({ userId, limit?, unreadOnly? }) | List in-app notifications | | notif.markRead({ userId, notificationIds? }) | Mark as read | | notif.getPreferences(userId) | Get user preferences | | notif.updatePreferences(userId, prefs) | Update preferences |

Client SDK

import { createNotificationClient } from "@mikstack/notifications/client";

const client = createNotificationClient({ baseUrl: "/api/notifications" });
await client.markRead(["notif-id-1"]);
await client.markAllRead();
const prefs = await client.getPreferences();
await client.updatePreferences({ "welcome": { "in-app": false } });

Features

  • Type-safe: send() autocompletes notification types and infers data shapes
  • Email retries: Exponential backoff (default 3 attempts), each attempt tracked as its own delivery row
  • Preference hierarchy: Per-type + per-channel > per-type + wildcard > wildcard + per-channel > defaults
  • Critical notifications: critical: true bypasses user preferences (e.g., auth emails)
  • In-app via Zero: inAppNotification table syncs to clients via Zero
  • Schema ownership: Tables are copy-pasted into your project (like better-auth), fully customizable