Skip to content

smthomas/gatsby-shopify-toy-store-test

Repository files navigation

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, and a shopping cart. All styled with Chakra UI including support for dark mode.

Have another more specific idea? You may want to check out our vibrant collection of official and community-created starters.

🚀 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-starter https://github.com/gatsbyjs/gatsby-starter-shopify
  2. Start developing.

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

    cd my-shopify-starter/
    gatsby develop
  3. 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.

.
├── src
├── static
├── .env.example
├── gatsby-browser.js
├── gatsby-config.js
└── gatsby-node.js
  1. /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”.

  2. /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.

  3. /.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 and shopify-buy client on the frontend working.

  4. 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.

  5. 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).

  6. 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.

.
├── @chakra-ui/gatsby-plugin/theme
├── components
├── context
├── icons
├── images
├── pages
└── utils
  1. /@chakra-ui/gatsby-plugin/theme: Chakra UI is used for styling the page. It exposes themeable pre-built components that can be customized to your liking. The structure for customizing the theme is explained in the Customize Theme document in their documentation (see "Scaling out your project").

  2. /components: Contains the React components used for building out the pages.

  3. /context: Contains the store context (e.g. adding/deleting/updating items in shopping cart, accessing Shopify), and a Chakra UI helpers context (contains theme tokens that Chakra UI currently doesn't interpret correctly).

  4. /icons: Contains the SVG logo.

  5. /images: Contains the images used on the homepage (used with <StaticImage /> component from gatsby-plugin-image).

  6. /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.

  7. /utils: Utility functions, e.g. formatting the price correctly.

🎓 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

Deploy to Netlify

Deploy with Vercel

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published