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

notion-mail

v1.1.0

Published

<h3 align="center">📬</h3> <h1 align="center">NotionMail</h1>

Readme

Overview

Description of the program and additional improvements(s) you selected.

This is a simple CLI application that allows you to "send mail" to some specified user. The mail is stored inside a database within Notion, with Sender, Recipient, and Message properties.

Additional Improvements

I chose to also add timestamp support, which involved adding a Date property to the database I created.

Testing

I created a very simple unit test that seeks to verify the functionality of the CLI in my program. Using the package @inquirer/testing, I was able to test some of the menu features and verify that my outputs were correct.

How to Use

Description about how to install and run the program.

  • Install the package globally: sudo npm i -g notion-mail
  • Run the program: notion-mail

You must have the following environment variables set before running:

  • NOTION_KEY: the API integration key
  • NOTION_DATABASE_ID: the Mail database ID

In my .zip submission I have provided a .env that you can use!

References

List of references to sources you relied on (e.g. StackOverflow post about Node CLI applications, API docs, any open-source libraries).

  • [https://developers.notion.com/docs/working-with-databases#adding-pages-to-a-database]
    • I referenced the Notion docs throughout this assignment to ensure I was following best practices & using the API properly in my code.
  • [https://dev.to/alanpjohn/creating-a-nextjs-blog-in-typescript-using-notion-api-2a9]
    • This article was helpful in properly typing the database responses in my code. I used this author's method of Extraction to create types tailored to the IMail interface I created for my database.
  • [https://www.npmjs.com/package/@inquirer/testing]
    • I used this package to mimic the behavior of my CLI in my units tests.
  • [https://medium.hexlabs.io/typescript-based-command-line-interface-cli-with-node-js-e2d7a0db84d7]
    • This article aided me in structuring my overall CLI program.
  • [https://www.color-hex.com/vintage-color-palettes]
    • I used this website for the colors used in my CLI display.
  • [https://stephencharlesweiss.com/mocks-and-spies-inspecting-console-messages-with-jest]
    • I used this author's method of spying on the console in my unit tests.

Future Improvements

What are some future improvements you might make to this program or its code?

For future improvements, I would like to flesh out the tests for my program much more. I would add individual test cases that check for error handling, and more tests to check that my inquirer prompts and CLI outputs are functioning correctly. Being more verbose in my test cases would also be important for future developments, i.e. checking that sendOutput works correctly for one message, more than one message, zero messages, etc.

Additionally, I would add more detailed integration and end-to-end tests that would replace mocked API requests with real ones, and more robustly check that my program is working with the Notion API as expected.

I might also add some of the following features:

  • Ability to delete emails
  • Ability to flag or prioritize emails
  • Ability to filter emails by message content
  • Ability for messages to be sent between unique user databases

Justifications

What were some of the product or technical choices you made and why?

I decided to use TypeScript for building my application because of its typing capabilities, and because I am comfortable with the language. When working with databases, I know it is important to employ strong type checking to protect data coming in and out of the database. This is why I sought out a method to "extract" types directly from the Notion API; this allows for strong typing of data and concise data processing within my program.

Creating the NotionMail class ensures that only one instance of the Notion Mail client is running at a time. This could be important in a broader context to ensure that data can be properly read and written into the database, and avoids the potentiality of duplicate requests. Additionally, this structure allows for error checking within the NotionMail constructor to avoid running the client without the necessary connection configuration: the API key and database ID. This also prevents this sensitive information from being hard coded, and instead relies on the use of environment variables. This abstraction promotes security and deployability of the app on a larger scale.