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-imap-cloudflare

v0.1.0

Published

Cloudflare Durable Object runtime adapter for @rafters/mail-imap

Downloads

240

Readme

@rafters/mail-imap-cloudflare

Cloudflare Durable Object runtime for @rafters/mail-imap. One Durable Object per mailbox, WebSocket transport, hibernation for IDLE, and an inbound-signal bridge so new mail wakes idle clients with an EXISTS notification.

Near-zero idle cost: when no clients are connected, the DO hibernates. When a client holds IDLE, the DO stays warm only long enough to serve the connection and then hibernates again until new mail arrives or the client disconnects.

Install

pnpm add @rafters/mail-imap-cloudflare @rafters/mail-imap @rafters/mail

Usage

// src/worker.ts
import { createImapDurableObject, createImapWorker } from "@rafters/mail-imap-cloudflare";
import { createAuthAdapter } from "./adapters/auth.ts";
import { createMailboxAdapter } from "./adapters/mailbox.ts";
import { createMessageAdapter } from "./adapters/message.ts";

// The DO class. Export the return value from your worker entry.
export const ImapMailboxDO = createImapDurableObject({
  createAdapters(env) {
    return {
      authAdapter: createAuthAdapter(env.DB),
      mailboxAdapter: createMailboxAdapter(env.DB),
      messageAdapter: createMessageAdapter(env.DB, env.BLOB_STORAGE),
    };
  },
});

// The worker entry that routes WebSocket upgrades to the correct DO
// (one DO per email address).
export default createImapWorker();
// wrangler.jsonc
{
  "name": "mail-imap",
  "compatibility_date": "2025-04-01",
  "durable_objects": {
    "bindings": [{ "name": "IMAP_MAILBOX", "class_name": "ImapMailboxDO" }],
  },
  "migrations": [{ "tag": "v1", "new_classes": ["ImapMailboxDO"] }],
  "d1_databases": [{ "binding": "DB", "database_name": "mail", "database_id": "..." }],
  "r2_buckets": [{ "binding": "BLOB_STORAGE", "bucket_name": "mail-blobs" }],
}

Clients connect with wss://imap.example.com/[email protected]&mailboxId=mbx-123. Standard email clients do not speak IMAP-over-WebSocket natively; this runtime is designed for web clients and custom bridges. For native TCP on port 993, use @rafters/mail-imap-server.

Inbound signaling

The DO exposes a POST /notify?count=N endpoint that your inbound email Worker calls after storing a new message. IDLE clients receive an EXISTS notification on the next tick.

Documentation

Per-package docs ship in the docs/ directory and on npm:

  • deployment.md -- Deployment guide covering Cloudflare Workers + Durable Objects setup, bindings, cost model, and monitoring

See the monorepo README for the complete IMAP architecture.

License

MIT