Astro 构建的服装电商公开网站,无 UI 框架依赖
templates-wardrobe-website — Astro 电商模板
作者 mattoznav
Wardrobe 服装店的公开电商网站模板,基于 Astro 构建,包含编辑风格首页、可筛选目录、商品详情、购物袋、结账与账户订单管理,需要配套后端提供数据。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
首页、目录、商品、系列、购物袋、结账、账户等完整页面路径
目录支持 section、category、colour、size、new、sale、sort 等浏览器端筛选,筛选条件写入 URL
商品页提供按颜色展示图片、颜色与尺码选择器及实时库存
购物袋存于浏览器 localStorage,结账前无需账户,支付前后端会重新校验价格与库存
提供 PUBLIC_SHOWCASE 展示模式,可在静态托管上模拟后端接口运行
模板详细介绍
这是 templates-wardrobe 模板中的公开网站部分,基于 Astro,不使用 UI 框架。页面覆盖首页、商店目录、商品详情、系列、购物袋、结账、账户、实体店与工坊等,商品与编辑内容在构建时从后端 API 获取,库存、购物袋价格、运费、账户、订单、支付与退货等则在浏览器中实时请求后端。
网站依赖配套后端运行,默认地址为 http://localhost:8001,开发端口为 4322。构建时数据在开发模式下每隔几秒刷新,管理后台修改商品后重新加载即可看到;正式构建后需要重新构建才能更新目录内容。
支付方式跟随后端:默认使用假支付提供方,提供“支付”和“模拟拒付”的演示面板;也可接入 Stripe Payment Element,并等待后端 webhook 将订单标记为已支付。商品与编辑图片来自 Unsplash,按 Unsplash 许可通过其 CDN 加载,页面中标注摄影师。
仓库还提供展示模式:构建时设置 PUBLIC_SHOWCASE=true,网站会生成自包含的静态展示版本,用 src/lib/showcase.ts 在浏览器中模拟后端接口,账户、订单、支付、退货及库存变化仅存于当前浏览器的 localStorage,后台部分以固定时间模拟发货、送达与退款。该模式用于 GitHub Pages 等静态托管,未设置时不会打包相关代码。
适合你的项目吗?
适用场景
- 搭建服装或生活方式品牌的公开电商网站前端
- 需要构建时静态生成目录、运行时实时查询库存与订单的电商项目
- 希望用假支付提供方或 Stripe 测试模式演示结账流程
- 在 GitHub Pages 等静态托管上展示不含真实后端的电商演示站点
适合人群
- 熟悉 Astro 与 Node.js 的前端开发者
- 已有或愿意部署配套 templates-wardrobe-backend 后端的团队
- 需要 MIT 许可下可修改、可商用的电商网站代码的开发者
- 希望以静态页面配合实时库存与账户功能的服装类电商项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需要 Node.js 22.12 或更新版本及 npm
- 2
需先运行配套后端,默认地址为 http://localhost:8001
- 3
安装依赖后复制 .env.example 为 .env,再运行 npm run dev,访问 http://localhost:4322
- 4
npm run check 用于检查类型与模板,npm run build 生成静态站点到 dist/
- 5
展示模式需在构建时设置 PUBLIC_SHOWCASE=true,本地预览可运行 npx astro preview
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 该网站模板必须依赖配套的 templates-wardrobe-backend 后端服务才能运行,默认地址为 http://localhost:8001,单独部署前端无法获得完整功能。
- 运行要求中明确需要本地运行配套后端,属于外部服务依赖,非纯前端独立项目。
- 若使用 Stripe 支付,需要配置 Stripe 账户与测试模式密钥,并依赖后端 webhook 标记订单已支付,涉及第三方服务与账号。
- 商品与编辑图片来自 Unsplash,适用 Unsplash 许可而非 MIT,使用这些图片需遵守 Unsplash 许可条款。
- 商品照片不在仓库中,通过 Unsplash CDN 加载并适用 Unsplash 许可,与代码的 MIT 许可分开,商用或再分发需另行确认图片授权。
- 字体使用 SIL Open Font License,图标使用 MIT,属于单独授权的第三方资源,需分别遵守其许可条件。
- 展示模式下后台功能为模拟,发货、送达与退款按固定 3 分钟时间模拟,不代表真实业务流程。
- 展示模式下账户、订单、支付、退货与库存数据仅存于当前浏览器 localStorage,不涉及真实后端持久化。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
The website needs the [backend](https://github.com/mattoznav/templates-wardrobe-backend) running, by default on `http://localhost:8001`.
README 原文
The backend running locally (see its README)
README 原文
**Stripe**: the Stripe Payment Element is loaded on demand and the page waits for the backend webhook to mark the order paid. Use test mode keys and [test cards](https://docs.stripe.com/testing).
README 原文
Product and editorial photos are from [Unsplash](https://unsplash.com), under the [Unsplash License](https://unsplash.com/license).
README 原文
Product photos are not part of the repository: they are loaded from Unsplash under the [Unsplash License](https://unsplash.com/license).
README 原文
Fonts: Cormorant Garamond and Instrument Sans (SIL Open Font License). Icons: [Phosphor](https://phosphoricons.com) (MIT).
README 原文
The back office is not there, so its part is simulated: a paid order ships 3 minutes after payment and is delivered 3 minutes later, and a requested return is received and refunded 3 minutes after it is sent.
README 原文
https://github.com/mattoznav/templates-wardrobe-website/blob/main/LICENSEhttps://github.com/mattoznav/templates-wardrobe-website/blob/main/README.mdAccounts, sign-in tokens, orders, payments, returns and the stock the visitor bought are stored in this browser only (`localStorage`, key `wardrobe.showcase`); passwords are kept as salted SHA-256 hashes.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-11。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 80 / 100
- 技术栈
- Astro
- 网站类型
- 电商
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-06
- 截图检查日期
- 2026-10-11
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Astro。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-13
查看当时使用的来源资料
SHA-256: ddd5604a3d8155dc72c7245fed4e08dcac7c21b816c08e5a68a4c6912b6fc1cd
2026-10-11T19:05:54.264Z
来源文件 / 仓库# Wardrobe template: Website The public website of the clothing store: an editorial home page, the catalogue with filters, product pages with live stock, collections, bag, checkout with payment, and an account for orders, cancellations and returns. Astro, no UI framework. Part of the [`templates-wardrobe`](https://github.com/mattoznav/templates-wardrobe) template, inside the [`templates`](https://github.com/mattoznav/templates) collection. Live demo: [mattoznav.github.io/templates-wardrobe-website](https://mattoznav.github.io/templates-wardrobe-website/), a static showcase that runs without the backend (see [Showcase mode](#showcase-mode)). ## Requirements - Node.js 22.12 or newer and npm - The backend running locally (see its README) ## Quick start The website needs the [backend](https://github.com/mattoznav/templates-wardrobe-backend) running, by default on `http://localhost:8001`. ```bash npm install cp .env.example .env npm run dev ``` Open `http://localhost:4322`. Check types and templates with `npm run check`; `npm run build` produces the static site in `dist/`. ## What is static and what is live | Part | When it is loaded | | --- | --- | | Home, catalogue, product pages, collections, store and atelier pages | At build time, from the API. Rebuild after editing products in the admin | | Stock per size, bag prices, shipping, problems such as "only 1 left" | Live, in the browser | | Account, orders, payments, returns | Live, in the browser | So the pages are fast and cacheable, while stock is always current. In development the build-time data refreshes every few seconds, so admin edits show up on reload. ## Pages | Path | What it does | | --- | --- | | `/` | Hero, new in, departments, the featured edit, knitwear story, collections, atelier, store | | `/shop/` | Every product, filtered in the browser: `section`, `category`, `colour`, `size`, `new`, `sale`, `sort`. Filters live in the URL | | `/products/<slug>/` | Photos per colour, colour and size pickers with live stock, add to bag, details, care, credits, complete the look | | `/collections/`, `/collections/<slug>/` | Curated edits | | `/bag/` | Quantities, today's prices and stock, standard shipping, free shipping threshold | | `/checkout/` | Sign in, delivery address and method, then payment while the pieces are set aside. `?order=<id>` resumes a pending payment | | `/account/` | Orders with their progress, cancel before shipping, request a return; returns and their status | | `/store/`, `/about/` | The physical store, services and delivery; the atelier and a care guide | The bag lives in the browser (`localStorage`) until checkout, so no account is needed to fill it. Prices and stock are always checked again by the backend before paying. ## Payments The website follows whatever the backend uses: - **Fake provider** (default): a demo panel with "Pay" and "Simulate a declined card". No money moves. - **Stripe**: the Stripe Payment Element is loaded on demand and the page waits for the backend webhook to mark the order paid. Use test mode keys and [test cards](https://docs.stripe.com/testing). ## Photos Product and editorial photos are from [Unsplash](https://unsplash.com), under the [Unsplash License](https://unsplash.com/license). They are loaded from the Unsplash CDN with the size and crop each layout needs (`src/lib/image.ts`), and every page credits the photographers. ## Customising - Colours, fonts and shapes are design tokens at the top of `src/styles/global.css`. - The shop name, address, opening hours, free shipping amount and return window come from the backend (`data/store.csv`); home page copy and images from `data/editorial.csv`. - Set the real domain in `astro.config.mjs` (`site`). - Links to pages and files in `public/` go through `withBase()` from `src/lib/paths.ts`, so the site also works under a sub-path. ## Showcase mode A static host such as GitHub Pages cannot run the Django backend, so the website can be built as a self-contained showcase: set `PUBLIC_SHOWCASE=true` at build time. Without it nothing changes and none of the showcase code is shipped. | Part | Where it comes from in showcase mode | | --- | --- | | Pages, catalogue, collections | The backend API at build time, as usual | | Snapshot for the browser | `src/pages/showcase/` writes `showcase/catalog.json` (store settings, shipping methods, products with their variants and stock) and one `showcase/products/<slug>.json` per product | | Every API call made in the browser | `src/lib/showcase.ts`, loaded by `src/lib/client.ts` instead of calling the network | `src/lib/showcase.ts` answers the same endpoints with the same shapes, status codes and error messages as the backend, and applies the same rules: prices and free delivery, stock set aside for 15 minutes while paying and released if the payment does not arrive, the fake payment provider (paid or declined), cancellation before shipping with a refund, the return window and returnable quantities. Accounts, sign-in tokens, orders, payments, returns and the stock the visitor bought are stored in this browser only (`localStorage`, key `wardrobe.showcase`); passwords are kept as salted SHA-256 hashes. Pieces the visitor buys lower the stock shown on the product pages. The back office is not there, so its part is simulated: a paid order ships 3 minutes after payment and is delivered 3 minutes later, and a requested return is received and refunded 3 minutes after it is sent. The timings are at the top of `src/lib/showcase.ts`. The layout shows a slim notice explaining that the site is a showcase. ## Publish on GitHub Pages `.github/workflows/pages.yml` builds the showcase and publishes it on GitHub Pages at every push to `main`, once a day (so the catalogue follows the backend's data) and on demand. The job checks out the [backend](https://github.com/mattoznav/templates-wardrobe-backend), loads its catalogue with `manage.py bootstrap --no-demo-orders` and runs it on `localhost:8001` only for the build; the published site never calls it. To use it in a copy of the repository, open **Settings > Pages** and set **Source** to **GitHub Actions**. If the backend lives in another repository, change the second checkout step. The workflow passes the Pages address to the build through `SITE_URL` and `BASE_PATH`, so the site works under `https://<user>.github.io/<repository>/`; with a custom domain the path is simply `/`. To try the showcase locally, with the backend running: ```bash PUBLIC_SHOWCASE=true npm run build npx astro preview ``` ## Structure ``` src/pages/ Home, shop, product, collections, bag, checkout, account, store, atelier src/pages/showcase/ Snapshots for showcase mode (emitted only with PUBLIC_SHOWCASE=true) src/components/ Header, footer, bag drawer, product card, sign-in form, showcase notice src/layouts/Base.astro Page shell src/scripts/ Browser code for each page: filters, stock, bag, checkout, account src/lib/catalog.ts Build-time data from the API src/lib/client.ts Browser API client: stock, bag quote, accounts, orders, payments, returns src/lib/showcase.ts The backend simulated in the browser, for showcase mode src/lib/paths.ts withBase(), for links that must follow the site's base path src/styles/global.css Design tokens and shared styles .github/workflows/ GitHub Pages deployment ``` ## Credits Fonts: Cormorant Garamond and Instrument Sans (SIL Open Font License). Icons: [Phosphor](https://phosphoricons.com) (MIT). ## License The code is released under the [MIT License](LICENSE). Product photos are not part of the repository: they are loaded from Unsplash under the [Unsplash License](https://unsplash.com/license).
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

astro-shopify
astro-shopify 是一个面向开发者的轻量级电商启动模板,用于构建基于 Shopify 的无头店面。
Astro · 电商

astro-ecommerce
Astro Ecommerce - Ready to use components
Astro · 电商

astro-medusa-starter
Astro + Medusa starter for e-commerce. Optimized to the core.
Astro · 电商

sanity-astro-club
sanity-astro-club 开源网站模板。
Astro · 电商

atelier-ko
Atelier Kō 是一个为小型家具工坊或类似手工艺目录设计的 Astro 电商主题,它的核心假设是:作品不多,摄影足够有力,因此界面刻意保持冷静和建筑感。
Astro · 电商

starter-astro
A small, production-minded storefront starter for Astro.
Astro · 电商
