storefront
Saleor Storefront built with React 18, Next.js 14, App Router, TypeScript, GraphQL, and Tailwind CSS.
Top Related Projects
Next.js Commerce
Building blocks for digital commerce
Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Quick Overview
Saleor Storefront is an open-source e-commerce frontend built with React and Next.js. It's designed to work seamlessly with the Saleor GraphQL API, providing a modern, customizable, and performant shopping experience for customers.
Pros
- Built with modern technologies (React, Next.js, TypeScript)
- Highly customizable and extendable
- Optimized for performance and SEO
- Integrates seamlessly with Saleor's GraphQL API
Cons
- Steep learning curve for developers unfamiliar with React and GraphQL
- Requires separate backend setup (Saleor Core)
- Limited out-of-the-box design customization options
- May require additional development effort for complex e-commerce features
Getting Started
To set up Saleor Storefront locally:
-
Clone the repository:
git clone https://github.com/saleor/storefront.git cd storefront
-
Install dependencies:
pnpm install
-
Set up environment variables:
cp .env.example .env.local
Edit
.env.local
to include your Saleor API URL. -
Run the development server:
pnpm dev
-
Open
http://localhost:3000
in your browser to see the storefront.
Competitor Comparisons
Next.js Commerce
Pros of Commerce
- More flexible e-commerce framework, supporting multiple providers (Shopify, BigCommerce, Swell, etc.)
- Extensive documentation and examples for various use cases
- Optimized for performance with Next.js and Vercel deployment
Cons of Commerce
- Steeper learning curve due to its flexibility and multiple integrations
- Less opinionated structure, which may require more setup and configuration
- Smaller community compared to Saleor ecosystem
Code Comparison
Commerce:
const { products } = await commerce.getAllProducts({
variables: { first: 4 },
})
Storefront:
const { data } = await apolloClient.query({
query: ProductListDocument,
variables: { first: 4 },
})
Both repositories use GraphQL for data fetching, but Commerce offers a more abstracted API layer, while Storefront relies directly on Apollo Client for querying.
Commerce provides a unified interface for multiple e-commerce backends, making it more versatile for different projects. Storefront, being tailored specifically for Saleor, offers a more streamlined experience for developers working within the Saleor ecosystem.
Ultimately, the choice between these repositories depends on project requirements, existing infrastructure, and developer preferences.
Building blocks for digital commerce
Pros of Medusa
- More flexible and customizable backend architecture
- Better support for headless commerce setups
- Stronger focus on developer experience and extensibility
Cons of Medusa
- Smaller community and ecosystem compared to Saleor
- Less mature admin dashboard and frontend components
- Steeper learning curve for non-technical users
Code Comparison
Medusa (Node.js):
const product = await productService.create({
title: "T-Shirt",
variants: [
{ title: "Small", prices: [{ amount: 1000, currency_code: "usd" }] },
{ title: "Medium", prices: [{ amount: 1200, currency_code: "usd" }] }
]
});
Saleor (Python):
product = Product.objects.create(
name="T-Shirt",
product_type=product_type,
category=category,
)
ProductVariant.objects.bulk_create([
ProductVariant(product=product, name="Small", price_amount=10.00),
ProductVariant(product=product, name="Medium", price_amount=12.00)
])
Both repositories offer robust e-commerce solutions, but Medusa focuses more on backend flexibility and headless commerce, while Saleor provides a more comprehensive full-stack solution with a polished storefront. Medusa's code tends to be more modular and event-driven, while Saleor's approach is more traditional and Django-centric.
Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
Pros of Shopware
- More comprehensive e-commerce solution with built-in CMS and ERP features
- Larger community and ecosystem with extensive plugin marketplace
- Supports both B2C and B2B scenarios out of the box
Cons of Shopware
- Steeper learning curve due to its complexity and extensive feature set
- Heavier codebase, potentially impacting performance for smaller projects
- Less flexibility for custom frontend implementations compared to Storefront
Code Comparison
Storefront (React):
const ProductCard = ({ product }) => (
<div className="product-card">
<img src={product.image} alt={product.name} />
<h3>{product.name}</h3>
<p>{product.price}</p>
</div>
);
Shopware (Twig):
{% block component_product_box %}
<div class="product-box">
{% block component_product_box_image %}
{% sw_thumbnails 'product-image-thumbnails' with {
media: product.cover.media
} %}
{% endblock %}
<h3>{{ product.name }}</h3>
<p>{{ product.calculatedPrice.unitPrice|currency }}</p>
</div>
{% endblock %}
The code comparison shows that Storefront uses React for its frontend, allowing for more dynamic and interactive components. Shopware, on the other hand, uses Twig templating, which is more traditional and may be easier for developers familiar with PHP-based systems.
A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Pros of WooCommerce
- Larger community and ecosystem with extensive plugin support
- Seamless integration with WordPress, leveraging its content management capabilities
- More comprehensive out-of-the-box features for various e-commerce scenarios
Cons of WooCommerce
- Heavier codebase, potentially impacting performance for larger stores
- Less flexibility in terms of headless architecture and modern frontend technologies
- Steeper learning curve for developers not familiar with WordPress ecosystem
Code Comparison
WooCommerce (PHP):
add_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
add_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
Saleor Storefront (React):
import { ApolloProvider } from "@apollo/client";
import { BrowserRouter as Router, Route } from "react-router-dom";
import { ProductsList } from "./components/ProductsList";
Summary
WooCommerce offers a robust, WordPress-integrated solution with a vast ecosystem, while Saleor Storefront provides a modern, headless approach with React. WooCommerce excels in traditional setups, whereas Saleor Storefront is more suitable for developers seeking a flexible, API-first architecture. The choice depends on specific project requirements, existing infrastructure, and development team expertise.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Saleor Next.js Storefront
Starter pack for building performant e-commerce experiences with Saleor.Features
- Next.js 14: File-based routing, React 18, Fast Refresh, Image Optimization and more.
- App Router: Uses React Server Components, Data Cache, and async components.
- TypeScript: Strongly typed codebase and GraphQL payloads with strict mode.
- GraphQL best practices: Uses GraphQL Codegen and
TypedDocumentString
to reduce boilerplate and bundle size. - Customizable CSS: TailwindCSS can be extended or replaced with an alternative CSS solution.
- Tooling included: Comes with ESLint, Prettier, Husky, Lint Staged, and Codegen preconfigured.
Global:
- Channel switcher and Geo detection (coming soon)
- Dynamic menu
- Hamburger menu
- SEO data
Checkout:
- Single page checkout (including login)
- Portable to other frameworks (doesn't use Next.js components)
- Adyen integration
- Stripe integration
- Customer address book
- Vouchers and Gift Cards
Product catalog:
- Categories
- Variant selection
- Product attributes
- Image optimization
My account:
- Order history (coming soon)
- Order completion
- Order details
Quickstart
1. Create Saleor backend instance
To quickly get started with the backend, use a free developer account at Saleor Cloud.
Alternatively you can run Saleor locally using docker.
2. Clone storefront
[Option 1] Using Comand line tools
Install or update to the latest version of the Saleor CLI by running the following command:
npm i -g @saleor/cli@latest
Clone storefront, install dependencies, and connect with the provided Saleor instance hostname
saleor storefront create --url https://{SALEOR_HOSTNAME}/graphql/
[Option 2] Manual install
Clone repository:
git clone https://github.com/saleor/storefront.git
Copy environment variables from .env.example
to .env
:
cp .env.example .env
Edit .env
and set NEXT_PUBLIC_SALEOR_API_URL
to your Saleor GraphQL endpoint URL, e.g., https://example.saleor.cloud/graphql/
.
Then, install pnpm
and run the following command to install all dependencies in the repo:
pnpm i
Payments
Currently, Saleor Storefront supports payments via the Saleor Adyen App. To install and configure the payment app go to the "Apps" section in the Saleor Dashboard (App Store is only available in Saleor Cloud).
WARNING: To configure the Adyen App, you must have an account with Adyen.
NOTE: Saleor Stripe App integration is a work in progress.
Development
To start the development server, run the following:
pnpm dev
The app is now running at http://localhost:3000
.
NOTE: Saleor Storefront is a Next.js app. In case you are not familiar with Next.js, we recommend you to read the Next.js documentation (make sure you've selected "Using App Router" in the sidebar).
GraphQL queries and mutations:
After altering or creating new GraphQL queries in gql
folder, you need to run the following command to generate types and javascript queries:
pnpm run generate
Preview content changes instantly (Draft Mode)
Visit http://{your-host}/api/draft
to enable cookies that disable caching to preview catalog and content changes instantly. Learn more about the Draft Mode in Next.js docs.
Top Related Projects
Next.js Commerce
Building blocks for digital commerce
Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot