๐Ÿ›’ Shopify Headless Starter

A lightweight, modern starter kit built with Astro + Svelte and powered by the Shopify Storefront API. Designed for speed, clarity, and full creative control โ€” ideal for developers building performant headless storefronts with minimal setup.

๐ŸŒ Live Demo

https://shopify-headless-demo.netlify.app

โœจ Features

  • โšก๏ธ Fast, SSR-ready setup with Astro and Svelte
  • ๐Ÿ› Product listing and dynamic detail pages
  • ๐ŸŽ› Variant selection with inventory safeguards
  • ๐Ÿ›’ Cart with Shopify-native state persistence
  • ๐Ÿ’ต Utilities for money, images, and formatting
  • ๐ŸŒ Typed API requests (Shopify Storefront API 2025-07)

๐Ÿงฑ Tech Stack


๐Ÿ“ธ Preview

๐Ÿš€ Quick Start

  1. Clone the repo
   git clone https://github.com/LivexTwin/shopify-headless-demo
   cd shopify-headless-demo
  1. Set up environment variables

    cp .env.example .env
    

    .env file must include:

    PUBLIC_SHOPIFY_DOMAIN=your-store.myshopify.com
    PUBLIC_SHOPIFY_TOKEN=your-storefront-api-token
    
  2. Install Dependencies

npm install
  1. Start the development server
npm run dev

๐Ÿ“ Project Structure

shopify-headless-demo/
โ”œโ”€โ”€ public/ # Static assets (favicons, SEO images, etc.)
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ components/ # Svelte components (Cart, ProductCard, etc.)
โ”‚ โ”œโ”€โ”€ layouts/ # Page layouts
โ”‚ โ”œโ”€โ”€ pages/ # Astro pages and route definitions
โ”‚ โ”œโ”€โ”€ styles/ # Global styles
โ”‚ โ”œโ”€โ”€ utils/ # Currency, image formatting, helpers
โ”‚ โ””โ”€โ”€ lib/ # Shopify API client logic
โ”œโ”€โ”€ .env.example # Template for environment variables
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ package.json

๐Ÿ’ก Notes

This starter is intentionally minimal โ€” no heavy UI libraries or styling decisions baked in. It's meant to be a foundation you can shape into a unique, performant eCommerce experience.

This project generates a fully static site by default, so no server adapter is included. Deploy easily on Netlify, Vercel, or any static hosting platform.

For advanced use cases (like server-side rendering, serverless functions, or on-demand rendering), you can add a platform-specific adapter such as @astrojs/netlify or @astrojs/vercel as needed.

Quick Usage Example

Here's a minimal example of how to fetch product data using the built-in Shopify client and display product titles in an Astro page:

---
import { shopifyFetch } from '../lib/shopify.js';
import { GET_PRODUCTS } from '../lib/queries/products.ts';

const data = await shopifyFetch(GET_PRODUCTS);
const products = data.products;
---

<ul>
  {products.map(product => (
    <li>{product.title}</li>
  ))}
</ul>

This example shows how to use the reusable GraphQL query from lib/queries/products.ts and the client in lib/shopify.ts to fetch and render products on a page.


๐Ÿงช API Version

Built using Shopify Storefront API v2025-07.
โ†’ View official docs


๐Ÿ› ๏ธ License

This project is open-source under the MIT License.


Made with โค๏ธ by Anthony

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes