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 collections module groups products into curated sets, such as “Summer Sale”, “New Arrivals”, or “Staff Picks”. You can build collections by hand-picking products (manual) or by writing rule-based conditions that automatically include matching products (automatic). Collections support featured flags, SEO metadata, and drag-and-drop product ordering. Source: modules/collections · npm: @86d-app/collections

Installation

npm install @86d-app/collections
Then register the module in your store’s config.json:
{
  "modules": ["@86d-app/collections"]
}

Configuration

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

const module = collections({
  maxProductsPerCollection: "500",
});
maxProductsPerCollection
string
default:"\"500\""
Maximum number of products allowed in a single collection. Requests that would exceed this limit are rejected.

Store endpoints

Store endpoints are public and return only active collections.
MethodPathDescription
GET/collectionsList active collections, filterable by type and featured flag
GET/collections/featuredGet featured collections
GET/collections/:slugGet a single collection by slug
GET/collections/:slug/productsGet paginated products in a collection
GET/collections/product/:productIdGet all collections containing a specific product

Admin endpoints

Admin endpoints require authentication and return collections of all statuses.
MethodPathDescription
GET/admin/collectionsList all collections, paginated and filterable
GET/admin/collections/statsGet collection statistics
POST/admin/collections/createCreate a new collection
POST/admin/collections/:id/updateUpdate a collection
POST/admin/collections/:id/deleteDelete a collection and all its product associations
GET/admin/collections/:id/productsList products in a collection
POST/admin/collections/:id/products/addAdd products to a collection
POST/admin/collections/:id/products/removeRemove products from a collection
POST/admin/collections/:id/products/reorderReorder products within a collection

Components

Add these components to your MDX template files. The collections module must be listed in config.json.

CollectionList

Renders a grid of all active collections. Fetches its own data; no props required.
<CollectionList />

FeaturedCollections

Renders featured collection cards. Fetches its own data; no props required.
<FeaturedCollections />

Types

type CollectionType = "manual" | "automatic";

type CollectionSortOrder =
  | "manual"
  | "title-asc"
  | "title-desc"
  | "price-asc"
  | "price-desc"
  | "created-asc"
  | "created-desc"
  | "best-selling";

interface Collection {
  id: string;
  title: string;
  slug: string;
  description?: string;
  image?: string;
  type: CollectionType;
  sortOrder: CollectionSortOrder;
  isActive: boolean;
  isFeatured: boolean;
  position: number;
  conditions?: CollectionConditions; // automatic collections only
  seoTitle?: string;
  seoDescription?: string;
  publishedAt?: Date;
  createdAt: Date;
  updatedAt: Date;
}

interface CollectionProduct {
  id: string;
  collectionId: string;
  productId: string;
  position: number;
  addedAt: Date;
}

interface CollectionConditions {
  match: "all" | "any";
  rules: CollectionCondition[];
}

interface CollectionCondition {
  field: string;
  operator:
    | "equals"
    | "not_equals"
    | "contains"
    | "starts_with"
    | "ends_with"
    | "greater_than"
    | "less_than"
    | "in"
    | "not_in";
  value: string | number | string[];
}

interface CollectionStats {
  totalCollections: number;
  activeCollections: number;
  featuredCollections: number;
  manualCollections: number;
  automaticCollections: number;
  totalProducts: number;
}

Notes

  • Slugs must be unique. The create and update endpoints validate for conflicts.
  • Adding a product that already exists in a collection is idempotent. The operation returns the existing entry rather than creating a duplicate.
  • Deleting a collection cascades and removes all associated CollectionProduct records.
  • Automatic collections store conditions as JSON. The runtime evaluates these conditions at query time.
  • Store endpoints return only active collections. Admin endpoints return all collections regardless of status.
  • Products within a collection are ordered by position ascending.