@storesynk/core
v0.1.0-beta.13
Published
Storesynk core: typed Storefront client, cart store, and the client-side standard events/actions runtime.
Maintainers
Readme
@storesynk/core
Typed Shopify Storefront primitives for headless commerce — the framework-agnostic data layer behind Storesynk:
- a public-token Storefront client with typed
gql()queries, - a cart store + rich-cart observable driven by Shopify's standard storefront events/actions,
- a client-side actions runtime (
window.Shopify.actions) so apps and agents integrate the same way they would with a theme.
Built on the Hydrogen developer preview, which it firewalls behind a stable surface.
🧪 Early development — APIs may change.
Install
npm install @storesynk/corePre-1.0 prereleases (
0.1.0-beta.N) are published to npm'slatesttag, so a plain install gets the current release. Do not install@beta: that dist-tag is frozen at an old build.
Usage
import { createStorefront } from '@storesynk/core';
const sf = createStorefront({
storeDomain: 'your-store.myshopify.com',
publicAccessToken: '...', // public Storefront API token
});
// React to cart changes
sf.cart.subscribe((state) => {
console.log(state.data.totalQuantity);
});
// Mutate via the standard action (also fires shopify:cart:* events)
await window.Shopify.actions.updateCart({
lines: [{ merchandiseId: 'gid://shopify/ProductVariant/1', quantity: 1 }],
});What you get
createStorefront()— bootstrap: client + standard-actions runtime + cart store +richCartobservablecreateStorefrontClient()— typed public-token client:client.graphql(doc, { variables })gql()— Hydrogen's typed query syntax (a branded string; zero runtime weight)cartQueries/productQueries— typed query documents (product, collection, search, cart)- cart mutations,
installStandardActions(),formatMoney,createObservable
License
MIT
