Skip to content
Saleor
Esc
↑↓navigate↵open⌘Jpreview
On this page

Storefront

This guide will help you set up Paper, Saleor’s storefront, in your local environment.

The storefront is a Next.js application. It requires Saleor 3.23 or later and Node.js 24.

Install project

Clone repo and install dependencies.

git clone https://github.com/saleor/storefront.git saleor-storefront
cd saleor-storefront
pnpm i

Copy variables

Copy environment variables from .env.example to .env:

cp .env.example .env

Add backend URL

Use a free sandbox at Saleor Cloud to start quickly with the backend. Alternatively, you can run Saleor locally using Docker.

# Add backend address
# Make sure to add slash at the end:
NEXT_PUBLIC_SALEOR_API_URL=https://{your_domain}.saleor.cloud/graphql/

# Local example
# NEXT_PUBLIC_SALEOR_API_URL=http://localhost:8000/graphql/

# Channel slug from Dashboard → Configuration → Channels
NEXT_PUBLIC_DEFAULT_CHANNEL=default-channel

Run project

Run the development server.

pnpm run dev

Edit a product

  1. Find any product page in the storefront
  2. Go to the dashboard of your Saleor instance and change that product information, such as name, price, or description.
  3. Refresh the product page in the storefront; notice that information has not changed. Product pages are cached and refreshed at most once an hour.
  4. To see changes right away, install the Paper app from Dashboard → Extensions (Saleor Cloud only). It sets up webhooks that refresh the cached page when you save a product.

Edit a query

  1. In src/graphql folder, find a query you want to edit. For example add field rating to ProductDetails.graphql.
  2. Generate types and queries by running the following command:

This would update types and queries for the new field, which we will use in the next step. Queries used by the checkout are generated with pnpm run generate:checkout.

pnpm run generate

Update product page

  1. Open src/app/(storefront)/[locale]/[channel]/(main)/products/[slug]/page.tsx file.
  2. You will be able now to render the newly added field rating in the product page. Notice that the new field can be autocompleted by Typescript.

async function ProductShell({ params: paramsPromise }) {
    // ...
    const rating = product.rating;
    // ...
}

Next steps:

Follow API guide to learn how to interact with the Saleor API.

Last updated on

Was this page helpful?