More Premium Hugo Themes Premium React Themes

Swell Js

JS library for building storefronts and checkouts with Swell ecommerce.

Swell Js

JS library for building storefronts and checkouts with Swell ecommerce.

Author Avatar Theme by swellstores
Github Stars Github Stars: 139
Last Commit Last Commit: Jan 27, 2025 -
First Commit Created: Dec 18, 2023 -
default image

Overview:

Swell.js is a headless ecommerce storefront SDK that provides a Universal JavaScript client for Swell’s Frontend API. It allows developers to have client-safe access to store and customer data. This SDK can be used in various applications like JAMstack or SSR apps to perform a range of functions such as fetching products, categories, store settings, nav menus, and custom content; creating, recovering, and updating shopping carts; building custom checkout and subscription flows; authenticating customers and allowing them to edit account details, orders, and subscriptions; resolving linked content to dynamically generate page URLs; and formatting prices in the store’s currency. The SDK is designed to be safe to use in any context, as it implements a subset of operations available in Swell’s Backend API and is authorized with a public key + session token. It is recommended to only use the Backend API server-side and store secret keys as environment variables.

Features:

  • Fetch products, categories, store settings, nav menus, and custom content
  • Create, recover, and update shopping carts
  • Build custom checkout and subscription flows
  • Authenticate customers and allow them to edit account details, orders, and subscriptions
  • Resolve linked content to dynamically generate page URLs
  • Format prices in the store’s currency

Installation:

To install Swell.js, follow these steps:

  1. Install Swell.js via npm or yarn:
npm install @swell-js/swell

or

yarn add @swell-js/swell
  1. Import Swell.js in your application:
import { Swell } from "@swell-js/swell";
  1. Set up Swell with your public key and session token:
const swell = new Swell({
  publicKey: "YOUR_PUBLIC_KEY",
  sessionToken: "YOUR_SESSION_TOKEN",
});
  1. Start using Swell to perform various operations in your application.

Summary:

Swell.js is a versatile SDK for developers to integrate Swell’s ecommerce functionality into their applications. With a range of features, it allows developers to fetch data, manage shopping carts, build checkout and subscription flows, and handle customer authentication and account management. By implementing a subset of operations from Swell’s Backend API and using a public key + session token authorization approach, Swell.js ensures a safe and secure integration. Developers can use this SDK in a variety of application types and easily access store and customer data.