• Stars
    star
    727
  • Rank 62,329 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nextjs + Tailwind CSS + Shopify Starter

Next.js + Tailwind CSS + Shopify Starter

This is a fully functional eCommerce store that uses Next.js + Tailwind CSS in the front end and leverages the Shopify Storefront API to interact with your Shopify backend. You can see a Live Demo here.

We use GraphQL to query our Shopify data and store the cart information in localStorage to persist user session. Finally - we use Shopify Checkout to let the user purchase the items. You can see this play out in the example store. Yes - the store is functional and you can buy the stickers. 😃

High Performance

Desktop Mobile

Mobile Responsive

Listings Cart

The Tech

  • Next.js + Tailwind CSS
  • GraphQL
  • localStorage to persist user session
  • Shopify
  • Vercel
  • Font Awesome Icons
  • Josefin Sans Google Font

How to use

By default, the store is set to query and show all products in one collection. You can extend this to query multiple collections or your whole store.

A note on pagination in the GraphQL queries

The graphQL queries are all hardcoded to pull the maximum number of products/variants/images which is set to 250 by Shopify. I did this to keep things simple. Pagination would have made the queries complicated and 250 items is enough for most use cases.

If you require pagination you will have to keep track of the cursor field and keep querying the data until you fetch all items.

Setup Environment variables

Create a .env.local file in the root directory. You need to add these 4 variables:

NEXT_PUBLIC_SHOPIFY_STORE_FRONT_ACCESS_TOKEN=
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN=
NEXT_PUBLIC_SHOPIFY_COLLECTION=
NEXT_PUBLIC_LOCAL_STORAGE_NAME=

The NEXT_PUBLIC_SHOPIFY_STORE_FRONT_ACCESS_TOKEN and NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN (it will be something like DOMAIN_NAME.myshopify.com) are needed to access the Shopify Storefront API (make sure you have set it up in your Shopify store. See docs for more information.

NEXT_PUBLIC_SHOPIFY_COLLECTION is the name of the collection you want to pull in and NEXT_PUBLIC_LOCAL_STORAGE_NAME is the name of the key your users will store their cart information under. The exact name isn't that important although I suggest you make it unique so it is less likely to clash with other stored objects. Something like yourStoreNameShopifyStore where yourStoreName is your shopify store name will suffice.

Installation

Change into the project directory and run the following command:

yarn && yarn dev

Update Site Metadata

You can update your site metadata in the next.config.js file.

env: {
  siteTitle: 'Your Company',
  siteDescription: 'Your company description.',
  siteKeywords: 'your company keywords',
  siteUrl: 'https://doggystickers.xyz',
  siteImagePreviewUrl: '/images/main.jpg',
  twitterHandle: '@your_handle'
} 

Update Colors

You can update the color palette in tailwind.config.js file.

colors: {
  palette: {
    lighter: '',
    light: '',
    primary: '',
    dark: '',
  },
},

Update Progressive Web App (PWA) data

Update the manifest.json file and the icons under the public/images/icons folder.

You can use free tools online such as https://realfavicongenerator.net/ to quickly generate all the different icon sizes and favicon.ico file.

Deployment

You can deploy this using any number of services. Vercel and Netlify are the ones I prefer and very easy to setup and sync with your Github repo.

Credit

The store was inspired by the awesome Gatsby Swag Store as well as countless other devs much more capable than me who put out their awesome work for free.

License

I have open sourced this code under the MIT License in the hope that if this helps people navigate their way around JAMStack eCommerce stores as the Gatsby Swag Store did for me when I first started out.

Buy Me Coffee! ☕

If you did find this useful and want to show your appreciation you can buy me a coffee 😃

You can also buy some Doggy Stickers from the store! 🐶

More Repositories

1

uselesshooks

A Collection of Useless React Hooks to impress your coworkers
JavaScript
116
star
2

notion-capture

Email capture page using Notion API
JavaScript
92
star
3

ai-gifs

TypeScript
78
star
4

deoldify_and_edvr

combining DeOldify and EDVR
Jupyter Notebook
40
star
5

summarlight

The Summarlight Chrome Extension highlights the most important parts of posts/stories/articles.
JavaScript
26
star
6

age-detector

Detecting A Person's Age In A Photo
Jupyter Notebook
20
star
7

gatsby-landing-page-starter

Simple Landing Page Starter Built With Gatsby
CSS
19
star
8

tail-story

A Tail Story
TypeScript
16
star
9

leaves-of-ai

Generate Walt Whitman Poetry Using Deep Learning
Jupyter Notebook
16
star
10

tensorflow-LAMB

# Implementation of LAMB in Tensorflow: https://arxiv.org/pdf/1904.00962.pdf
Python
6
star
11

next-capture-page

Email capture page with Notion guide
JavaScript
4
star
12

nerdogram

The Nerdiest Gram
JavaScript
4
star
13

another-wordle

TypeScript
3
star
14

next-air-jobs

Job Board starter with Next.js and Airtable
JavaScript
2
star
15

Amazon-Bin-Challenge

Count Number Of Bins In Amazon Pods Using Deep Learning
Jupyter Notebook
2
star
16

aipi

Simple Wrapper for an LLM Powered API
TypeScript
2
star
17

Deep-Cropper

Photoshop Images Using Deep Learning!
Jupyter Notebook
1
star
18

Kickstarter_DApp

A Kickstarter Clone App on the Ethereum Platform.
JavaScript
1
star
19

covid_dz

Visualizing Covid-19 data across Washington State:
Jupyter Notebook
1
star
20

btahir.github.io

my site
1
star
21

air-capture

TypeScript
1
star
22

Twitter-Pulse-Checker

A quick and dirty way to get a sense of what's trending on Twitter related to a particular Topic.
Jupyter Notebook
1
star
23

nextail-companies

⭐️ Companies that use Next.js + Tailwind CSS
1
star
24

colorizing-pakistan

Use Perceptual Loss To Colorize Black & White Photos
Jupyter Notebook
1
star