Skip to content
Back to Templates

Next.js Saleor Commerce

Saleor Storefront built with React 18, Next.js 14, App Router, TypeScript, GraphQL, and Tailwind CSS.

Saleor Template Image

[!TIP] Questions or issues? Check our Discord for help.

Why Paper?

Ship faster, customize everything. Paper is a new releaseβ€”expect some rough edgesβ€”but every component is built with real-world e-commerce in mind. This is a foundation you can actually build on.

πŸ›’ Checkout That Actually Works

The checkout is where most storefronts fall apart. Paper's doesn't.

  • Multi-step, mobile-first β€” Each step is a focused form. No infinite scrolling on phones.
  • Guest & authenticated β€” Seamless flow for everyone. Logged-in users get address book and saved preferences.
  • International address forms β€” Country-aware fields that adapt (US states, UK postcodes, German formats).
  • Connection resilience β€” Automatic retries with exponential backoff. Flaky networks? Handled.
  • Componentized architecture β€” Swap steps, add steps, remove steps. It's your checkout.
  • Multi-channel ready β€” Different currencies and shipping zones per channel.

🌍 Multi-Channel, Multi-Currency

One codebase, many storefronts. Channel-scoped routing means /us/products and /eu/products can serve different catalogs, prices, and shipping optionsβ€”all from the same deployment.

πŸ“± Product Pages Done Right

The hard parts are solved. Adapt the look, keep the logic.

  • Multi-attribute variant selection β€” Color + Size + Material? Handled. Complex variant matrices just work.
  • Dynamic pricing β€” Sale prices, variant-specific pricing, channel pricingβ€”all reactive.
  • Image gallery β€” Next.js Image optimization, proper aspect ratios, keyboard navigation.

β™Ώ Accessibility Built In

Not an afterthought. Focus management on step transitions, keyboard navigation everywhere, semantic HTML, proper ARIA labels. Everyone deserves to shop.

πŸ€– AI-Ready Codebase

Built for front-end developers and AI agents. The codebase includes:

  • AGENTS.md β€” Architecture overview and quick reference for AI assistants
  • Skills system β€” Task-specific guides in .claude/skills/ for GraphQL workflows, component patterns, variant selection, and more
  • Consistent patterns β€” Predictable structure that AI tools can navigate and modify confidently

Whether you're pair-programming with Cursor, Claude, or Copilotβ€”the codebase is designed to help them help you.

⚑ Bleeding Edge Stack

  • Next.js 16 with App Router and Server Components
  • React 19 with the latest concurrent features
  • TypeScript in strict modeβ€”your IDE will thank you
  • Tailwind CSS with design tokens (OKLCH colors, CSS variables)
  • GraphQL Codegen for type-safe Saleor API calls

What's in the Box

FeatureDescription
CheckoutMulti-step flow with guest/auth support, address selector, international forms
CartSlide-over drawer with real-time updates, quantity editing
Product PagesMulti-attribute variants, image gallery, sticky add-to-cart
Product ListingsCategory & collection pages with pagination
NavigationDynamic menus from Saleor, mobile hamburger
SEOMetadata, JSON-LD, Open Graph images
CachingISR with on-demand revalidation via webhooks
AuthenticationLogin, register, password reset, order history
API ResilienceAutomatic retries, rate limiting, timeoutsβ€”handles flaky connections gracefully

Caching Architecture

Paper uses Cache Components (Partial Prerendering) for optimal performanceβ€”static shells load instantly while dynamic content streams in. Learn more in the Next.js documentation or see .claude/skills/caching-strategy/SKILL.md for project-specific implementation details.

The display-cached, checkout-live model ensures fast browsing with accurate checkout:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DATA FRESHNESS β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ Product Pages Cart / Checkout Payment β”‚
β”‚ ────────────── ────────────── ─────── β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ CACHED │────────▢│ LIVE │─────────▢│ LIVE β”‚ β”‚
β”‚ β”‚ 5 min β”‚ Add β”‚ Always β”‚ Pay β”‚ Always β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ to β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ Cart β”‚
β”‚ Fast page loads Real-time prices Saleor validates β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How It Works

ComponentFreshnessWhy
Product pagesCached (5 min TTL)Instant loads, great Core Web Vitals
Category/CollectionCached (5 min TTL)Fast browsing experience
Cart drawerAlways liveSaleor API with cache: "no-cache"
CheckoutAlways liveDirect API calls, real-time totals

Instant Updates with Webhooks

