A full-featured clothing e-commerce store built with Medusa.js v2 (commerce backend) and Next.js 15 (storefront) in a monorepo architecture.
| Layer | Technology | Version |
|---|---|---|
| Commerce Backend | Medusa.js v2 | 2.13 |
| Storefront | Next.js (App Router) | 15.5 |
| UI Framework | Tailwind CSS + shadcn/ui | v4 |
| Animations | Framer Motion | 11 |
| Payments | Stripe (via Medusa integration) | — |
| Auth | Medusa built-in (customer + admin) | — |
| State | Zustand | 5 |
| Resend (via Medusa subscribers) | — | |
| i18n | next-intl | 4 |
| Analytics | Vercel Analytics + Speed Insights | — |
- Homepage: Animated hero, category grid, featured products, trust badges, testimonials, stats counter, Instagram feed, newsletter CTA
- Product Catalog: Grid/list view toggle, sort, price range filter, pagination, product badges (New/Sale/Sold Out)
- Product Detail: Image gallery (Embla carousel + zoom + lightbox), color swatches, size selector with chart modal, quantity picker, delivery estimate, share buttons, tabs (description/details/reviews), related products, recently viewed
- Cart: Slide-out cart drawer with animated items, full cart page, quantity management
- Checkout: Multi-step flow (information → shipping → payment) with visual stepper, Stripe integration
- Account: Orders with tracking timeline, addresses (CRUD), profile management
- Search: Cmd+K global search dialog with typeahead, dedicated search page
- Wishlist: Persistent wishlist with localStorage, heart overlay on cards
- Product Comparison: Compare up to 3 products side-by-side with floating bar
- Dark mode with system detection
- Smart header (hides on scroll down, reveals on scroll up)
- Announcement bar with rotating promotions
- Mobile bottom navigation
- Scroll progress bar + back-to-top button
- Toast notifications (Sonner)
- Cookie consent banner (GDPR)
- Shimmer skeleton loading states
- Skip-to-content accessibility link
- PWA manifest for installable app
- Custom review module (model, service, store + admin API routes)
- Admin review moderation widget
- Contact form API route
- Order placed + customer created event subscribers
- Order confirmation HTML email template
- Clothing seed script (30+ products, 6 categories)
- Stripe payment provider configuration
├── backend/ # Medusa.js v2 server
│ ├── medusa-config.ts # DB, Redis, Stripe, modules config
│ ├── Procfile # Railway deployment
│ ├── railway.toml # Railway build config
│ └── src/
│ ├── modules/review/ # Custom review module
│ ├── api/store/ # Store API (reviews, contact)
│ ├── api/admin/ # Admin API (review moderation)
│ ├── subscribers/ # Event handlers (order, customer)
│ ├── templates/ # Email templates
│ ├── admin/widgets/ # Admin dashboard extensions
│ └── scripts/ # Seed scripts
│
└── storefront/ # Next.js 15 App Router
├── vercel.json # Vercel deployment config
├── public/manifest.json # PWA manifest
└── src/
├── app/ # 22+ routes
├── components/ # 50+ components
│ ├── ui/ # shadcn/ui primitives (20+)
│ ├── layout/ # header, footer, nav, search, cart sheet
│ ├── product/ # cards, gallery, variants, filters
│ ├── cart/ # items, summary
│ ├── checkout/ # form, stepper
│ ├── account/ # nav, timeline
│ ├── home/ # hero, categories, featured, trust, testimonials
│ └── shared/ # breadcrumbs, motion, scroll, countdown
├── lib/ # SDK, types, utilities, data fetching
├── stores/ # Zustand (cart, region, wishlist, compare, recent)
└── i18n/ # Internationalization config
| Service | Provider | Config |
|---|---|---|
| Storefront | Vercel | storefront/vercel.json |
| Backend | Railway | backend/railway.toml |
| PostgreSQL | Railway | Add-on service |
| Redis | Railway | Add-on service |
- Node.js 20+
- npm 10+
# Clone the repository
git clone https://github.com/xiaooye/ecom.git
cd ecom
# Install all dependencies (both workspaces)
npm install
# Set up environment variables
cp backend/.env.template backend/.env
cp storefront/.env.template storefront/.env.local# Start Medusa backend (port 9000)
npm run dev --workspace=backend
# Start Next.js storefront (port 3000)
npm run dev --workspace=storefront
# Seed the database with sample products
npm run seed --workspace=backendBackend (backend/.env):
DATABASE_URL— PostgreSQL connection stringREDIS_URL— Redis connection stringSTRIPE_API_KEY— Stripe secret keyJWT_SECRET/COOKIE_SECRET— Auth secrets
Storefront (storefront/.env.local):
NEXT_PUBLIC_MEDUSA_BACKEND_URL— Medusa API URLNEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY— Medusa publishable keyNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY— Stripe publishable key
# Build storefront
npm run build --workspace=storefront
# Build backend
npm run build --workspace=backend- Connect your GitHub repo to Railway
- Add PostgreSQL and Redis services
- Set environment variables from
backend/.env.template - Railway auto-deploys on push using
railway.toml
- Import the repo on Vercel
- Set root directory to
storefront - Add environment variables from
storefront/.env.template - Vercel auto-deploys on push
Private