Skip to content

tentenco/Astro_Webflow_DevLink_Headless-Shopify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Astro + Webflow DevLink + Headless Shopify

Astro React Shopify Webflow Tailwind

A production-ready headless Shopify storefront that syncs UI designs from Webflow DevLink and auto-deploys via GitHub Actions.


✨ Features

  • ⚑ 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

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           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            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 8+
  • Shopify store with Headless channel installed
  • Webflow account with DevLink access (optional)

Installation

# 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 dev

Environment Setup

Create 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

πŸ“ Project Structure

/
β”œβ”€β”€ .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

πŸ› οΈ Development

Commands

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

Webflow DevLink Workflow

  1. Designer creates/updates components in Webflow
  2. Sync components to codebase:
    pnpm devlink:sync
  3. Import in your Astro/React files:
    import { ProductCard } from '@/components/webflow/ProductCard';
  4. 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.


πŸ›οΈ Shopify Integration

Setting Up Shopify

  1. Install the Headless channel in your Shopify admin
  2. Create a new Storefront
  3. Copy the Public and Private access tokens
  4. Configure API scopes:
    • unauthenticated_read_product_listings
    • unauthenticated_read_product_inventory
    • unauthenticated_read_checkouts
    • unauthenticated_write_checkouts

GraphQL Usage

// 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 State

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>
  );
}

🚒 Deployment

Vercel (Recommended)

  1. Connect your GitHub repository to Vercel
  2. Add environment variables in Vercel dashboard
  3. Deploy!
# Or deploy manually
pnpm build
vercel --prod

GitHub Actions

The included workflow (.github/workflows/deploy.yml) automatically:

  1. βœ… Syncs Webflow DevLink components
  2. βœ… Builds the Astro site
  3. βœ… Deploys to Vercel on push to main
  4. βœ… Creates preview deployments for PRs

Webflow Webhook Auto-Deploy

To trigger deployments when designers publish in Webflow:

  1. Set up a webhook in Webflow pointing to:

    https://your-domain.com/api/webhook
    
  2. Add GitHub PAT to your environment:

    GITHUB_PAT=your-github-personal-access-token
    GITHUB_REPO=your-org/your-repo
  3. Webhooks will trigger the repository_dispatch event in GitHub Actions


⚑ Performance

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

Optimization Tips

<!-- 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 />

πŸ§ͺ Testing

# Type checking
pnpm typecheck

# Linting
pnpm lint

# Build test
pnpm build

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Code Style

  • 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 lint before committing

πŸ“š Resources


πŸ“„ License

MIT License - see LICENSE for details.


πŸ™ Acknowledgments


Built with ❀️ using Astro, React, and Shopify

About

Astro + Webflow DevLink + Headless Shopify

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors