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

@zigordev/email

v1.61.0

Published

The emails of zigordev apps: messages rendered with React Email on the design tokens when an app builds, and filled in at send time

Readme

@zigordev/email

The emails of the platform's apps: messages built with React Email on the design tokens, rendered into finished HTML and plain text when the app builds, and filled in with their values when the app sends them. Every message exists in English and Spanish.

What it is

Two entries, for two moments:

| Entry | When it runs | What it holds | | ----------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------ | | @zigordev/email/build | When the app builds | EmailLayout, EmailHeading, EmailText, EmailButton and EmailFooter on the tokens, theme, and renderTemplate | | @zigordev/email | When the app sends | fillEmail(template, values), and the four standard messages of sign-in, ready to fill |

A template is a subject, the HTML and the plain text of one message in one language, with places to fill written as {{name}}. React Email is a library that writes emails as React components and turns them into the old-fashioned HTML that mail clients read.

Why we have it

Every product sends email, starting with the message that confirms an address at sign-up. Each message has to look like the brand, read well in every mail client, and exist in both languages. Without the package, each product would write its own HTML for mail clients, and each would get a different part of it wrong.

Record 0047 explains the two moments. React Email costs a running service about 46 MB of memory and 176 ms to load, measured on 2026-11-25, and an API container has 256 MB. So React Email runs only when an app builds, and the running service fills in strings.

How it works here

flowchart LR
  components["Components on the tokens"] --> render["renderTemplate, when the app builds"]
  render --> saved["src/generated: HTML, text and subject, with {{places}}"]
  saved --> fill["fillEmail, when the app sends"]
  fill --> email["The finished email, handed to the notifications service"]
  • The theme. The emails wear the light mode of the tokens: the page, the raised card, the text, the lavender button and the 4 px and 6 px corners. Many mail clients read colours only as hexadecimal, so Lightning CSS turns each colour of the tokens into that form, into src/generated/theme.ts.
  • The render. renderTemplate(element, subject) gives the HTML and the plain text of a message. Headings keep their case in the plain text, so a place such as {{name}} in a heading survives. A message whose plain text would lose a place fails to render.
  • The saved copies. An app commits its rendered templates in src/generated/, and a test renders them again and fails when they differ. The package does the same for its own messages, in both languages.
  • The fill. fillEmail puts each value in its places. In the HTML each value is escaped, so a name cannot add markup. A link must start with https:// or http://. A missing value, or a value with no place, fails the send.

Nothing differs between the laptop and production: the same saved templates are filled in both.

How to use it

The standard messages are the four that sign-in sends, in English and in Spanish:

| Function | The message | | ---------------------------------------- | ------------------------------------------------------------------------- | | verifyEmail({ lang, product, link }) | Confirm your email address, to finish signing up | | resetPassword({ lang, product, link }) | Choose a new password. The link works for one hour | | accountExists({ lang, product }) | Someone tried to sign up with your address, which has an account. No link | | deleteAccount({ lang, product, link }) | Confirm, while signed in, that the account goes for good |

Sending a standard message takes the send entry only:

import { verifyEmail } from '@zigordev/email';

const email = verifyEmail({ lang: 'es', product: 'Notes', link: confirmationUrl });
await addToOutbox(tx, { topic, event: emailRequested, data: { to, ...email } });

A product's own message is a component, rendered at build. Add React Email as a dev dependency:

pnpm add @zigordev/email
pnpm add --save-dev react-email react react-dom
import { createElement as h } from 'react';
import {
  EmailButton,
  EmailHeading,
  EmailLayout,
  EmailText,
  renderTemplate,
} from '@zigordev/email/build';

export const noteShared = {
  en: await renderTemplate(
    h(
      EmailLayout,
      { lang: 'en', preview: '{{name}} shared a note with you' },
      h(EmailHeading, null, '{{name}} shared a note with you'),
      h(EmailText, null, 'Open it to read it and to add your own lines.'),
      h(EmailButton, { href: '{{link}}' }, 'Open the note')
    ),
    'A note from {{name}}'
  ),
};

A script of the app writes such templates into its src/generated/, and a test compares them with a fresh render. At send time the app fills them:

import { fillEmail } from '@zigordev/email';
import { noteShared } from './generated/emails.ts';

const email = fillEmail(noteShared[lang], { name: owner.name, link });

How to check that it works

  • pnpm exec vitest run --project email in toolkit renders the standard messages in English and Spanish and compares them with their saved copies, checks the theme against the tokens, and fills the templates.
  • When the saved copies differ after a change of React Email or of the tokens, pnpm --dir packages/email run generate renders them again. Read the difference before you commit it.
  • When a send fails with The email needs a value for ..., the code passes fewer values than the template has places. placeholdersOf(template) lists them.
  • To see a message, write its html to a file and open it in a browser, or send it to Mailpit on the laptop.