Stakk Docs

Theme SDK

Build a custom storefront with @vinext/storefront.

Published themes run against @vinext/storefront. The package name stays that way; the public product is Stakk.

Install

npm install @vinext/storefront

Init

import storefront from "@vinext/storefront";

storefront.init({
  storeId: "your-shop-slug",
  apiBaseUrl: "https://your-vinext-host",
  checkoutBaseUrl: "https://your-vinext-host",
});

const catalog = await storefront.getStorefront();
const product = await storefront.getProduct("demo_pro-license");

storeId is the shop slug, the same value in /s/{slug}.

Catalog

MethodDescription
getStore()Shop record
getStorefront()Shop + public products + groups
getProducts()Product list
getProduct(idOrSlug)One product
getCategories()Categories on the shop
getShopReviews()Public feedback

Cart

Cart state is stored in localStorage.

storefront.addToCart("PRODUCT_ID", "default", 1, {
  customFields: { username: "florian" },
});

storefront.getCart();
storefront.getCartItemCount();
storefront.removeFromCart("PRODUCT_ID");
storefront.clearCart();

Checkout

await storefront.checkout({
  email: "buyer@example.com",
  coupon: "SAVE10",
  autoRedirect: true,
});

That creates a hosted invoice and returns { redirectUrl }. For a modal on an existing site, use the embed script instead.

Coupons and affiliates

await storefront.validateCoupon("SAVE10", { productId: "PRODUCT_ID" });
await storefront.applyAffiliateCode("PARTNER");

Themes in this repo

Starter themes live in storefront-themes/. Each theme is a Next app that calls this SDK. Upload a zip from Dashboard → Storefront → Themes, or develop against apiBaseUrl pointed at your Stakk host.