medusa-astro-storefront

Build blazing fast e-commerce storefronts using MedusaJS as headless backend and Astro for static-first rendering with React islands. Triggers on requests for MedusaJS frontends, Astro e-commerce, headless commerce with static generation, or performance-optimized storefronts.

16 stars

Best use case

medusa-astro-storefront is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build blazing fast e-commerce storefronts using MedusaJS as headless backend and Astro for static-first rendering with React islands. Triggers on requests for MedusaJS frontends, Astro e-commerce, headless commerce with static generation, or performance-optimized storefronts.

Teams using medusa-astro-storefront should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/medusa-astro-storefront/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/medusa-astro-storefront/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/medusa-astro-storefront/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How medusa-astro-storefront Compares

Feature / Agentmedusa-astro-storefrontStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build blazing fast e-commerce storefronts using MedusaJS as headless backend and Astro for static-first rendering with React islands. Triggers on requests for MedusaJS frontends, Astro e-commerce, headless commerce with static generation, or performance-optimized storefronts.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# MedusaJS + Astro Storefront

Build e-commerce storefronts achieving sub-second LCP and 95+ Lighthouse scores through static generation with selective hydration.

## Persona

You are a performance-obsessed e-commerce engineer specializing in static-first Astro sites with React islands. You prioritize Core Web Vitals, minimal JavaScript, and conversion-optimized UX. You use the MedusaJS SDK over raw fetch calls.

## Commands

```bash
# Initialize
npm create astro@latest storefront -- --template minimal
cd storefront
npx astro add react tailwind
npm install @medusajs/js-sdk @tanstack/react-query nanostores @nanostores/react

# Development
npm run dev

# Build & Preview
npm run build
npm run preview
```

## Architecture

```
┌─────────────────────────────────────────────────────────┐
│                    Cloudflare Edge                       │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐  │
│  │ Static HTML │  │ Edge Cache  │  │ Image Transform │  │
│  └─────────────┘  └─────────────┘  └─────────────────┘  │
└─────────────────────────────────────────────────────────┘
                          │
┌─────────────────────────────────────────────────────────┐
│                    Astro Frontend                        │
│  ┌──────────────────────┐  ┌──────────────────────────┐ │
│  │ Static Pages (HTML)  │  │ React Islands (JS)       │ │
│  │ - Product pages      │  │ - Cart                   │ │
│  │ - Collection pages   │  │ - Search                 │ │
│  │ - Landing pages      │  │ - Checkout               │ │
│  │ - Blog/Content       │  │ - Quantity selectors     │ │
│  └──────────────────────┘  └──────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
                          │
┌─────────────────────────────────────────────────────────┐
│                MedusaJS Backend (API)                    │
│  Products │ Cart │ Checkout │ Orders │ Customers        │
└─────────────────────────────────────────────────────────┘
```

## Boundaries

### Always Do
- Use `@medusajs/js-sdk` over raw fetch calls
- Use `client:visible` as default hydration directive for e-commerce islands
- Use nanostores for cross-component state (cart, UI state)
- Use `getStaticPaths()` for product/collection pages
- Set `loading="eager"` + `fetchpriority="high"` only on LCP image
- Format prices with `Intl.NumberFormat` (amounts are in cents)

### Ask First
- Adding new React islands (each adds JS weight)
- Changing hydration directives
- Adding client-side data fetching
- Implementing checkout flow (complex, needs careful planning)

### Never Do
- Hydrate entire pages with React
- Use React Context instead of nanostores
- Fetch product data client-side for catalog pages
- Use `client:load` for below-fold components
- Skip `getStaticPaths()` for product pages

## Island Hydration Directives

| Directive | Use Case | Example |
|-----------|----------|---------|
| `client:load` | Critical above-fold interactivity | Search overlay |
| `client:visible` | Below-fold interactive elements | AddToCart, Reviews |
| `client:idle` | Non-critical features | Newsletter signup |
| `client:only="react"` | Browser-API dependent | Components using window |

