├── .gitignore ├── app.vue ├── tsconfig.json ├── .env.example ├── layouts └── custom.vue ├── static └── building-headless-commerce-nuxt-shopify-tailwind.png ├── queries ├── checkout.gql ├── product.gql └── products.gql ├── components ├── TheHeader.vue ├── HeroBanner.vue ├── ProductList.vue ├── ProductCard.vue ├── ProductDetail.vue └── TheFooter.vue ├── pages ├── index.vue └── products │ └── [handle].vue ├── package.json ├── public └── logo.svg ├── nuxt.config.ts └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | .nuxt 4 | .nitro 5 | .cache 6 | .output 7 | .env 8 | dist 9 | -------------------------------------------------------------------------------- /app.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://v3.nuxtjs.org/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | SHOPIFY_DOMAIN=https://.myshopify.com/api/graphql.json 2 | SHOPIFY_STOREFRONT_TOKEN= -------------------------------------------------------------------------------- /layouts/custom.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/building-headless-commerce-nuxt-shopify-tailwind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baroshem/nuxt-shopify-tailwind/HEAD/static/building-headless-commerce-nuxt-shopify-tailwind.png -------------------------------------------------------------------------------- /queries/checkout.gql: -------------------------------------------------------------------------------- 1 | mutation Checkout($variantId: ID!) { 2 | checkoutCreate(input: { lineItems: { variantId: $variantId, quantity: 1 } }) { 3 | checkout { 4 | webUrl 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /components/TheHeader.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-shopify-tailwind", 3 | "author": "Baroshem", 4 | "scripts": { 5 | "build": "nuxt build", 6 | "dev": "nuxt dev", 7 | "generate": "nuxt generate", 8 | "preview": "nuxt preview" 9 | }, 10 | "devDependencies": { 11 | "@nuxtjs/tailwindcss": "^5.1.2", 12 | "nuxt": "3.0.0-rc.3" 13 | }, 14 | "dependencies": { 15 | "nuxt-graphql-client": "^0.0.32" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /queries/product.gql: -------------------------------------------------------------------------------- 1 | query Product ($handle: String!) { 2 | productByHandle(handle: $handle) { 3 | id 4 | title 5 | productType 6 | priceRange { 7 | maxVariantPrice { 8 | amount 9 | currencyCode 10 | } 11 | } 12 | description 13 | images(first: 6) { 14 | edges { 15 | node { 16 | src 17 | } 18 | } 19 | } 20 | variants (first: 1) { 21 | edges { 22 | node { 23 | id 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /queries/products.gql: -------------------------------------------------------------------------------- 1 | query Products ($first: Int!, $query: String) { 2 | products(first: $first, query: $query) { 3 | edges { 4 | node { 5 | id 6 | images(first: 1) { 7 | edges { 8 | node { 9 | src 10 | } 11 | } 12 | } 13 | title 14 | description 15 | handle 16 | priceRange { 17 | maxVariantPrice { 18 | amount 19 | currencyCode 20 | } 21 | } 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /components/HeroBanner.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /components/ProductList.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /nuxt.config.ts: -------------------------------------------------------------------------------- 1 | import { defineNuxtConfig } from "nuxt"; 2 | 3 | // https://v3.nuxtjs.org/api/configuration/nuxt.config 4 | export default defineNuxtConfig({ 5 | ssr: false, 6 | modules: ["@nuxtjs/tailwindcss", "nuxt-graphql-client"], 7 | 8 | runtimeConfig: { 9 | public: { 10 | "graphql-client": { 11 | clients: { 12 | default: { 13 | host: process.env.SHOPIFY_DOMAIN, 14 | token: { 15 | name: "X-Shopify-Storefront-Access-Token", 16 | value: process.env.SHOPIFY_STOREFRONT_TOKEN, 17 | type: null, 18 | }, 19 | retainToken: true, 20 | }, 21 | }, 22 | }, 23 | }, 24 | }, 25 | }); 26 | -------------------------------------------------------------------------------- /components/ProductCard.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | -------------------------------------------------------------------------------- /pages/products/[handle].vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 39 | -------------------------------------------------------------------------------- /components/ProductDetail.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Out of date] Headless Commerce with Nuxt 3, Shopify, and TailwindCSS 2 | 3 | Please use this repository instead -> https://github.com/Baroshem/nuxt-shopify-storyblok 4 | 5 | ![Headless Commerce with Nuxt 3, Shopify, and TailwindCSS](/static/building-headless-commerce-nuxt-shopify-tailwind.png) 6 | 7 | Example of a Headless Commerce website built with Nuxt 3, Shopify, and TailwindCSS. This project is a code repository template used in video tutorial series and an article that will be published soon. 8 | 9 | *This is not a real website template. In order to make it production ready many things would have to be implemented like order, checkout, categories, mobile support, etc. If you are looking for production ready Nuxt store with Shopify, check out [Vue Storefront](https://www.vuestorefront.io/) and especially, the integration with Shopify [here](https://docs.vuestorefront.io/shopify/).* 10 | 11 | ## Reference 12 | 13 | [![YouTube Video about Building Headless Commerce with Nuxt 3, Shopify, and TailwindCSS](https://img.youtube.com/vi/QK6wPHFiRyM/0.jpg)](https://www.youtube.com/watch?v=QK6wPHFiRyM) 14 | 15 | * [TBD] Article tutorial 16 | 17 | Official docs: 18 | 19 | * Nuxt.js 3 documentation [here](https://v3.nuxtjs.org) 20 | * TailwindCSS documentation [here](https://tailwindcss.com/) 21 | * Shopify documentation [here](https://shopify.dev/api) 22 | * Tailwind Elements documentation [here](https://tailwind-elements.com/) 23 | 24 | ## Setup 25 | 26 | Make sure to install the dependencies: 27 | 28 | ```bash 29 | # yarn 30 | yarn install 31 | 32 | # npm 33 | npm install 34 | 35 | # pnpm 36 | pnpm install --shamefully-hoist 37 | ``` 38 | 39 | ## Development Server 40 | 41 | Start the development server on http://localhost:3000 42 | 43 | ```bash 44 | npm run dev 45 | ``` 46 | 47 | ## Production 48 | 49 | Build the application for production: 50 | 51 | ```bash 52 | npm run build 53 | ``` 54 | 55 | Locally preview production build: 56 | 57 | ```bash 58 | npm run preview 59 | ``` 60 | 61 | Checkout the [deployment documentation](https://v3.nuxtjs.org/guide/deploy/presets) for more information. 62 | -------------------------------------------------------------------------------- /components/TheFooter.vue: -------------------------------------------------------------------------------- 1 | 15 | --------------------------------------------------------------------------------