项目
在 GitHub 查看
thomasKn/astro-shopify
关于
使用 Astro 构建无头 Shopify 商店前端的轻量而强大的电商入门主题。
商业与金融实测星标增长
- 24小时
- +1
- 7天
- +2
- 15天
- +2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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.

🧑🚀 Where to start
- Create a
.envfile based on.env.examplewith your Shopify store url and your public and private access tokens - The credentials are used inside the
/utils/config.tsfile, you can update the API version there - Run
npm installoryarnorpnpm install - Run
npm run devoryarn run devorpnpm 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
publicandprivateaccess tokens to your .env file - Next, check Storefront API access scopes
unauthenticated_read_product_listingsandunauthenticated_read_product_inventoryaccess 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 401you 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 theStorefront APIand not theAdmin APIas 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

探索相关项目
加载中…