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

@86d-app/newsletter

v0.0.4

Published

Newsletter subscription management module for 86d commerce platform

Readme

[!WARNING] This project is under active development and is not ready for production use. Please proceed with caution. Use at your own risk.

@86d-app/newsletter

Newsletter subscription management for the 86d commerce platform. Handles subscriber lifecycle (subscribe, unsubscribe, resubscribe) with idempotent operations and tagging support.

version license

Installation

npm install @86d-app/newsletter

Usage

import newsletter from "@86d-app/newsletter";
import { createModuleClient } from "@86d-app/core";

const client = createModuleClient([
  newsletter({
    allowResubscribe: "true",  // default: allow resubscription
  }),
]);

Configuration

| Option | Type | Default | Description | |---|---|---|---| | allowResubscribe | "true" \| "false" | "true" | Allow previously unsubscribed users to resubscribe |

Subscriber Lifecycle

subscribe()      → active
unsubscribe()    → unsubscribed  (sets unsubscribedAt timestamp)
resubscribe()    → active        (clears unsubscribedAt, preserves original subscribedAt)

subscribe() is idempotent: calling it for an already-active email returns the existing subscriber unchanged. For an unsubscribed or bounced subscriber, it reactivates them while preserving the original subscribedAt date.

Store Endpoints

| Method | Path | Description | |---|---|---| | POST | /newsletter/subscribe | Subscribe an email address | | POST | /newsletter/unsubscribe | Unsubscribe an email address |

POST /newsletter/subscribe body:

{
  "email": "[email protected]",
  "firstName": "Jane",
  "lastName": "Doe",
  "source": "footer-form",
  "tags": ["launch-announcement"]
}

POST /newsletter/unsubscribe body:

{
  "email": "[email protected]"
}

Admin Endpoints

| Method | Path | Description | |---|---|---| | GET | /admin/newsletter | List subscribers (filter: status, tag, paginate: page, limit) | | DELETE | /admin/newsletter/:id/delete | Delete a subscriber permanently |

Query parameters for GET /admin/newsletter:

| Param | Type | Default | Description | |---|---|---|---| | status | "active" \| "unsubscribed" \| "bounced" | — | Filter by subscriber status | | tag | string | — | Filter by tag | | page | number | 1 | Page number (1-indexed) | | limit | number | 50 | Results per page (max 100) |

Controller API

controller.subscribe(params: {
  email: string;
  firstName?: string;
  lastName?: string;
  source?: string;
  tags?: string[];
  metadata?: Record<string, unknown>;
}): Promise<Subscriber>

controller.unsubscribe(email: string): Promise<Subscriber | null>

controller.resubscribe(email: string): Promise<Subscriber | null>

controller.getSubscriber(id: string): Promise<Subscriber | null>

controller.getSubscriberByEmail(email: string): Promise<Subscriber | null>

controller.updateSubscriber(id: string, params: {
  firstName?: string;
  lastName?: string;
  tags?: string[];
  metadata?: Record<string, unknown>;
  status?: SubscriberStatus;
}): Promise<Subscriber | null>

controller.deleteSubscriber(id: string): Promise<boolean>

controller.listSubscribers(params?: {
  status?: SubscriberStatus;
  tag?: string;
  take?: number;
  skip?: number;
}): Promise<Subscriber[]>

Example: Subscription Flow

// Customer subscribes via storefront form
const subscriber = await controller.subscribe({
  email: "[email protected]",
  firstName: "Jane",
  source: "footer-form",
  tags: ["weekly-digest"],
});
// subscriber.status === "active"

// Customer unsubscribes via email link
await controller.unsubscribe("[email protected]");
// subscriber.status === "unsubscribed"

// Customer resubscribes later
await controller.resubscribe("[email protected]");
// subscriber.status === "active", original subscribedAt preserved

// Admin lists active subscribers
const active = await controller.listSubscribers({ status: "active" });

// Admin filters by tag
const digest = await controller.listSubscribers({ tag: "weekly-digest" });

Types

type SubscriberStatus = "active" | "unsubscribed" | "bounced";

interface Subscriber {
  id: string;
  email: string;
  firstName?: string;
  lastName?: string;
  status: SubscriberStatus;
  source?: string;
  tags: string[];
  metadata: Record<string, unknown>;
  subscribedAt: Date;
  unsubscribedAt?: Date;
  createdAt: Date;
  updatedAt: Date;
}