A Gatsby starter using the latest Shopify plugin showcasing a store with product overview, individual product pages, and a cart

Overview

Gatsby

Gatsby Starter Shopify

Kick off your next Shopify project with this boilerplate. This starter creates a store with a custom landing page, individual filtered views for each product, detailed product pages, advanced instant search and a shopping cart. All styled with CSS Modules.

Deploy this starter with one click on Gatsby Cloud:

Deploy to Gatsby Cloud

Check out the demo site showcasing a proof-of-concept with 10k products and 30k variants.

πŸš€ Quick start

  1. Create a Gatsby site.

    Use the Gatsby CLI to create a new site, specifying the Shopify starter.

    # create a new Gatsby site using the Shopify starter
    gatsby new my-shopify-store https://github.com/gatsbyjs/gatsby-starter-shopify
  2. Link to your store

    Follow these instructions here to link your Shopify store. If you want to try with a development store, see the sample data and instructions here.

  3. Start developing.

    Navigate into your new site’s directory and start it up.

    cd my-shopify-starter/
    gatsby develop
  4. Open the source code and start editing!

    Your site is now running at http://localhost:8000!

    Note: You'll also see a second link: http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

    Open the my-shopify-starter directory in your code editor of choice and edit src/pages/index.jsx. Save your changes and the browser will update in real time!

🧐 What's inside?

A quick look at the top-level files and directories you'll see in this project.

.
β”œβ”€β”€ example
β”œβ”€β”€ src
β”œβ”€β”€ static
β”œβ”€β”€ .env.example
β”œβ”€β”€ gatsby-browser.js
β”œβ”€β”€ gatsby-config.js
└── gatsby-node.js
  1. /example: This directory includes a CSV file containing sample data to import into a development store. There are also instructions on generating your own sample data, and a link to a dataset with 30,000 SKUs.

  2. /src: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src is a convention for β€œsource code”.

  3. /static: Every file in this directory will be copied over to the public folder during the build. Learn more about using the static folder. In this project it holds the og:image and favicons.

  4. /.env.example: Duplicate this file, rename it to .env, and fill out the keys. You'll need to define those environment variables to get the source plugin, cart and search working.

  5. gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser. In this project it wraps the whole application with the context provider of the store/shopping cart.

  6. gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail).

  7. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process. In this project it adds a custom Babel plugin to Gatsby.

Detailed look into src

The whole logic for how the site looks and behaves is inside src.

.
β”œβ”€β”€ components
β”œβ”€β”€ context
β”œβ”€β”€ icons
β”œβ”€β”€ images
β”œβ”€β”€ pages
β”œβ”€β”€ styles
└── utils
  1. /components: Contains the React components used for building out the pages.

  2. /context: Contains the store context (e.g. adding/deleting/updating items in shopping cart, accessing Shopify), and the urql context used for search using Shopify's Storefront API.

  3. /icons: Contains all custom SVG icons and the logo.

  4. /pages: Contains the homepage and all automatically generated pages for each product category and individual product pages. The File System Route API is used to create those pages from your Shopify data.

  5. /styles: Contains globals styles. These are variables.css, used to define shared CSS custom properties, reset.css, which contains a CSS reset based on Chakra, and global.css, which includes a tiny set of global styles.

  6. /utils: Utility functions, e.g. formatting the price correctly, plus custom hooks used for handling search and pagination.

🎨 Styling

The site uses CSS Modules for styling, which allows you to use regular CSS, scoped to the individual component. Theme values such as fonts, colors and spacing are set in src/styles/variables.css.

πŸŽ“ Learning Gatsby

Looking for more guidance? Full documentation for Gatsby lives on the website. Here are some places to start:

  • For most developers, we recommend starting with our in-depth tutorial for creating a site with Gatsby. It starts with zero assumptions about your level of ability and walks through every step of the process.

  • To dive straight into code samples, head to our documentation. In particular, check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.

πŸ’« Deploy

Build, Deploy, and Host On The Only Cloud Built For Gatsby

Gatsby Cloud is an end-to-end cloud platform specifically built for the Gatsby framework that combines a modern developer experience with an optimized, global edge network.

You might also like...

React Starter Kit β€” isomorphic web app boilerplate (Node.js, Express, GraphQL, React.js, Babel, PostCSS, Webpack, Browsersync)

React Starter Kit β€” isomorphic web app boilerplate (Node.js, Express, GraphQL, React.js, Babel, PostCSS, Webpack, Browsersync)

React Starter Kit β€” "isomorphic" web app boilerplate React Starter Kit is an opinionated boilerplate for web development built on top of Node.js, Expr

Jan 1, 2023

Hi there! This is a react native starter which used to build a awesome Event Booking App based on the Figma design. You can download or clone it to speed up your projects.

Hi there! This is a react native starter which used to build a awesome Event Booking App based on the Figma design. You can download or clone it to speed up your projects.

mcrn-event-booking-app-starter Hi there! This is a react native starter which used to build a awesome Event Booking App based on the Figma design. You

