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

sendlayer-cli

v0.1.1

Published

Command-line interface for the SendLayer transactional email API

Downloads

572

Readme

sendlayer-cli

Command-line interface for the SendLayer transactional email API.

Send emails, manage webhooks, and tail delivery events from your terminal.

Install

npm (cross-platform)

npm install -g sendlayer-cli

Requires Node.js 18 or newer. Verify it worked:

sendlayer --version

Direct download

Grab a standalone binary — no Node.js required — from the latest release:

| OS | Architecture | |---------|--------------| | Linux | x64, arm64 | | macOS | x64, arm64 | | Windows | x64 |

Authenticate

sendlayer login
# or set the env var, which every command reads:
export SENDLAYER_API_KEY=sl_xxx
# or non-interactive, reading the key from the environment:
sendlayer login --key "$SENDLAYER_API_KEY"

Auth resolution: --api-key flag → SENDLAYER_API_KEY env → stored credentials.

Prefer the interactive prompt or the environment variable. A key passed on the command line is visible in your shell history and to anyone who can run ps.

Check who you are:

sendlayer whoami

Send an email

sendlayer emails send \
  --from "Paulie <[email protected]>" \
  --to [email protected] \
  --subject "Welcome" \
  --text "Glad to have you."

Use a JSON payload file for complex emails:

sendlayer emails send --file ./email.json

Where email.json is:

{
  "from": { "email": "[email protected]", "name": "Paulie" },
  "to": [{ "email": "[email protected]" }],
  "subject": "Welcome",
  "html": "<h1>Hi!</h1>",
  "tags": ["onboarding"]
}

Attachments, headers, and multiple recipients:

sendlayer emails send \
  --from [email protected] \
  --to [email protected],[email protected] \
  --cc [email protected] \
  --subject "Invoice" \
  --html-file ./invoice.html \
  --attachment ./invoice.pdf:application/pdf \
  --header X-Campaign=Q2 \
  --tag billing

Webhooks

sendlayer webhooks list
sendlayer webhooks create --url https://example.com/hook --event bounce
sendlayer webhooks delete 42

Local development with webhooks listen

Stream events to your terminal and forward them to a local HTTP server:

# in one terminal — expose your local port over a public URL
ngrok http 4000

# in another terminal
sendlayer webhooks listen \
  --port 4000 \
  --public-url https://abc.ngrok.io \
  --forward-to http://localhost:3000/webhook

Notes:

  • The CLI registers one SendLayer webhook per event type (default: all six).
  • On Ctrl+C it deletes every webhook it created.
  • If a previous run crashed, the next run will offer to clean up stale webhooks.

Events

sendlayer events list --event delivered --limit 50
sendlayer events list --start 2026-05-01 --end 2026-05-09
sendlayer events list --message-id <message-id>

Output formats

Every command supports --json for machine-readable output, and auto-detects non-TTY (CI/pipes) to default to JSON.

sendlayer events list --json | jq '.Events[] | .Message.Headers.To'

Configuration

Credentials are stored at:

  • macOS / Linux: $XDG_CONFIG_HOME/sendlayer/credentials.json (default ~/.config/sendlayer/credentials.json)
  • Windows: %APPDATA%\sendlayer\credentials.json

File mode is 0600. Multiple profiles supported via --profile <name>. The first profile you save becomes the default, and any command run without --profile uses it; sendlayer whoami shows which one is active.

Development

The CLI is written in TypeScript (src/**/*.ts). Two entrypoints:

  • bin/dev.js — runs the TypeScript sources directly via ts-node, no build step.
  • bin/run.js — runs the compiled output in dist/ (what ships to users).
git clone https://github.com/SendLayer/sendlayer-cli
cd sendlayer-cli
npm install

# Run straight from TypeScript sources (fast inner loop):
./bin/dev.js whoami
npm run dev -- emails send --help

# Or build once and run the compiled CLI:
npm run build
./bin/run.js whoami

Quality checks (same as CI):

npm run lint        # eslint over src/**/*.ts
npm run typecheck   # tsc --noEmit
npm test            # vitest
npm run build       # tsc -> dist/ + oclif manifest

Build native binaries with Bun. npm install provides the pinned version:

npm run compile:binaries

License

MIT