Every njX theme follows the same layout, the same commerce layer and the same two-variable Shopify hookup — learn it once, use it for any theme.
unzip astro-njx-<theme>-v1.0.zip
cd astro-njx-<theme>
npm installnpm run dev
# → http://localhost:4321 — full demo catalog, cart,
# filters and account run on bundled mock datanpm run build
# → static site in dist/ — ready for any hostingunauthenticated_read_product_listings,
unauthenticated_read_checkouts), install the app and
copy the Storefront access token.
.env.example to .env and fill in your
store domain and token — that is the entire integration.
# .env (copy from .env.example)
COMMERCE_PROVIDER=shopify
PUBLIC_SHOPIFY_DOMAIN=your-store.myshopify.com
PUBLIC_SHOPIFY_STOREFRONT_TOKEN=shpat_xxxxxxxxxxxxnpm run build now pulls products, collections, prices
and stock from your store. Product pages are generated per item,
and checkout hands off to Shopify's hosted checkout
— payments, taxes and shipping stay on Shopify.
COMMERCE_PROVIDER=mock) to switch back to demo data at
any time.
// src/lib/commerce — one contract, two providers
export interface CommerceProvider {
listProducts(opts?: { collection?: string }): Promise<Product[]>;
getProduct(handle: string): Promise<Product | null>;
listCollections(): Promise<Collection[]>;
checkoutUrl(lines: CartLine[]): Promise<string>;
}
// pages never import a provider directly:
const products = await commerce.listProducts();
// COMMERCE_PROVIDER=mock → bundled JSON catalog
// COMMERCE_PROVIDER=shopify → Storefront GraphQL API// client state — nanostores, persisted to localStorage
import { cartLines, addLine } from '../lib/cart';
import { favorites, toggleFavorite } from '../lib/favorites';
// UI talks through events, never window globals:
document.dispatchEvent(
new CustomEvent('theme:add', { detail: cartLine })
);npm run build
npx wrangler pages deploy dist --project-name my-store
# → https://my-store.pages.dev (attach your domain in the dashboard)dist/ — no server, no
functions required.
# Netlify: build command "npm run build", publish directory "dist"
# Vercel: framework preset "Astro" — zero config
# Any host: dist/ is plain static files — upload anywhere@theme block —
change a few variables and the whole theme follows, including hovers,
gradients and glows.
/* src/styles/global.css — one @theme block drives the whole look */
@theme {
--color-base: #100c09; /* page background */
--color-a1: #ff9a1f; /* primary accent */
--color-a2: #ff4d1f; /* gradient partner */
--font-display: 'Cormorant Garamond', serif;
}src/constants/ (header, footer, page copy)src/data/mock-catalog.jsonpublic/products/PUBLIC_GA4_ID, events fire automaticallydemo-only in
Layout.astro are safe to delete for production
# .env — optional analytics
PUBLIC_GA4_ID=G-XXXXXXXXXX
# GA4 ecommerce events (view_item, add_to_cart, begin_checkout)
# fire automatically once the id is setEvery license includes 12 months of updates and email support for defects and setup questions per this documentation. Write to our contact page or reply to your purchase email — include your theme name and what you tried, and we'll get you unstuck.