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

v0.0.4

Published

Product catalog 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/products

Product catalog module with variants and hierarchical categories. Full CRUD for the admin panel and read-only browsing with search and filtering for the storefront.

Installation

npm install @86d-app/products

Usage

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

const module = products({
  defaultPageSize: 20,
  maxPageSize: 100,
  trackInventory: true,
});

Configuration

| Option | Type | Default | Description | |---|---|---|---| | defaultPageSize | number | 20 | Default number of products per page | | maxPageSize | number | 100 | Maximum products per page | | trackInventory | boolean | true | Enable inventory tracking by default |

Store Endpoints

| Method | Path | Description | |---|---|---| | GET | /products | List active products (paginated, filterable) | | GET | /products/featured | Get featured products | | GET | /products/:slug | Get a single product by slug (includes variants) | | GET | /products/search?q= | Search products by name, description, or SKU | | GET | /categories | List visible categories | | GET | /categories/:slug | Get a single category by slug |

Query parameters for GET /products:

| Param | Type | Description | |---|---|---| | page | number | Page number (default 1) | | limit | number | Items per page (capped at maxPageSize) | | category | string | Filter by category slug | | status | string | Product status (storefront always uses active) | | featured | boolean | Filter featured products |

Admin Endpoints

| Method | Path | Description | |---|---|---| | POST | /admin/products | Create a new product | | GET | /admin/products/list | List all products (all statuses) | | GET | /admin/products/:id | Get a product by ID | | PUT | /admin/products/:id | Update a product | | DELETE | /admin/products/:id | Delete a product | | POST | /admin/products/:productId/variants | Add a variant to a product | | PUT | /admin/variants/:id | Update a variant | | DELETE | /admin/variants/:id | Delete a variant | | POST | /admin/categories | Create a category | | GET | /admin/categories/list | List all categories | | PUT | /admin/categories/:id | Update a category | | DELETE | /admin/categories/:id | Delete a category |

Controller API

Controllers are accessed via the runtime context. Three sub-controllers are available: product, variant, and category.

// product controller
context.controllers.product.getById(ctx)        // Product | null
context.controllers.product.getBySlug(ctx)       // Product | null
context.controllers.product.getWithVariants(ctx) // ProductWithVariants | null
context.controllers.product.list(ctx)            // { products: Product[]; total: number }
context.controllers.product.create(ctx)          // Product
context.controllers.product.update(ctx)          // Product | null
context.controllers.product.delete(ctx)          // void

// variant controller
context.controllers.variant.create(ctx)          // ProductVariant
context.controllers.variant.update(ctx)          // ProductVariant | null
context.controllers.variant.delete(ctx)          // void

// category controller
context.controllers.category.getById(ctx)        // Category | null
context.controllers.category.getBySlug(ctx)      // Category | null
context.controllers.category.list(ctx)           // { categories: Category[]; total: number }
context.controllers.category.getTree(ctx)        // Category[]  (hierarchical)
context.controllers.category.create(ctx)         // Category
context.controllers.category.update(ctx)         // Category | null
context.controllers.category.delete(ctx)         // void

Each controller method receives a ctx object:

{
  context: { data: ModuleDataService };
  params: Record<string, string>;
  query: Record<string, string>;
  body: Record<string, unknown>;
}

Types

interface Product {
  id: string;
  name: string;
  slug: string;
  description?: string;
  shortDescription?: string;
  price: number;               // in cents
  compareAtPrice?: number;
  costPrice?: number;
  sku?: string;
  barcode?: string;
  inventory: number;
  trackInventory: boolean;
  allowBackorder: boolean;
  status: "draft" | "active" | "archived";
  categoryId?: string;
  images: string[];
  tags: string[];
  isFeatured: boolean;
  weight?: number;
  weightUnit?: "kg" | "lb" | "oz" | "g";
  metadata?: Record<string, unknown>;
  createdAt: Date;
  updatedAt: Date;
}

interface ProductVariant {
  id: string;
  productId: string;
  name: string;
  sku?: string;
  price: number;
  compareAtPrice?: number;
  costPrice?: number;
  inventory: number;
  options: Record<string, string>; // e.g. { size: "M", color: "Blue" }
  images: string[];
  position: number;
  weight?: number;
  weightUnit?: "kg" | "lb" | "oz" | "g";
  createdAt: Date;
  updatedAt: Date;
}

interface Category {
  id: string;
  name: string;
  slug: string;
  description?: string;
  parentId?: string;           // Self-referential for nested categories
  image?: string;
  position: number;
  isVisible: boolean;
  metadata?: Record<string, unknown>;
  createdAt: Date;
  updatedAt: Date;
}

interface ProductWithVariants extends Product {
  variants: ProductVariant[];
  category?: Category;
}

Notes

  • Store endpoints return only active products; admin endpoints return all statuses (draft, active, archived).
  • Product IDs are prefixed: prod_${timestamp}. Variant IDs: var_${timestamp}.
  • Deleting a category orphans its child categories and products (sets categoryId to null) rather than cascading.
  • getTree() builds a hierarchical category tree from the flat list using parentId references.