Configure Saleor webhooks to invalidate cache immediately when data changes:

  1. Create webhook in Saleor Dashboard β†’ Configuration β†’ Webhooks
  2. Point to https://your-store.com/api/revalidate
  3. Subscribe to PRODUCT_UPDATED, CATEGORY_UPDATED, etc.
  4. Set SALEOR_WEBHOOK_SECRET env var

Without webhooks? TTL handles itβ€”cached data expires naturally after 5 minutes.

Why This Is Safe

  • Saleor is the source of truth: checkoutLinesAdd calculates prices server-side
  • Cart always fetches fresh: Users see current prices before checkout
  • Payment validates: checkoutComplete uses real-time data

πŸ“š Deep dive: See .claude/skills/caching-strategy/SKILL.md for the full architecture, Cache Components (PPR), webhook setup, and debugging guide.

Quick Start

1. Get a Saleor Backend

Option A: Free Saleor Cloud account (recommended)

Option B: Run locally with Docker

2. Clone & Configure

# Using Saleor CLI (recommended)
npm i -g @saleor/cli@latest
saleor storefront create --url https://{YOUR_INSTANCE}/graphql/
# Or manually
git clone https://github.com/saleor/storefront.git
cd storefront
cp .env.example .env
pnpm install

Edit .env with your Saleor instance details:

NEXT_PUBLIC_SALEOR_API_URL=https://your-instance.saleor.cloud/graphql/
NEXT_PUBLIC_DEFAULT_CHANNEL=default-channel # Your Saleor channel slug

Finding your channel slug: In Saleor Dashboard β†’ Configuration β†’ Channels β†’ copy the slug

3. Run

pnpm dev

Open localhost:3000. That's it.

Development

Commands

pnpm dev # Start dev server
pnpm build # Production build
pnpm run generate # Regenerate GraphQL types (storefront)
pnpm run generate:checkout # Regenerate GraphQL types (checkout)

Project Structure

src/
β”œβ”€β”€ app/ # Next.js App Router
β”‚ β”œβ”€β”€ [channel]/ # Channel-scoped routes
β”‚ └── checkout/ # Checkout pages
β”œβ”€β”€ checkout/ # Checkout components & logic
β”œβ”€β”€ graphql/ # GraphQL queries
β”œβ”€β”€ gql/ # Generated types (don't edit)
β”œβ”€β”€ ui/components/ # UI components
β”‚ β”œβ”€β”€ pdp/ # Product detail page
β”‚ β”œβ”€β”€ plp/ # Product listing page
β”‚ β”œβ”€β”€ cart/ # Cart drawer
β”‚ └── ui/ # Primitives (Button, Badge, etc.)
└── styles/brand.css # Design tokens

For AI Agents

If you're working with AI coding assistants, point them to:

  • AGENTS.md β€” Architecture, commands, gotchas
  • .claude/skills/ β€” Task-specific guides (GraphQL, components, checkout, etc.)

Environment Variables

# Required
NEXT_PUBLIC_SALEOR_API_URL=https://your-instance.saleor.cloud/graphql/
# Optional
NEXT_PUBLIC_STOREFRONT_URL= # For canonical URLs and OG images
REVALIDATE_SECRET= # Manual cache invalidation
SALEOR_WEBHOOK_SECRET= # Webhook HMAC verification
SALEOR_APP_TOKEN= # For channels query

Payments

The checkout architecture supports Saleor payment apps like Adyen and Stripe. The heavy lifting is doneβ€”integrating your gateway requires minimal work compared to building from scratch.

Customization

Paper works as a reference implementation and as a starting point for your own storefront. Start here:

  • Colors & typography β†’ src/styles/brand.css
  • Components β†’ src/ui/components/
  • Checkout flow β†’ src/checkout/views/SaleorCheckout/

The design token system uses CSS custom propertiesβ€”swap the entire color palette by editing a few lines.

Next Steps

Features planned for future development:

  • Filtering logic iteration. Fetching attributes from API for dynamic product filters.
  • Customer Profile. Implementing new Past Orders and Address Book for signed-in customers.
  • Paper App. Iteration on the revalidation logic and supported webhooks, providing a Preview in storefront feature in Saleor Dashboard.
  • Opinionated model for standard content. Moving currently hardcoded stuff like Credibility or Free checkout information to API models.

License

FSL-1.1-ALv2 (Functional Source License, Version 1.1, ALv2 Future License) β€” use it, modify it, ship it. Build your storefront, run your business. The license converts to Apache 2.0 after two years.

Want to offer it as a managed service? Let's talk.

Next.js Saleor Commerce Starter Template