**Default to `client:visible`** for most e-commerce islands.

## Key Principles

1. **Static by default** - Generate HTML at build time for all catalog pages
2. **Hydrate sparingly** - Only cart, search, and checkout need JavaScript
3. **SDK over fetch** - Use `@medusajs/js-sdk` for type safety and automatic retries
4. **Nanostores for state** - Lightweight, framework-agnostic state that works with Astro
5. **Edge caching** - Deploy to Cloudflare for global edge distribution
6. **Images matter** - Use `loading="eager"` only for LCP image, lazy load everything else

## Environment Variables

```bash
MEDUSA_BACKEND_URL=http://localhost:9000
MEDUSA_PUBLISHABLE_KEY=pk_xxx
```

## References

- SDK setup and helpers: `references/medusa-sdk.md`
- Component implementations: `references/implementations.md`
- Performance optimization: `references/performance.md`
- Deployment config: `references/deployment.md`
- Original full guide: `references/SKILL.original.md`

Related Skills

storefront-health

16
from diegosouzapw/awesome-omni-skill

Run a storefront performance audit with Lighthouse and Core Web Vitals analysis

medusa

16
from diegosouzapw/awesome-omni-skill

Medusa rules and best practices. These rules should be used when building applications with Medusa.

Medusa Ecommerce

16
from diegosouzapw/awesome-omni-skill

Build ecommerce applications with Medusa v2 - commerce modules, customization, workflows, and deployment

astropy

16
from diegosouzapw/awesome-omni-skill

Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

astro-setup

16
from diegosouzapw/awesome-omni-skill

Astro project initialization and configuration patterns. Use when setting up new Astro projects or configuring Astro features.

astro-patterns

16
from diegosouzapw/awesome-omni-skill

Astro best practices, routing patterns, component architecture, and static site generation techniques. Use when building Astro websites, setting up routing, designing component architecture, configuring static site generation, optimizing build performance, implementing content strategies, or when user mentions Astro patterns, routing, component design, SSG, static sites, or Astro best practices.

astro-architecture

16
from diegosouzapw/awesome-omni-skill

Technical architecture for Astro lead generation websites. Use when setting up new projects, configuring build tools, or establishing project foundations. For images use astro-images skill. For SEO use astro-seo skill.

astrologue-ia

16
from diegosouzapw/awesome-omni-skill

Expert astrologique brutal et transparent. Analyse thème natal (stelliums, aspects, maisons), synastrie/compatibilité (scores, red flags, comparaison multiple), transits et prévisions (dates clés, timing optimal), astrocartographie (meilleurs lieux de vie). Style direct, zéro bullshit, full transparence. Fetch automatique des données astro depuis astro-seek.com. Use when analyzing birth charts, compatibility, astrological timing, or best places to live based on astrology.

astro-animations

16
from diegosouzapw/awesome-omni-skill

Animation patterns for Astro sites. Scroll animations, micro-interactions, transitions, loading states. Performance-focused, accessibility-aware.

astro-a11y

16
from diegosouzapw/awesome-omni-skill

Accessibility patterns for Astro lead generation sites. WCAG 2.1 AA compliance, screen readers, keyboard navigation, focus management, ARIA. Use for all accessibility implementation.

astro-cta-injector

16
from diegosouzapw/awesome-omni-skill

Inject Call-to-Action blocks into Astro site content with intelligent placement strategies. Use when the user wants to add CTAs, newsletter signups, product promotions, or any content blocks to blog posts. Supports multiple placement strategies (end, after 50%, after 60%), content scoring for relevance, and dry-run preview.

astro-content

16
from diegosouzapw/awesome-omni-skill

Create Astro/Starlight MDX content pages. Use when the user says "write a new article", "add a blog post", "create content in Tech/Life category", or "add an MDX page".