Skip to main content
The Layers SDK (@commerce-blocks/sdk) is an ES module SDK for product discovery powered by Layers API. It provides reactive state management, built-in caching, and a unified interface for browse, search, recommendations, and image search.

Key features

Layers API Integration

Full access to Layers’ search, browse, recommendations, blocks, and image search APIs with built-in error handling.

Reactive State Management

Framework-agnostic reactive signals for automatic UI updates with built-in caching and request deduplication.

Product Card Controller

Reactive product card management with variant selection, availability logic, and automatic state updates.

Extensibility

Transform products, collections, and search results with custom transforms. Map filter keys for URL-friendly parameters.

Quick start

Client methods

The client provides controllers for all Layers storefront APIs:

Architecture

The SDK uses a controller pattern where each method returns a controller with reactive state and execute methods. All controllers support three ways to consume state:

Next steps

Installation

Learn how to install and configure the SDK in your project.

API Reference

Explore the complete API reference for all SDK methods.

Framework Integration

Patterns for React, Vue, Svelte, Lit, and vanilla JS.

Error Handling

Learn how to handle errors gracefully with the Result pattern.