A production-ready headless Shopify storefront that syncs UI designs from Webflow DevLink and auto-deploys via GitHub Actions.
- β‘ Blazing Fast - Static-first with Astro's islands architecture
- π¨ Visual Design Workflow - Designers edit in Webflow, code syncs automatically
- ποΈ Full E-commerce - Products, collections, cart, and Shopify checkout
- π Auto-Deploy - Push to main or publish in Webflow β instant deployment
- π± Responsive - Mobile-first design with Tailwind CSS
- π Type-Safe - Full TypeScript coverage
- π― Performance - 90+ Lighthouse scores out of the box
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DESIGN LAYER β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Webflow β Visual component design & styling β
β Designer β β Exports React components via DevLink β
ββββββββββ¬βββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLI Sync
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β APPLICATION LAYER β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Astro β Static site generation + hybrid SSR β
β React β Interactive components (cart, variants) β
β Nanostores β Lightweight state management β
ββββββββββ¬βββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GraphQL
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA LAYER β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Shopify β Products, collections, inventory β
β Storefront API β Cart management & checkout β
βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DEPLOYMENT LAYER β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β GitHub Actions β CI/CD pipeline with DevLink sync β
β Vercel β Edge deployment + serverless functions β
βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Node.js 20+
- pnpm 8+
- Shopify store with Headless channel installed
- Webflow account with DevLink access (optional)
# Clone the repository
git clone https://github.com/your-org/astro-webflow-shopify.git
cd astro-webflow-shopify
# Install dependencies
pnpm install
# Copy environment variables
cp .env.example .env
# Start development server
pnpm devCreate a .env file with your credentials:
# Shopify Storefront API
PUBLIC_SHOPIFY_SHOP=your-store.myshopify.com
PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN=your-public-token
SHOPIFY_STOREFRONT_ACCESS_TOKEN=your-private-token
SHOPIFY_API_VERSION=2024-01
# Webflow DevLink (optional)
WEBFLOW_TOKEN=your-webflow-token
WEBFLOW_SITE_ID=your-site-id/
βββ .github/
β βββ workflows/
β βββ deploy.yml # Main CI/CD workflow
β βββ preview.yml # PR preview deployments
β
βββ src/
β βββ components/
β β βββ webflow/ # π Auto-generated (DO NOT EDIT)
β β β βββ ProductCard.jsx
β β β βββ Header.jsx
β β β βββ Footer.jsx
β β βββ react/ # Custom React components
β β β βββ CartDrawer.tsx
β β β βββ VariantSelector.tsx
β β β βββ AddToCartButton.tsx
β β βββ astro/ # Astro components
β β βββ ProductGrid.astro
β β βββ CollectionList.astro
β β
β βββ layouts/
β β βββ BaseLayout.astro
β β
β βββ pages/
β β βββ index.astro # Home page
β β βββ cart.astro # Cart page
β β βββ products/
β β β βββ index.astro # Product listing
β β β βββ [handle].astro # Product detail
β β βββ collections/
β β β βββ [handle].astro # Collection page
β β βββ api/
β β βββ webhook.ts # Webflow webhook handler
β β
β βββ lib/
β β βββ shopify/
β β βββ client.ts # GraphQL client
β β βββ queries.ts # Product/collection queries
β β βββ mutations.ts # Cart mutations
β β βββ types.ts # TypeScript definitions
β β
β βββ stores/
β β βββ cart.ts # Cart state (nanostores)
β β
β βββ styles/
β βββ global.css
β βββ webflow.css # DevLink styles
β
βββ devlink/
β βββ devlink.config.js # DevLink configuration
β
βββ scripts/
β βββ sync-webflow.js # DevLink sync script
β
βββ astro.config.mjs
βββ tailwind.config.mjs
βββ tsconfig.json
βββ package.json
| Command | Description |
|---|---|
pnpm dev |
Start development server at localhost:4321 |
pnpm build |
Build for production |
pnpm preview |
Preview production build locally |
pnpm devlink:sync |
Sync components from Webflow |
pnpm devlink:watch |
Watch for Webflow changes |
pnpm typecheck |
Run TypeScript checks |
pnpm lint |
Lint codebase |
- Designer creates/updates components in Webflow
- Sync components to codebase:
pnpm devlink:sync
- Import in your Astro/React files:
import { ProductCard } from '@/components/webflow/ProductCard';
- Wrap with business logic if needed:
// src/components/react/ProductCardWrapper.tsx import { ProductCard } from '@/components/webflow/ProductCard'; import { addToCart } from '@/stores/cart'; export function ProductCardWrapper({ product }) { return ( <ProductCard {...product} onAddToCart={() => addToCart(product.variantId, 1)} /> ); }
β οΈ Important: Never manually edit files in/src/components/webflow/- they will be overwritten on sync.
- Install the Headless channel in your Shopify admin
- Create a new Storefront
- Copy the Public and Private access tokens
- Configure API scopes:
unauthenticated_read_product_listingsunauthenticated_read_product_inventoryunauthenticated_read_checkoutsunauthenticated_write_checkouts
// Fetch products
import { shopifyClient } from '@/lib/shopify/client';
import { GET_PRODUCTS } from '@/lib/shopify/queries';
const { products } = await shopifyClient.request(GET_PRODUCTS, {
first: 12,
});
// Add to cart
import { addToCart } from '@/stores/cart';
await addToCart(variantId, quantity);Cart is managed client-side with nanostores:
import { useStore } from '@nanostores/react';
import { $cart, $cartItemCount, $isCartOpen } from '@/stores/cart';
function CartIcon() {
const itemCount = useStore($cartItemCount);
const isOpen = useStore($isCartOpen);
return (
<button onClick={() => $isCartOpen.set(true)}>
Cart ({itemCount})
</button>
);
}- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy!
# Or deploy manually
pnpm build
vercel --prodThe included workflow (.github/workflows/deploy.yml) automatically:
- β Syncs Webflow DevLink components
- β Builds the Astro site
- β
Deploys to Vercel on push to
main - β Creates preview deployments for PRs
To trigger deployments when designers publish in Webflow:
-
Set up a webhook in Webflow pointing to:
https://your-domain.com/api/webhook -
Add GitHub PAT to your environment:
GITHUB_PAT=your-github-personal-access-token GITHUB_REPO=your-org/your-repo
-
Webhooks will trigger the
repository_dispatchevent in GitHub Actions
This template is optimized for performance:
| Metric | Target | How |
|---|---|---|
| LCP | < 2.5s | Static generation, optimized images |
| FID | < 100ms | Minimal client JS, islands architecture |
| CLS | < 0.1 | Proper image dimensions, no layout shifts |
| TTI | < 3.5s | client:visible for below-fold components |
<!-- Use client:visible for non-critical interactivity -->
<ProductCard client:visible product={product} />
<!-- Use client:idle for secondary features -->
<RecentlyViewed client:idle />
<!-- Use client:load only when immediately needed -->
<CartDrawer client:load /># Type checking
pnpm typecheck
# Linting
pnpm lint
# Build test
pnpm build- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Use TypeScript for all new files
- Follow existing patterns for Shopify queries/mutations
- Never edit
/src/components/webflow/directly - Add JSDoc comments for complex functions
- Run
pnpm lintbefore committing
- Astro Documentation
- Shopify Storefront API Reference
- Webflow DevLink Documentation
- Nanostores Documentation
- Tailwind CSS Documentation
MIT License - see LICENSE for details.
- thomasKn/astro-shopify - Original Astro Shopify starter
- Webflow - DevLink visual development
- Shopify - Headless commerce platform
Built with β€οΈ using Astro, React, and Shopify