Coder Social home page Coder Social logo

jennyriess / astro-shopify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomaskn/astro-shopify

0.0 0.0 0.0 241 KB

A lightweight and powerful ecommerce starter theme to build headless Shopify storefronts with Astro.

Home Page: https://astro-shopify.gatto.dev

License: MIT License

JavaScript 1.68% TypeScript 12.70% CSS 0.63% Svelte 17.55% Astro 67.43%

astro-shopify's Introduction

Astro starter theme to build a headless ecommerce website with Shopify

The theme is built with Svelte but you can use any framework you like (React, Vue, Solid etc.) thanks to Astro. Tailwind UI free components are used for the design.

astro_shopify_preview

๐Ÿง‘โ€๐Ÿš€ Where to start

  1. Create a .env file based on .env.example with your Shopify store url and your public and private access tokens
  2. The credentials are used inside the /utils/config.ts file, you can update the API version there
  3. Run npm install or yarn or pnpm install
  4. Run npm run dev or yarn run dev or pnpm run dev

Shopify Configuration Guide

  • Create a new account or use an existing one. https://accounts.shopify.com/store-login
  • Add the Shopify Headless channel to your store
  • Click on Add Storefront
  • Copy/Paste your public and private access tokens to your .env file
  • Next, check Storefront API access scopes
    • unauthenticated_read_product_listings and unauthenticated_read_product_inventory access should be fine to get you started.
    • Add more scopes if you require additional permissions.

Shopify Troubleshooting

  • If you encounter an error like error code 401 you likely didn't set this up correctly. Revisit your scopes and be sure add at least one test product. Also make sure you are using the Storefront API and not the Admin API as the endpoints and scopes are different.
  • If you do not see a checkout sidebar, or if it is empty after adding a product, you need to add an image to your test product.

๐Ÿš€ Project Structure

Inside the project, you'll see the following folders and files:

/
โ”œโ”€โ”€ public/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ components/
โ”‚       โ””โ”€โ”€ Header.astro
โ”‚   โ””โ”€โ”€ layouts/
โ”‚       โ””โ”€โ”€ BaseLayout.astro
โ”‚   โ””โ”€โ”€ pages/
โ”‚       โ””โ”€โ”€ index.astro
โ”‚   โ””โ”€โ”€ stores/
โ”‚       โ””โ”€โ”€ cart.ts
โ”‚   โ””โ”€โ”€ styles/
โ”‚       โ””โ”€โ”€ global.css
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ””โ”€โ”€ shopify.ts
โ””โ”€โ”€ package.json

Astro looks for .astro or .md files in the src/pages/ directory. Each page is exposed as a route based on its file name.

There's nothing special about src/components/, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.

Any static assets, like images, can be placed in the public/ directory.

๐Ÿงž Commands

All commands are run from the root of the project, from a terminal:

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:3000
npm run build Build your production site to ./dist/
npm run preview Preview your build locally, before deploying
npm run astro ... Run CLI commands like astro add, astro check
npm run astro --help Get help using the Astro CLI

โšก๏ธ Lighthouse

lighthouse_astro_shopify

astro-shopify's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.