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

@volter/twin-postmark

v0.1.37

Published

Local Postmark twin — a faithful, stateful local Postmark transactional-email API your real `postmark` SDK talks to unmodified. Plain/templated/batch sends, outbound + inbound message activity, bounces and delivery stats, templates, message streams, suppr

Readme

@volter/twin-postmark

A local Postmark twin — a faithful, stateful local Postmark transactional-email API your real postmark SDK talks to unmodified. Send plain/templated/batch email; browse outbound message activity with per-message delivery events; bounces + delivery stats; templates with Mustachio rendering; message streams; suppressions; webhooks; servers, domains and sender signatures. A deterministic offline delivery lifecycle writes real MessageEvents, mints Bounce records and suppressions, and POSTs Postmark's real (unsigned, Basic-auth/custom-header) webhook payloads to your registered endpoints. Ships a React activity mirror UI rendered from real twin state. Built on the shared @volter/world-core kernel (append-only event log + projection, local-action writes, egress ledger, connectors, pack registry).

import { ServerClient, Models } from 'postmark';
import { createPostmarkTwinServer } from '@volter/twin-postmark';

const twin = createPostmarkTwinServer({ port: 0 });          // local, offline
// The SDK's OWN public option points it at the twin — nothing is monkey-patched.
const postmark = new ServerClient(
  '11111111-2222-3333-4444-555555555555',
  new Models.ClientOptions.Configuration(false, `127.0.0.1:${twin.port}`, 30),
);

const sent = await postmark.sendEmail({
  From: 'Acme <[email protected]>',
  To: '[email protected]',
  Subject: 'Your login code',
  TextBody: 'Your code is 123456',
});                                    // → { MessageID, SubmittedAt, ErrorCode: 0, Message: 'OK' }

const details = await postmark.getOutboundMessageDetails(sent.MessageID);
details.MessageEvents;                 // → [{ Type: 'Delivered', … }]

Zero-edit redirection also works: set POSTMARK_TWIN_URL and the control-plane injector forwards api.postmarkapp.com to the twin, so an unchanged app finds it with no config.

CLI

world-postmark serve       [--port N] [--root DIR] [--read-only]   # the Postmark API twin
world-postmark mirror      [--port N] [--root DIR]                 # the activity mirror UI
world-postmark conformance [--root DIR]                            # spec-true validation

