Skip to main content

Documentation Index

Fetch the complete documentation index at: https://86d.app/docs/llms.txt

Use this file to discover all available pages before exploring further.

The inventory module tracks stock levels per product or variant, decrements on order placement, holds reservations during checkout, and surfaces low-stock and out-of-stock signals to the storefront and the admin. It works alongside @86d-app/products (which holds the per-product inventory field) and @86d-app/orders (which fires the inventory-decrement event). Source: modules/inventory · npm: @86d-app/inventory

Installation

86d module add inventory

Configuration

inventory({
  lowStockThreshold: "5",        // default low-stock alert threshold
  reservationTtl: "1800000",     // 30 minutes, in ms
  allowNegativeStock: "false",   // when "false", reject orders that would oversell
});

Store endpoints

MethodPathDescription
GET/inventory/:productIdPublic inventory level for a product
POST/inventory/reserveReserve stock during checkout
POST/inventory/releaseRelease a reservation

Admin endpoints

MethodPathDescription
GET/admin/inventoryList inventory across all products
POST/admin/inventory/:productId/adjustManual adjustment (+/-) with reason
GET/admin/inventory/low-stockItems below lowStockThreshold
GET/admin/inventory/audit-logInventory change history

Events

EventWhen
inventory.adjustedManual adjustment recorded
inventory.low-stockA SKU crosses below threshold
inventory.out-of-stockA SKU hits zero

Components

  • <StockBadge inventory={n} />: storefront badge (“In stock”, “Only X left”, “Out of stock”).
  • <InventoryWidget />: admin inline widget for quick adjustments.