README
nacelle-storefront-sdk
The @nacelle/storefront-sdk
is a JavaScript library for easily querying data from your Nacelle space. Its methods wrap common queries for the Nacelle Storefront API (https://storefront.api.nacelle/com/graphql) to accelerate development your headless commerce project.
⚠️ This package is not intended for use with Nacelle's Hail Frequency API (https://hailfrequency.com/v3/graphql)
Features
- Full TypeScript support
- Ships both UMD and tree-shakeable ESM
- Built-in methods for common queries
.query()
method for custom GraphQL queries
Installation
npm install @nacelle/storefront-sdk
Basic Usage
import Storefront from '@nacelle/storefront-sdk';
const token = '<YOUR_NACELLE_STOREFRONT_API_TOKEN>';
const storefrontEndpoint = '<YOUR_NACELLE_STOREFRONT_API_ENDPOINT>';
const client = new Storefront({
token,
storefrontEndpoint,
});
async function getProducts() {
try {
const products = await client.products();
return products;
} catch (e) {
console.error(e);
}
}
getProducts().then((products) => console.log(products));
Local Development
For instructions, see CONTRIBUTING.md.