AstroE-commerceStarter

astro-medusa-starter — Astro Ecommerce Template

By digity-studio

An open-source e-commerce storefront starter built on Astro and Medusa v2, using a static-first architecture with React islands, deployed to Cloudflare Workers, supporting multi-region routing and Stripe checkout.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

3 previews
Desktop homepage1 / 3
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 3

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-03View source

What stands out

A quick read of the recorded project description.

01

Static-first: product listings, details, and landing pages are generated at build time, with interactive parts loaded on demand as React islands

02

Medusa webhooks trigger redeployment to keep static pages in sync with product data

03

Product variant inventory refreshes on the client at load time, reducing the risk of static pages showing stale inventory

04

URLs are prefixed with country codes, resolving pricing, currency, and shipping options through Medusa regions

05

Cart state is persisted on the client using Nanostores and localStorage

06

Deployment target is Cloudflare Workers, with build output intended for edge execution

Template Details

This is an Astro storefront starter for e-commerce, with a Medusa v2 backend and Stripe for payments. The project uses a static-first architecture: product listings, product details, and landing pages are generated as static HTML at build time, while the cart, navigation, and checkout flow hydrate on demand as React islands. Medusa webhooks can trigger redeployment when products are added, updated, or deleted, keeping static pages in sync with backend data; product variant inventory status refreshes on the client at load time, avoiding stale inventory shown on static pages.

Routes are prefixed with ISO two-letter country codes, such as /:country/store and /:country/checkout. The country code drives pricing, currency, and available shipping options, resolved from Medusa's region configuration. Middleware handles region detection and country-based routing. Cart state is persisted on the client via Nanostores and localStorage.

The project uses Tailwind CSS for styling, and form validation relies on React Hook Form and Zod. The deployment target is Cloudflare Workers, with build output intended for edge execution. The repository is MIT licensed, and the free scope is limited to this version of the code itself; third-party assets such as demo images, fonts, and icons require separate license checks, and external services such as domains, hosting, databases, and payments may incur additional costs. Before use, you need a running Medusa v2 backend with CORS configured to allow requests from the storefront origin.

AstroE-commerceStarter

Is it right for your project?

Use Cases

  • Projects that need a static-first e-commerce storefront built with Astro and connected to a Medusa v2 backend
  • Cross-border stores that want differentiated pricing, currency, and shipping options by country or region
  • Teams planning to deploy the storefront to Cloudflare Workers and leverage edge distribution
  • E-commerce sites that need Stripe checkout and a multi-step checkout flow (address, shipping, payment)

Suitable For

  • Developers who already have or are willing to set up a Medusa v2 backend
  • Frontend teams familiar with Astro, React, and Tailwind CSS
  • E-commerce projects that need multi-region routing and regional pricing
  • Technical teams that accept building a storefront with static generation plus client-side hydration

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Requires Node.js 18+ and Yarn 4.x, plus a running Medusa v2 backend

  2. 2

    Copy .env.example to .env and fill in variables such as the Medusa backend URL, publishable key, default region, and Stripe keys

  3. 3

    Ensure the Medusa backend has CORS configured to allow requests from the storefront origin

  4. 4

    Use yarn dev for development (localhost:8000), yarn build for production builds, and yarn preview for local previews

  5. 5

    The repository is MIT licensed, but third-party assets such as demo images, fonts, and icons require separate license checks under their respective licenses

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This listing covers the free version under the MIT license in the public repository; the free scope is this version of the code and does not mean external services or third-party assets are free.

