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

email-frontend-v2

v0.6.3

Published

A node.js server that builds html emails using react

Readme

📧 Email Frontend V2

It creates responsive email content using React.

Development 👨‍💻

Starting a local development server 🏃‍♂️

To start working on the email frontend you need to install all dependencies using yarn command. Once all dependencies are installed you can run yarn dev to start the local development server. This server will be accessible using http:://localhost:3006. Every time when you make changes in the codebase it will restart and apply them automatically.

Building blocks 🧱

Layout

Building an email has some differences from building a normal web page. Email clients are usually very dumb and have pure support of the modern HTML and CSS features. If you want to know if some feature can be used in an email you can always check it on https://www.caniemail.com/. Unfortunately, you can't use Flexbox or Grid to build your email layouts. The only way to build robust layouts is to use tables. A lot of tables! You can think about an email layout as a combination of tables.

To encapsulate this logic and make the developer experience better we encapsulated it into a Grid component:

  • Grid
  • Grid.Row
  • Grid.Column

These should be your main blocks for building emails. It has the logic to handle a responsive layout. And if there are some bugs it will be easier to fix that for all emails. That is why you should try to avoid using custom div elements and use Grid components.

Text

When you need to specify some text in the email please make sure that you use BodyText or HeadlineText components. It will make sure that all your emails look consistent. These components have built-in accessibility support ensuring that the text is visible on the background. By default, it picks black or white color based on the section background color. In case you want to render the text on a different background you have to provide the background color to the BodyText or the HeadlineText components using onBackground prop (see Footer).

Styling and Theming 💅

Some email clients don't work well with an external CSS so all styles have to be applied inline. This will make sure that your email looks the same on all clients.

It's also best to avoid using margin to separate elements and use padding instead.

To keep our emails consistent we created a theme object. Please check it out and use the tokens almost for any styling, especially for coloring, spacings, and typography. This theming will allow the email frontend v2 to work as a white-label for our partners.

Building emails 💌

This service is built similar to NextJS framework meaning that there are top-level components that work like pages or routes. These components exist in the ./src/emails folder. Every component in there corresponds to a standalone REST API route. For example if it's required to create a sale email the server will look for sale.tsx file in the ./src/emails folder. Then based on the React component it will validate the request body using prop-types and generate HTML using ReactDOMServer.

Here is the endpoint that you can call to create an email content - POST http://localhost:3006/:email, where :email is the email type.

Previewing emails 👀

Every email has a preview mode that helps to see the content visually. To see the preview you can send a GET request to the following URL http://localhost:3006/:email, where :email is the email type that your want to view, or open that link in a browser (see example http://localhost:3006/sale). The preview feature is built using sampleProps object that exists for every email.