---
title: "Deploy Medusa.js | Shopify Alternative"
description: "Self-host Medusa.js v2. Zero transaction fees. Own your store data."
category: "CMS"
url: https://railway.com/deploy/medusa-headless-commerce
---

# Deploy Medusa.js | Shopify Alternative

Self-host Medusa.js v2. Zero transaction fees. Own your store data.

**[Deploy Medusa.js | Shopify Alternative on Railway](https://railway.com/template/medusa-headless-commerce)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/medusa-headless-commerce/manifest.json

- **Creator:** SilverBanana
- **Category:** CMS
- **Total deploys:** 12

## Template content

### Medusa https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/medusa-light.svg

- **Source:** sahilrupani/medusa-railway

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Documentation

# Deploy and Host Medusa.js v2 on Railway

![Medusa.js v2 headless commerce engine](https://cdn.sanity.io/images/5a711ubd/production/73ede9fccb57607fd0c48863b88a9ad4965fef18-1000x420.webp?w=1200)

Medusa.js v2 is the open-source headless commerce engine with **34k+ GitHub stars**, an MIT
license, and zero per-transaction platform fees — adopted by Heineken, Mitsubishi, and Tekla.
A TypeScript + Node.js backend that exposes Store, Admin, and Workflow APIs for any frontend
(Next.js, Remix, mobile, POS), with every commerce primitive — products, carts, orders,
payments, fulfillment, inventory — as a swappable independent module.

**Shopify charges 0.5–2% per transaction on top of $29–$299/month.** On $500k annual GMV
that's up to $10,000 in platform fees before a single subscription payment. Medusa on Railway
costs ~$10–15/month flat. Your revenue. Your data. Your codebase.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Medusa v2.15.3** | Headless commerce backend — Store API, Admin API, Workflow engine, and admin dashboard at `/app` on port `9000` |
| **PostgreSQL (SSL)** | Primary commerce database — products, orders, carts, customers, inventory, and all transactional data |
| **Redis 8.2.1** | Event bus, cache layer, and workflow engine state — required for durable retryable commerce workflows |

All three services connect over Railway's private internal network. `DATABASE_URL` and
`REDIS_URL` are injected automatically. `JWT_SECRET`, `COOKIE_SECRET`, and CORS headers are
auto-generated at deploy time — zero `.env` editing required.

---

## About Hosting Medusa.js v2

Running Medusa v2 in production requires coordinating a Node.js application server, PostgreSQL
database, and Redis queue — plus generating cryptographic secrets, configuring CORS for your
storefront domains, and running database migrations on every deployment. Without a managed
host, you're managing Docker Compose, SSL, secret rotation, and migration scripts manually.

This template handles all of it — auto-generated secrets, pre-configured CORS, and
`medusa db:migrate` on every deploy. Fork the source repo to add modules or workflows;
Railway auto-deploys on every `git push`.

Typical cost: **~$10–15/month** on Railway's Hobby plan. Shopify Basic costs $29/month
plus 2% per transaction. WooCommerce scales poorly past 10k orders. Medusa eliminates
platform transaction fees — you pay only Stripe's 2.9% + $0.30.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — Medusa, PostgreSQL, and Redis build automatically (~3–5 min)
2. Set `MEDUSA_ADMIN_EMAIL` and `MEDUSA_ADMIN_PASSWORD` in the Variables tab
3. Wait for the healthcheck at `/health` to go green
4. Open `[your-domain]/app` — the Medusa admin dashboard loads immediately
5. Go to **Settings → Regions** to configure currencies, then **Settings → Publishable API
   Keys** to get your storefront key
6. Connect any frontend — Next.js Commerce, Remix, or a custom storefront via Store API

No SSH. No migration scripts. No secret management.

![Medusa.js v2 Railway three-service architecture](https://medusajs.com/_next/static/media/admin.299d3bc5.png)

---

## Common Use Cases

- **Self-hosted alternative to Shopify** — eliminate 0.5–2% transaction fees and $29–299/month
  subscriptions; your Medusa backend connects directly to Stripe with no platform cut on revenue
- **Self-hosted alternative to Shopify Plus** — Shopify Plus starts at $2,300/month; Medusa
  gives enterprise-grade multi-region, B2B, and marketplace capability at flat compute cost
- **Headless Next.js e-commerce backend** — pair Medusa's Store API with Next.js Commerce on
  Vercel or Railway for a fully composable storefront with sub-100ms API responses
- **B2B portal with company accounts and custom pricing** — Medusa's B2B starter supports
  company accounts, quote requests, custom price lists, and net-30 invoicing out of the box
- **Multi-vendor marketplace** — Mercur (built on Medusa v2) is a production-ready marketplace
  framework for multi-seller storefronts with split payments and seller dashboards
- **Shopify migration for scaling brands** — brands outgrowing Shopify's transaction fees or
  API rate limits migrate backend-first; Medusa's REST API mirrors Shopify's surface closely

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `MEDUSA_ADMIN_EMAIL` | ✅ Required | Initial admin login email |
| `MEDUSA_ADMIN_PASSWORD` | ✅ Required | Initial admin password — set before first boot |
| `JWT_SECRET` | ✅ Auto-generated | Signs admin and customer JWTs |
| `COOKIE_SECRET` | ✅ Auto-generated | Signs admin session cookies |
| `DATABASE_URL` | ✅ Auto-injected | PostgreSQL SSL connection string |
| `REDIS_URL` | ✅ Auto-injected | Redis URI — includes `?family=0` for Railway compatibility |
| `STORE_CORS` | ✅ Auto-set | CORS allowlist for your storefront domain |
| `ADMIN_CORS` | ✅ Auto-set | CORS allowlist for the admin dashboard |
| `AUTH_CORS` | ✅ Auto-set | CORS allowlist for auth endpoints |
| `MEDUSA_WORKER_MODE` | Optional | `shared` (default), `server`, or `worker` for scaled deployments |
| `DISABLE_MEDUSA_ADMIN` | Optional | Set to `true` to disable the admin UI in headless-only deployments |

---

## Medusa.js v2 vs. Alternatives

| | Medusa (Railway) | Shopify Basic | Shopify Plus | WooCommerce |
|---|---|---|---|---|
| **Monthly platform cost** | ~$10–15 | $29/month | From $2,300/month | Hosting cost |
| **Transaction fee** | ✅ None | ❌ Up to 2% | ❌ 0.25% | ✅ None |
| **$500k GMV fee** | ✅ $0 | ❌ Up to $10,000 | ❌ $1,250 | ✅ $0 |
| **Open source / MIT** | ✅ Yes | ❌ No | ❌ No | ✅ GPL |
| **Data ownership** | ✅ Your PostgreSQL | ❌ Shopify servers | ❌ Shopify servers | ✅ Your DB |
| **B2B out of the box** | ✅ Yes | ❌ App required | ✅ Yes | ❌ Plugin required |
| **Workflow engine** | ✅ Durable + retryable | ❌ No | ❌ No | ❌ No |
| **Multi-region** | ✅ Native | ⚠️ Shopify Markets | ✅ Yes | ❌ Plugin required |
| **API-first** | ✅ REST + events | ⚠️ Storefront API only | ✅ Yes | ❌ Limited REST |

![Medusa.js v2 admin dashboard — products, orders, and customers](https://res.cloudinary.com/asset-cloudinary/image/upload/v1778613742/2925d054-ac01-4175-9b19-fd1eae9054f2.png)

---

## Dependencies for Medusa.js v2 Hosting

- Railway account — Hobby plan (~$10–15/month) for the full three-service stack
- Stripe account for payment processing (2.9% + $0.30 — no additional platform fee)
- A storefront — Next.js Commerce, custom React/Remix app, or mobile frontend

### Deployment Dependencies

- [Medusa GitHub Repository](https://github.com/medusajs/medusa) — source and releases
- [Medusa Documentation](https://docs.medusajs.com) — full API and module reference
- [Next.js Commerce Starter](https://github.com/medusajs/nextjs-starter-medusa) — storefront
- [Medusa B2B Starter](https://github.com/medusajs/b2b-starter-medusa) — B2B portal starter
- [Mercur Marketplace](https://mercurjs.com) — multi-vendor marketplace on Medusa v2

### Implementation Details

Deploys Medusa v2.15.3 from `praveen-ks-2001/medusa-railway` alongside PostgreSQL SSL and
Redis over Railway's private network. `medusa db:migrate` runs on every deploy automatically.
Fork the repo to add modules or custom endpoints — Railway auto-deploys on `git push`.

---

## Frequently Asked Questions

**How much does Medusa save vs Shopify on transaction fees?**
Shopify Basic charges up to 2% per transaction without Shopify Payments. On $500k GMV that's
$10,000 in fees per year. On $1M GMV it's $20,000. Medusa on Railway costs ~$120–180/year
in compute — you pay only Stripe's standard 2.9% + $0.30 per transaction with no platform
cut on top. The break-even point against Shopify is well under $10,000 annual GMV.

**How is Medusa different from WooCommerce or PrestaShop?**
Medusa is API-first and headless — there's no bundled frontend. You build or use any
storefront that calls the Store API. WooCommerce is a WordPress plugin that couples frontend
and backend; it struggles past 10,000 orders and requires plugin management for basic
features. Medusa's modular architecture handles multi-region, B2B, marketplace, and
subscription use cases natively without plugins.

**Do I need a developer to use Medusa?**
The admin dashboard at `/app` handles product management, orders, customers, inventory, and
promotions without code. You need a developer to build and deploy your storefront — Medusa
provides no hosted storefront. Use the Next.js Commerce starter for the fastest frontend
setup.

**Does my store data stay private?**
Yes. All product data, order history, customer records, and transactional data are stored in
your Railway PostgreSQL instance. Medusa does not share commerce data with third-party
analytics or advertising platforms. You own the schema and can export or migrate at any time.

**Can I migrate from Shopify to Medusa?**
Yes. Export products, customers, and orders from Shopify as CSV and import via Medusa's
bulk import tools or REST API. The Medusa docs include a Shopify migration guide.

**How do I update to a newer Medusa version?**
Update the `medusa` package version in your forked repo's `package.json` and push to your
branch. Railway triggers a rebuild automatically. `medusa db:migrate` runs on startup to
apply any schema changes. Review the Medusa changelog before major version bumps.

---

## Why Deploy and Host Medusa.js v2 on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your
infrastructure so you don't have to deal with configuration, while allowing you to vertically
and horizontally scale it.

By deploying Medusa.js v2 on Railway, you get a production-grade headless commerce backend
— modular, API-first, MIT-licensed, with zero transaction fees and full ownership of your
product catalogue, order history, and customer data — at ~$10–15/month flat.

## Similar templates

- [Libredesk - Complete Setup](https://railway.com/deploy/libredesk-complete-setup) — Complete self-hosted omnichannel customer support desk.
- [Paperless-ngx](https://railway.com/deploy/paperless-ngx-3) — Paperless-ngx — document management with OCR and full-text search
- [Instatic CMS - Postgres](https://railway.com/deploy/instatic-cms-postgres) — Design, build and manage powerful static sites from state-of-the-art CMS

Open this page in a browser: https://railway.com/deploy/medusa-headless-commerce
