saleor / storefront

Saleor Storefront built with React 18, Next.js 14, App Router, TypeScript, GraphQL, and Tailwind CSS.
https://storefront.saleor.io
BSD 3-Clause "New" or "Revised" License
1.06k stars 597 forks source link
cart checkout e-commerce ecommerce graphql hacktoberfest headless nextjs nextjs-commerce nextjs-storefront open-source react react-storefront saleor saleor-checkout saleor-storefront tailwindcss typescript

Deploy with Vercel Storefront Demo

Nextjs Storefront

Saleor Next.js Storefront

Starter pack for building performant e-commerce experiences with Saleor.
Website Docs Roadmap Twitter Discord


[![Storefront Roadmap](https://img.shields.io/badge/ROADMAP-EFEFEF?style=for-the-badge)](https://github.com/orgs/saleor/projects/45/views/2) [![Discord Badge](https://dcbadge.vercel.app/api/server/H52JTZAtSH)](https://discord.gg/H52JTZAtSH)

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

Features

Global:

Checkout:

Product catalog:

My account:

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.