A modern headless ecommerce storefront built with Next.js 14, TypeScript, CSS Modules, and Shopify Storefront API—featuring AI-powered product recommendations via integrated chatbot.
🎯 Live Demo — Visit the production site
- ⚡ Next.js 14 App Router - Latest React features with Server Components
- 🎨 CSS Modules - Component-scoped styling
- 📱 Fully Responsive - Mobile-first design
- 🛍️ Shopify Storefront API - Direct integration with Shopify
- 🔍 TypeScript - Type-safe development
- 🖼️ Optimized Images - Next.js Image component with CDN
- ⚡ Fast Performance - 99.9% CLS reduction (0.028 score), 0ms Total Blocking Time
- 🎯 SEO Optimized - Meta tags and structured data
- 🤖 AI Chatbot - GPT-4 powered product search & recommendations (see CHATBOT.md)
- Node.js 18+ installed
- A Shopify store (development or production)
- Shopify Storefront API access token
First, you need to create a Storefront API access token in your Shopify admin:
- Go to your Shopify Admin
- Navigate to Settings → Apps and sales channels → Develop apps
- Click Create an app (or use an existing one)
- Go to API credentials tab
- Under Storefront API, click Configure
- Enable the following permissions:
- Read products
- Read product listings
- Read customer tags
- Read inventory
- Click Save
- Go back to API credentials and copy the Storefront API access token
- Clone or navigate to this project directory:
git clone https://github.com/odanree/shopify-ecommerce.git
cd shopify-ecommerce- Install dependencies:
npm install- Create a
.env.localfile in the root directory:
cp .env.local.example .env.local- Edit
.env.localand add your Shopify credentials:
SHOPIFY_STORE_DOMAIN=your-store.myshopify.com
SHOPIFY_STOREFRONT_ACCESS_TOKEN=your_storefront_access_token_here
SHOPIFY_ADMIN_API_TOKEN=your_admin_api_token_here
SHOPIFY_LOCATION_ID=your_location_id_hereNote:
SHOPIFY_ADMIN_API_TOKENandSHOPIFY_LOCATION_IDare only needed if you want to use the product management scripts.
If your store is empty, you can create demo products using our automated scripts:
# Create 10 tech-themed t-shirt products
npx tsx scripts/create-products.ts
# Publish them to the headless storefront channel
npx tsx scripts/publish-to-channel.ts
# Verify they're visible
npx tsx scripts/verify-products.tsOr manually create products in your Shopify Admin and make sure to publish them to the "headless storefront" sales channel.
See scripts/README.md for more details.
npm run devOpen http://localhost:3000 to see your store.
.
├── app/ # Next.js App Router pages
│ ├── layout.tsx # Root layout with header/footer
│ ├── page.tsx # Homepage
│ ├── products/ # Products pages
│ │ ├── page.tsx # All products listing
│ │ └── [handle]/ # Individual product page
│ ├── cart/ # Shopping cart
│ └── api/ # API routes
├── components/ # React components
│ ├── Header.tsx
│ ├── Footer.tsx
│ ├── ProductCard.tsx
│ ├── AddToCart.tsx
│ └── FamilyPlanBuilder.tsx # Premium feature demo
├── lib/ # Utility functions
│ └── shopify.ts # Shopify API client
├── types/ # TypeScript type definitions
│ └── shopify.ts
├── public/ # Static assets
├── contexts/ # React Context for state management
│ └── CartContext.tsx # Shopping cart state
├── cypress/ # E2E tests
│ └── e2e/ # Test files
├── docs/ # Documentation
│ ├── CHATBOT.md # AI chatbot architecture & integration
│ └── ...
├── next.config.js # Next.js configuration
├── tsconfig.json # TypeScript configuration
└── cypress.config.ts # Cypress configuration
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLint
npm run cypress- Open Cypress test runnernpm run test:e2e- Run E2E tests (requires dev server running)npm run test:e2e:ci- Run E2E tests in CI mode
npx tsx scripts/create-products.ts- Create 10 tech-themed t-shirt productsnpx tsx scripts/publish-to-channel.ts- Publish products to headless storefrontnpx tsx scripts/verify-products.ts- Verify products are visible in Storefront APInpx tsx scripts/delete-products.ts- Delete all products (use with caution!)
See scripts/README.md for detailed script documentation.
import { getProducts } from '@/lib/shopify';
const products = await getProducts();import { getProduct } from '@/lib/shopify';
const product = await getProduct('product-handle');import { createCart, addToCart } from '@/lib/shopify';
// Create a new cart
const cart = await createCart();
// Add item to cart
const updatedCart = await addToCart(cart.id, variantId, quantity);This project uses CSS Modules for component-scoped styling:
components/*.module.css- Component-specific stylesapp/globals.css- Global styles and CSS variables- Create new
.module.cssfiles for new components
- Search - Implement product search using Shopify Search API
- Collections - Add collection pages
- Customer Accounts - Integrate customer login/register
- Checkout - Customize checkout experience
- Wishlist - Add product wishlist functionality
This project is configured for automatic deployment to Vercel with GitHub integration.
Quick Deploy:
Manual Setup with Auto-Deploy:
📖 See VERCEL_DEPLOYMENT.md for complete step-by-step instructions
Quick Overview:
- Push your code to GitHub (already done ✅)
- Import project in Vercel
- Root directory is already set to repo root (no subdirectory needed!)
- Add environment variables:
SHOPIFY_STORE_DOMAINSHOPIFY_STOREFRONT_ACCESS_TOKEN
- Deploy!
Auto-Deploy Features:
- ✅ Every push to
mainbranch deploys to production - ✅ Pull requests get automatic preview deployments
- ✅ Instant rollback to previous versions
- ✅ Built-in CI/CD pipeline
This Next.js app can be deployed to:
- Netlify
- AWS Amplify
- Cloudflare Pages
- Any Node.js hosting
Make sure to set environment variables on your hosting platform.
- Image Optimization: Uses Next.js Image component
- Caching: API responses cached for 60 seconds
- Static Generation: Product pages pre-rendered at build time
- Code Splitting: Automatic code splitting with App Router
The project is fully typed with TypeScript. Main types are in types/shopify.ts:
ShopifyProduct- Product data structureShopifyVariant- Product variantShopifyCart- Cart data structureShopifyCartLine- Cart line item
- Verify your
.env.localfile has correct credentials - Check your Storefront API token is valid
- Ensure your store domain is correct (include
.myshopify.com)
- Verify
next.config.jshas Shopify CDN inremotePatterns - Check products have featured images in Shopify admin
- Run
npm installto ensure all dependencies are installed - Delete
.nextfolder and rebuild - Check Node.js version (18+ required)
- 🤖 AI Chatbot Documentation - Architecture, integration, and customization
- Next.js Documentation
- Shopify Storefront API
- TypeScript Documentation
- Cypress Documentation
- CSS Modules Documentation
- Vercel Deployment Guide
For issues or questions:
- Check Shopify Dev Forums
- Review Next.js Documentation
MIT License - feel free to use this for your projects! Wed Feb 4 11:44:51 PST 2026