How it works

  • A repo, not a mock. Every write is a local action appended to the kernel's log; every read folds the projection. A sent message is stored in twin state — never put on the wire — and GET /messages/outbound serves the same projection the mirror renders.
  • Auth is Postmark's, faked locally. X-Postmark-Server-Token on server-scoped routes and X-Postmark-Account-Token on account-scoped ones (not a Bearer token). A twin holds no account, so any non-empty token is accepted; a missing or empty one fails like the vendor with 401 {ErrorCode: 10} and the vendor's endpoint-scoped message text. The documented public test token POSTMARK_API_TEST is modeled with its real /email-only restriction.
  • A deterministic offline delivery lifecycle. A send records MessageEvents on the stored message: Delivered, plus Opened/LinkClicked only when the message asked for that tracking (Postmark's tracking is opt-in). A recipient whose local part starts with bounce hard-bounces; spam/complaint raises a spam complaint. Both mint a real Bounce record and a suppression, so a later send to that address is refused with the vendor's 422 {ErrorCode: 406} — genuinely stateful behavior, not a fresh-root trick.
  • Webhooks are Postmark's, which means UNSIGNED. There is no svix/HMAC scheme anywhere in Postmark's design. Deliveries carry a RecordType discriminator (Delivery/Open/Click/Bounce/SpamComplaint) and are authenticated the two ways the Webhooks API actually models: HttpAuth → an HTTP Basic header, and HttpHeaders → your own headers. A webhook only receives a record type whose trigger is enabled, on its own message stream. postmark.honesty.no_webhook_signature is a deliberate negative assertion that keeps a future contributor from copying a sibling pack's signature scheme in here.
  • The mirror is API passthrough (archetype A). The browser client fetches Postmark's own real API paths; there is exactly one handler serving both the screen and the SDK, so API↔UI parity cannot drift.

Coverage

Partial and honest, and it is meant to read that way. The capability manifest (src/postmark-capabilities.ts) is the real vendor surface as the denominator — all 15 documented API groups and 86 endpoints from developer.postmarkapp.com's docs nav, enumerated top-down whether or not this twin has reached them. Coverage grows by building, and the percentage drops when the denominator honestly grows. See the generated table in the repo README for the live numbers.

Where the surface came from (recorded in spec-sources.json as kind: "none" — Postmark publishes no OpenAPI/SDL):

  1. The official postmark npm SDK v4.0.7's compiled route map and TypeScript models — a first-party artifact naming every path, verb, field, casing and list envelope, plus its AuthHeaderNames enum and ApiInputError.ERROR_CODES.
  2. developer.postmarkapp.com's published API-error-codes table (163 rows) — the source of every ErrorCode/HTTP-status pair in POSTMARK_ERRORS.
  3. Live read-only probes of api.postmarkapp.com with the documented public test token, made during this pack's build. These corrected three things the docs alone get wrong, each annotated [WIRE] in postmark-twin.ts:
    • Subject is NOT required on POST /email — a subject-less send succeeds;
    • the 401 message text is endpoint-scoped ("valid Server token" vs "valid Account token"), not the merged string the docs table shows;
    • POSTMARK_API_TEST is /email-only, answering 403 + ErrorCode 10 anywhere else, and "Test job accepted" rather than "OK" on a send.

Anything not grounded in those three is marked ⚠ doc-unverified in the source and never claimed beyond what a verify() proves.

Fidelity quirks deliberately preserved

Postmark's API is inconsistent in ways a tidy-minded twin would silently "fix". These are modeled as-is, because a consumer's parsing depends on them:

  • TotalCount comes first on every list envelope except /message-streams (last) and /webhooks (absent entirely).
  • /senders returns a SenderSignatures array, not Senders.
  • /deliverystats's first bounce row is the "All" total and carries no Type key.
  • Batch sends answer HTTP 200 with per-message errors inside a bare array — never a top-level 422 (only the >500 cap is).
  • Suppression deletion is a POST to …/suppressions/delete, not an HTTP DELETE.
  • "Not found" for a known route is 422 + a per-domain ErrorCode, not 404; 404 is reserved for a route that does not exist at all.
  • An outbound message mixes two recipient shapes in one payload: To/Cc/Bcc are arrays of {Email, Name} objects while Recipients, right beside them, is an array of plain email strings (all of To+Cc+Bcc flattened). This is the vendor's real shape, not a twin bug — grounded in the outbound-search example on postmarkapp.com/developer/api/messages-api ("To":[{"Email":…,"Name":…}] next to "Recipients":["…"]) and the official postmark SDK's own types (OutboundMessage.To: Recipient[] vs Recipients: string[]), and pinned by postmark.messages.outbound_recipient_shapes so neither side is ever "fixed" into consistency. (One sub-shape divergence, recorded honestly: for a bare address with no display name the docs example shows "Name": null where this twin emits "" — the string the official SDK's non-nullable Name: string type declares.)

No UI mirror? — it has one, and here is the rule it was decided by

Postmark's core job is done in code (an integrator calls POST /email), so ui-scope.json records needsUi: false: it is not an agent navigation target. The mirror exists as a state visualization — the local-dev outbox where a human inspects what the twin stored, which is exactly what Postmark's Activity dashboard is for. Same classification and same reasoning as the sibling resend pack. Every UI capability is data-coupled (seed through the twin's write path → fetch the same API the screen reads → assert), never a marker grep.

Known gaps (filed, not hidden)

Tracked as todo capabilities and in pull-audit.json: the Bulk API lifecycle, real inbound ingestion, PUT /templates/push, webhook verify/statistics, full Mustachio blocks ({{#each}}/{{#if}}) and layout composition, the rate-limit response headers and 429 path, the 415 problem+json envelope, and connector pulls for account-token domains/sender signatures, stream-scoped suppressions, inbound messages, and >500-row pagination.