Dec 19, 2022

The deck, starter project, & final demo for @lachlanjc’s talk at PrideMakers 2021.

PrideMakers 2021 The deck, starter project, & final demo for @lachlanjc’s talk at PrideMakers 2021. Starter on Glitch: https://glitch.com/~pridemakers

Sep 24, 2021

A full-stack dApp starter built on Ethereum (Solidity) with Next.js (React).

A full stack dApp starter built on Ethereum (Solidity) with Next.js (React) This repo contains boilerplate code for interacting with a simple smart co

Dec 30, 2022

Next.js + Tailwind CSS + TypeScript starter packed with useful development features

Next.js + Tailwind CSS + TypeScript starter packed with useful development features

πŸ”‹ ts-nextjs-tailwind-starter Next.js + Tailwind CSS + TypeScript starter packed with useful development features. Made by Theodorus Clarence Features

Nov 12, 2022

Fastify + Typescript starter

Fastify + Typescript starter A really basic API template powered by: Fastify Typescript EsLint + Prettier Jest + Supertest Available scripts: npm run

Aug 24, 2022

NextJS Starter Example for Running Zesty.io CMS

NextJS Starter Example for Running Zesty.io CMS

Zesty.io + NextJS Getting Started Node and NPM need to be installed. From your command line.

Dec 8, 2022

An embedded app starter template with all the required stuff hooked up.

Shopify Node.js x Express.js x React.js Boilerplate An embedded app starter template to get up and ready with Shopify app development with JavaScript.

Dec 25, 2022

A starter for nextjs that pulls in tailwindui, graphql

NextJS TypeScript TailwindUI GraphQL Boilerplate Demonstrates a NextJS application with TypeScript and TailwindUI with a ASP.Net Core GraphQL based AP

Nov 17, 2022
Owner
Brent Jackson
Building @system-ui @styled-system, @rebassjs, MDX Deck
Brent Jackson
A boilerplate to kick off any Gatsby project.

A boilerplate to kick off any Gatsby project. This starter ships with: - Gatsby v4 - Material UI v5 with light/dark mode and a custom theme - Emotion JS (with access to Material UI custom theme) - React redux (with reduxjs/toolkit) - React intl for multilingual support - React helmet for SEO

Mario Duarte 1 Jul 6, 2022
πŸš€ A well-structured boilerplate and Starter for Next.js 12+, Tailwind CSS 3, Redux, Redux Thunk, and TypeScript

?? A well-structured boilerplate and Starter for Next.js 12+, Tailwind CSS 3, Redux, Redux Thunk, and TypeScript ⚑️ Made with developer experience first ESLint + Prettier + Lint-Staged + VSCode setup

null 4 Nov 28, 2022
React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in

A comprehensive starter kit for rapid application development using React. Why Slingshot? One command to get started - Type npm start to start develop

Cory House 9.8k Jan 3, 2023
Starter Project for Nuxt3 project with full tailwind3 implementation and also docker & docker-compose supprt

Nuxt 3 & Tailwind 3 Starter Including tailwindConfig and Tailwind Config Viewer! Be patient, this is just a Beta version of Nuxt3. For Nuxt3 Installat

Michel WΓ€chter 42 Nov 10, 2022
A Remix starter with intuitive defaults, like support for internationalization and localized URLs

?? Remix Starter A Remix starter with intuitive defaults, like support for internationalization and localized URLs. Coming soon: Authentication and au

Anand Chowdhary 51 Jan 8, 2023
A simple Vue3, Nuxt3 and Tailwind3 Starter Template

Nuxt 3 + Tailwind CSS 3 Starter This is a minimal starter template for Nuxt 3 projects with Tailwind CSS 3. It includes a simple template pages/index.

Rizkhal 1 Feb 11, 2022
A Next + TypeScript Starter. Featuring Styled-Components, ESLint, Prettier, Axe a11y monitoring, Fathom analytics, sitemap generation, and more!

Next + TypeScript Starter A Next + TypeScript Starter by Justin Juno. Featuring Styled-Components, ESLint, Prettier, Axe a11y monitoring, Fathom analy

Justin Juno 11 Dec 13, 2022
A starter project to run your local server, and start sending voice packets to Deepgram

A starter project to run your local server, and start sending voice packets to Deepgram

Filip Grebowski 7 Sep 30, 2022
A highly opinionated and complete starter for Next.js projects ready to production

The aim for this starter is to give you a starting point with everything ready to work and launch to production. Web Vitals with 100% by default. Folder structure ready. Tooling ready. SEO ready. SSR ready.

Fukuro Studio 28 Nov 27, 2022
Minimal Electron Starter Kit built with Typescript, React, Webpack 5 and Babel 7

electron-webpack-boilerplate Minimal Electron Starter Kit built with Typescript, React, Webpack 5 and Babel 7 To create a JS library, check out js-lib

Francisco Hodge 10 Aug 16, 2022