Skip to content

Headless SDKs

Beta SDK

These SDKs are currently in beta. APIs may change before stable release.

Hydrogen 1.0 (Legacy)

Using the older @rebuy/rebuy-hydrogen package? See the legacy Hydrogen 1.0 documentation.

Rebuy's headless SDKs provide a modern, TypeScript-first approach to integrating product recommendations and personalization into custom storefronts.

Available SDKs

Package Use Case
@rebuy/core-sdk Framework-agnostic foundation - works in any JavaScript environment
@rebuy/hydrogen-sdk Shopify Hydrogen storefronts with React components and Remix integration

Architecture

The SDK architecture follows a layered approach:

┌─────────────────────────────────────┐
│     @rebuy/hydrogen-sdk             │  ← React components, hooks, Remix helpers
├─────────────────────────────────────┤
│     @rebuy/core-sdk                 │  ← Data fetching, context building, tracking
├─────────────────────────────────────┤
│     Rebuy API                       │  ← Product recommendations, personalization
└─────────────────────────────────────┘
  • Core SDK: Handles all communication with the Rebuy API, context building, and tracking. Use this directly for non-React projects.
  • Hydrogen SDK: Wraps the Core SDK with React-specific components, hooks, and Remix loader helpers. Designed specifically for Shopify Hydrogen storefronts.

Which SDK Should I Use?

Use @rebuy/core-sdk if:

  • You're building with vanilla JavaScript, Vue, Svelte, or another non-React framework
  • You need maximum flexibility and control
  • You're integrating Rebuy into a backend service

Use @rebuy/hydrogen-sdk if:

  • You're building a Shopify Hydrogen storefront
  • You want React components and hooks out of the box
  • You need server-side rendering with cart reactivity

Key Features

Both SDKs support:

  • Product Recommendations: Fetch from standard endpoints (top sellers, trending, similar) or custom Data Sources
  • Context Building: Fluent API for creating rich targeting context with cart, customer, URL, and geolocation data
  • Recently Viewed: Track and display products users have browsed
  • TypeScript Support: Full type definitions for a better developer experience

The Hydrogen SDK additionally provides:

  • React Components: Pre-built RebuyProvider, RebuyProductView, and RecentlyViewed components
  • Remix Integration: getRebuyData helper for server-side rendering in loaders
  • Cart Reactivity: Recommendations automatically update when the cart changes

Core SDK

Hydrogen SDK

See something that needs updating? Suggest an edit