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/memberships

v0.0.40

Published

Paid membership plans — recurring subscriptions with exclusive benefits, gated products, and member pricing

Downloads

425

Readme

@86d-app/memberships

📚 Documentation: 86d.app/docs/modules/memberships

Paid membership plans for your commerce store. Create tiered subscription plans with exclusive benefits, gated products, and member-only pricing. Supports monthly, yearly, and lifetime billing intervals with optional trial periods.

Installation

The memberships module is included in the 86d platform. Enable it in your store's config.json:

{
  "modules": {
    "memberships": {}
  }
}

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | defaultTrialDays | string | "0" | Default trial period for plans | | defaultMaxMembers | string | — | Max members per plan |

Usage

import memberships from "@86d-app/memberships";

// In your store configuration
memberships({
  defaultTrialDays: "14",
});

Store Endpoints

| Method | Path | Description | |--------|------|-------------| | GET | /memberships/plans | List active plans | | GET | /memberships/plans/:slug | Get plan details with benefits | | GET | /memberships/my-membership | Get customer's current membership | | POST | /memberships/subscribe | Subscribe to a plan | | POST | /memberships/cancel | Cancel a membership | | GET | /memberships/check-access | Check if customer can access a product |

List plans

GET /memberships/plans?take=50&skip=0
→ { plans: MembershipPlan[] }

Get plan details

GET /memberships/plans/gold
→ { plan: MembershipPlan, benefits: MembershipBenefit[] }

Subscribe (requires auth)

POST /memberships/subscribe
{ planId: string }
→ { membership: Membership }

Customer ID is derived from the session — never provided by the client.

Check product access (requires auth)

GET /memberships/check-access?productId=prod_1
→ { hasAccess: boolean }

Returns { hasAccess: false } for unauthenticated requests. Customer ID is derived from the session.

Admin Endpoints

| Method | Path | Description | |--------|------|-------------| | GET | /admin/memberships | List all memberships (filter by status, planId) | | GET | /admin/memberships/stats | Dashboard statistics | | GET | /admin/memberships/plans | List all plans | | POST | /admin/memberships/plans/create | Create a plan | | POST | /admin/memberships/plans/:id/update | Update a plan | | POST | /admin/memberships/plans/:id/delete | Delete a plan (cascades) | | GET | /admin/memberships/:id | Get membership details | | POST | /admin/memberships/:id/cancel | Cancel a membership | | POST | /admin/memberships/:id/pause | Pause a membership | | POST | /admin/memberships/:id/resume | Resume a paused membership | | POST | /admin/memberships/plans/:planId/benefits/add | Add benefit to plan | | POST | /admin/memberships/benefits/:id/remove | Remove a benefit | | POST | /admin/memberships/plans/:planId/products/gate | Gate products to plan | | POST | /admin/memberships/plans/:planId/products/ungate | Ungate products |

Store UI

The module includes customer-facing store components in src/store/components/ (TSX logic + MDX templates):

| Page | Component | Description | |------|-----------|-------------| | /memberships | PlanListing | Browse all active membership plans with pricing and features | | /memberships/:slug | PlanDetail | Plan detail with benefits, features list, and subscribe action | | (embeddable) | MyMembership | Customer membership dashboard — view status, benefits, cancel |

Admin UI

The module includes admin UI components in src/admin/components/index.tsx (client components using useModuleClient):

| Page | Component | Description | |------|-----------|-------------| | /admin/memberships | MembershipAdmin | Membership list with status filters, member management | | /admin/memberships/plans | MembershipPlans | Plan list with create/edit forms, benefit and product gating management |

Service API

The MembershipController provides 24 methods:

Plans

  • createPlan(params) — Create a membership plan
  • getPlan(id) — Get plan by ID
  • getPlanBySlug(slug) — Get plan by URL slug
  • updatePlan(id, params) — Update plan fields (null clears optional fields)
  • deletePlan(id) — Delete plan with cascade
  • listPlans(params?) — List plans with filtering and pagination
  • countPlans(params?) — Count plans

Memberships

  • subscribe({ customerId, planId }) — Subscribe customer (auto-cancels previous)
  • cancelMembership(id) — Cancel membership
  • pauseMembership(id) — Pause active/trial membership
  • resumeMembership(id) — Resume paused membership
  • getMembership(id) — Get by ID
  • getCustomerMembership(customerId) — Get active membership with plan
  • listMemberships(params?) — List with filters
  • countMemberships(params?) — Count with filters

Benefits

  • addBenefit(params) — Add benefit to plan
  • removeBenefit(id) — Remove benefit
  • listBenefits(planId) — List plan benefits
  • getCustomerBenefits(customerId) — Get active benefits for member

Product Gating

  • gateProduct({ planId, productId }) — Gate product to plan
  • ungateProduct({ planId, productId }) — Remove gate
  • listGatedProducts({ planId }) — List gated products
  • countGatedProducts(planId) — Count gated products
  • canAccessProduct({ customerId, productId }) — Check access

Admin

  • getStats() — Dashboard statistics

Types

type BillingInterval = "monthly" | "yearly" | "lifetime";
type MembershipStatus = "active" | "trial" | "expired" | "cancelled" | "paused";
type BenefitType = "discount_percentage" | "free_shipping" | "early_access" | "exclusive_products" | "priority_support";

Notes

  • A customer can have only one active membership at a time
  • Subscribing to a new plan automatically cancels the previous one
  • Plans with trialDays > 0 start memberships in trial status
  • Lifetime plans have no expiration date
  • Product gating is plan-specific — a product can be gated to multiple plans
  • canAccessProduct returns true for ungated products (no membership required)
  • Deleting a plan cascades to its benefits, gated products, and memberships