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

@rafters/mail-drizzle

v0.1.0

Published

Drizzle ORM adapter for @rafters/mail. Table definitions and service implementations.

Readme

@rafters/mail-drizzle

Drizzle ORM adapter for @rafters/mail. Ships the Drizzle table definitions for all 13 tables and the service implementations that satisfy the core service interfaces.

Pair this with @rafters/mail. Other ORM adapters (@rafters/mail-kysely, @rafters/mail-prisma) can slot in identically without touching core.

Install

pnpm add @rafters/mail @rafters/mail-drizzle

What you get

  • Table definitions for all 10 inbox tables (mailbox, inboxFolder, inboxThread, inboxMessage, inboxMessageLabel, inboxThreadLabel, inboxAttachment, threadAssignment, threadNote, inboxLabel)
  • Newsletter tables (platformAudience, platformSubscriber, broadcastAudit) -- consumer opt-in
  • Service factories for thread, folder, label, assignment, note management plus the InboxEmailService for compose/reply
  • createMailServices(db) -- wires every service interface in one call

Usage

import { drizzle } from "drizzle-orm/d1";
import {
  mailbox,
  inboxThread,
  createMailServices,
  createInboxEmailService,
} from "@rafters/mail-drizzle";

// Wire the services to a Drizzle DB instance
const db = drizzle(env.DB);
const services = createMailServices(db);

await services.threads.listThreads(mailboxId);
await services.folders.initSystemFolders(mailboxId);

// Compose/reply needs additional adapters
const emailService = createInboxEmailService({
  db,
  blobStorage, // BlobStorage from @rafters/mail-cloudflare or your own
  emailProvider, // EmailProvider from @rafters/mail-resend or your own
});

Subpath exports

Import only what you need. Each subpath ships independently for tree-shaking:

import { mailbox, inboxThread } from "@rafters/mail-drizzle/tables";
import { platformAudience } from "@rafters/mail-drizzle/newsletter";
import { createMailServices } from "@rafters/mail-drizzle/services";

The package's main entry re-exports everything for convenience.

Migrations

This package does not own migrations. Apply the SQL from @rafters/mail/migrations to your database with your own tooling (wrangler d1 migrations apply, etc.). The Drizzle table definitions in this package match the SQL exactly so you can write type-safe queries against the migrated schema.

Why a separate package?

Core describes the schema as Zod row schemas (the shape of every SELECT row) and raw SQL. ORM-specific code -- table builders, query DSL, service implementations -- lives in adapter packages so consumers using a different query layer are not forced to install Drizzle. See the architecture doc for the full rationale.

License

MIT