
Ecommerce
Full ecommerce store with Payload backend, Next.js storefront, Stripe payments, variants, carts and guest checkout
Medusa storefront with Payload CMS and Next.js running on Cloudflare Workers with D1 and R2
Sets up a storefront built on Next.js 15 that connects to a separate Medusa backend and uses Payload CMS for content. Payload runs on Cloudflare D1 with media stored in R2, deployed to Workers through OpenNext. It needs a Cloudflare account on the paid Workers plan and a Medusa backend URL and publishable key.
Meridian: The optimal point for edge commerce. Production-ready Medusa + Payload CMS + Next.js 15 on Cloudflare Workers for $5/month.
This repository is a GitHub template: create your own copy of it in one click.
Create a repository from this templateThe optimal point for edge commerce
Production-ready Medusa + Payload CMS + Next.js 15 on Cloudflare Workers Run a complete e-commerce stack for $5/month instead of $60/month
Just as a meridian represents the sun's highest point—peak performance—Meridian Commerce achieves the optimal balance between enterprise features and startup costs.
Meridian is the first production-ready implementation of Medusa.js e-commerce with Payload CMS running on Cloudflare Workers. We solved the hard problems so you don't have to:
Traditional e-commerce stacks require Docker, VPS hosting, or expensive serverless platforms ($40-60/month minimum). Running Next.js + Payload + Medusa on Cloudflare Workers requires solving several technical challenges:
Meridian solves all of these with production-tested solutions.
| Platform | Monthly Cost | Notes |
|---|---|---|
| Cloudflare Workers (Meridian) | ~$5 | D1 + R2 + Workers included |
| Vercel | $40-60 | Hobby limits too restrictive |
| Railway | $50-80 | Per-service pricing |
| DigitalOcean + Docker | $30-50 | Manual DevOps required |
The Meridian advantage: Peak performance at the optimal price point.
Virtual Filesystem (scripts/patch-middleware-handler.cjs)
fs.readFileSync() calls to serve from memoryBuild Patches
scripts/patch-opentelemetry.cjs - Removes telemetry (breaks in Workers)scripts/patch-middleware-tracer.cjs - Fixes middleware bundlingscripts/patch-middleware-handler.cjs - Handles import.meta.url edge casesEdge-Compatible Middleware
eval())git clone https://github.com/casualchic/medusa-payload-cloudflare.git meridian
cd meridian
pnpm install
cp .env.example .env.local
Edit .env.local:
# Generate with: openssl rand -hex 32
PAYLOAD_SECRET=your-secret-here
# Your Medusa backend URL
NEXT_PUBLIC_MEDUSA_BACKEND_URL=https://your-medusa-backend.com
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_your-key-here
# Optional: For GDPR-compliant logging
LOG_SECRET=your-log-secret-here
# Start dev server
pnpm dev
# Access at:
# - Storefront: http://localhost:3000
# - Admin Panel: http://localhost:3000/admin
# Authenticate
pnpm wrangler login
# Deploy (first time - creates D1 database & R2 bucket)
CLOUDFLARE_ENV=production pnpm run deploy
# Subsequent deploys
CLOUDFLARE_ENV=production pnpm run deploy:app
Meridian automatically provisions:
Configure in wrangler.jsonc:
{
"name": "your-project-name",
"compatibility_flags": [
"nodejs_compat",
"nodejs_compat_populate_process_env"
],
"d1_databases": [
{
"binding": "DB",
"database_name": "your-db-name"
}
],
"r2_buckets": [
{
"binding": "R2",
"bucket_name": "your-bucket-name"
}
]
}
You need a Medusa backend. Options:
Medusa Cloud (recommended for quick start)
Self-hosted
# Run all tests
pnpm test
# Individual test suites
pnpm test:unit # Unit tests
pnpm test:int # Integration tests
pnpm test:workflows # GitHub Actions workflow tests
pnpm test:e2e # End-to-end (Playwright)
Contributions welcome! Meridian is open source because we believe in sharing knowledge and building together.
git checkout -b feature/amazing-feature)pnpm test)feat:, fix:, docs:, etc.)See CONTRIBUTING.md for detailed guidelines.
Need help implementing Meridian for your business?
Contact: [Your contact info - update this]
See Issues for full roadmap.
MIT License - see LICENSE for details.
Built with ❤️ by Ian Rothfuss
Meridian builds on incredible open source projects:
If Meridian helps you build better commerce experiences, please consider starring the repo!
Meridian - The optimal point for edge commerce
Just as a meridian represents the sun's highest point, Meridian Commerce represents the peak of e-commerce efficiency—maximum performance at minimum cost.

Full ecommerce store with Payload backend, Next.js storefront, Stripe payments, variants, carts and guest checkout
Shopify-style storefront and admin built on Payload CMS and Next.js with Stripe payments
Next.js and Payload storefront with Stripe checkout, store pickup, order emails and an admin sales dashboard