Must comply with when using

  • You may use, modify, commercialize, and distribute this version of the code for free.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • You must set up and run a Medusa v2 backend yourself before use; the project does not include a backend.
  • Checkout payments depend on a Stripe account, which you must register and configure keys for, and third-party fees may apply.
  • You need to fill in environment variables such as the Medusa publishable key in .env; without them, the backend cannot be connected.
  • Stripe keys must be configured to complete the payment flow.
  • Shipping point selection depends on InPost GeoWidget, whose token must be applied for and filled in; this is an external service.
  • Assets such as product images require your own S3 bucket and domain configuration, and hosting may incur costs.
  • You must configure CORS on the Medusa backend to allow the storefront origin, otherwise requests will be rejected.
  • Static page synchronization depends on Medusa webhooks triggering redeployment; you must configure this integration yourself.
  • Demo images, fonts, icons, and other third-party assets require separate license checks and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur additional costs.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

A running [Medusa v2](https://docs.medusajs.com) backend

Original README

[Stripe](https://stripe.com) account (for payments)

Original README

PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_...

Original README

PUBLIC_STRIPE_KEY=pk_test_...

Original README

PUBLIC_INPOST_GEOWIDGET_TOKEN=your-token

Original README

S3_DOMAIN=your-bucket.s3.us-east-1.amazonaws.com

Original README

Make sure your Medusa backend has [CORS configured](https://docs.medusajs.com/learn/configurations/medusa-config#httpstorecors) to allow requests from your storefront origin.

Original README

Medusa webhooks trigger a re-deploy when products are created, updated, or deleted

Original README
https://github.com/digity-studio/astro-medusa-starter/blob/main/LICENSEhttps://github.com/digity-studio/astro-medusa-starter/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-03. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
Astro Themes
Documentation and maintenance reference score
More documented · 96 / 100
Technologies
Astro
Website type
E-commerce · Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-09-28
Screenshot last checked
2026-10-03

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Astro as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Review declaration: [email protected] · 2026-10-04

Inspect the recorded source material

SHA-256: 3bfc945078bb806960fd025c0d3f682186f5a642cfab6ef0e19ff8e4ba6df41d

2026-10-03T15:39:56.159Z

Source file / repository
# Astro Medusa Storefront

A blazing-fast, open-source ecommerce storefront built with **Astro**, **React**, and **Medusa v2** — deployed to the edge on **Cloudflare Workers**.

Static-first architecture. Interactive where it matters. Zero compromise on performance.

## Tech Stack

| Layer      | Technology                                                                               |
| ---------- | ---------------------------------------------------------------------------------------- |
| Framework  | [Astro 6](https://astro.build) — static HTML, islands of interactivity                   |
| UI         | [React 19](https://react.dev) — only where you need it                                   |
| Styling    | [Tailwind CSS v4](https://tailwindcss.com) — zero-config Vite plugin                     |
| Backend    | [Medusa v2](https://medusajs.com) — headless commerce engine                             |
| Payments   | [Stripe](https://stripe.com) — secure checkout                                           |
| State      | [Nanostores](https://github.com/nanostores/nanostores) — tiny, framework-agnostic stores |
| Forms      | [React Hook Form](https://react-hook-form.com) + [Zod](https://zod.dev) validation       |
| Deployment | [Cloudflare Workers](https://workers.cloudflare.com) — edge-first                        |

## Architecture

```
┌─────────────────────────────────────────────────┐
│                Cloudflare Workers                │
│                                                 │
│   ┌──────────┐  ┌──────────┐  ┌──────────────┐  │
│   │  Static  │  │  Astro   │  │    React     │  │
│   │   HTML   │──│Middleware│──│   Islands    │  │
│   │  (SSG)   │  │ (Region) │  │ (Cart, Nav)  │  │
│   └──────────┘  └──────────┘  └──────┬───────┘  │
│                                       │         │
└───────────────────────────────────────┼─────────┘
                                        │
                              ┌─────────▼─────────┐
                              │   Medusa v2 API   │
                              │  (Your backend)   │
                              └─────────┬─────────┘
                                        │
                              ┌─────────▼─────────┐
                              │      Stripe       │
                              └───────────────────┘
```

**Static where possible, dynamic where necessary:**

- Product pages, store listing, and landing page are statically generated at build time
- Medusa webhooks trigger a re-deploy when products are created, updated, or deleted — keeping static pages in sync
- Product variant availability is refreshed client-side to prevent stale inventory data
- Cart, checkout, and navigation hydrate as interactive React islands
- Middleware handles region detection and country-based routing
- Cart state persists client-side via Nanostores + `localStorage`

## Pages

| Route                        | Description                                      |
| ---------------------------- | ------------------------------------------------ |
| `/:country/`                 | Landing page                                     |
| `/:country/store`            | Product catalog                                  |
| `/:country/store/:productId` | Product detail with image carousel               |
| `/:country/cart`             | Shopping cart                                    |
| `/:country/checkout`         | Multi-step checkout (address, shipping, payment) |
| `/:country/order/confirmed`  | Order confirmation                               |

All routes are prefixed with an ISO-2 country code for region-based pricing and shipping.

## Getting Started

### Prerequisites

- [Node.js](https://nodejs.org) 18+
- [Yarn](https://yarnpkg.com) 4.x
- A running [Medusa v2](https://docs.medusajs.com) backend
- [Stripe](https://stripe.com) account (for payments)

### Setup

```bash
# Clone the repo
git clone https://github.com/bystrol/astro-medusa-starter.git
cd astro-medusa-starter/

# Install dependencies
yarn

# Configure environment
cp .env.example .env
```

Fill in your `.env`:

```env
PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000
PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_...
DEFAULT_REGION=us
PUBLIC_STRIPE_KEY=pk_test_...
S3_DOMAIN=your-bucket.s3.us-east-1.amazonaws.com
PUBLIC_INPOST_GEOWIDGET_TOKEN=your-token
PUBLIC_INPOST_SANDBOX=true
```

> Make sure your Medusa backend has [CORS configured](https://docs.medusajs.com/learn/configurations/medusa-config#httpstorecors) to allow requests from your storefront origin.

### Development

```bash
yarn dev        # Start dev server on localhost:8000
```

### Production

```bash
yarn build      # Build for Cloudflare Workers
yarn preview    # Preview the production build locally
```

## Project Structure

```
src/
├── assets/              # Static assets (images, fonts)
├── components/          # Shared UI components
├── layouts/             # Page layouts
├── lib/
│   ├── sdk.ts           # Medusa SDK singleton
│   ├── stores/          # Nanostores (cart state)
│   ├── params/          # Static path generation
│   └── utils/           # Helpers (pricing, stock, etc.)
├── loaders/             # Astro content loaders
├── middleware.ts         # Region detection & routing
├── modules/
│   ├── cart/            # Cart page & sidebar
│   ├── checkout/        # Multi-step checkout flow
│   ├── layout/          # Nav, footer
│   ├── order/           # Order confirmation
│   └── products/        # Product cards, detail, carousel
├── pages/
│   └── [countryCode]/   # All routes, region-prefixed
├── styles/              # Global styles & Tailwind theme
└── types/               # TypeScript type definitions
```

## Key Design Decisions

- **Islands architecture** — React only loads for interactive components (cart, nav, checkout). Everything else ships as zero-JS static HTML.
- **Real-time inventory checks** — Product variant stock data is fetched client-side on page load, ensuring accurate availability even though pages are statically generated.
- **Edge deployment** — Cloudflare Workers adapter means your storefront runs close to your customers, everywhere.
- **Tailwind v4** — No config file. Theme customization lives in CSS with `@theme`. Powered by the Vite plugin.
- **Region-aware routing** — Country code in the URL drives pricing, currency, and available shipping options — all resolved via Medusa regions.

## License

[MIT](LICENSE)

## Author

**Michal Bystryk** — [digity.studio](https://digity.studio/) · [LinkedIn](https://www.linkedin.com/in/michal-bystryk/)

## Work with me

Need a custom storefront, a Medusa integration, or help shipping an ecommerce project?
I build them at **[digity.studio](https://digity.studio/)** — get in touch.
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.