Railway

Deploy Deploy and Host Medusa.js v2 on Railway

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

Deploy Deploy and Host Medusa.js v2 on Railway

Just deployed

Just deployed

/data

/var/lib/postgresql/data

Deploy and Host Medusa.js v2 on Railway

Medusa.js v2 headless commerce engine

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

ServicePurpose
Medusa v2.15.3Headless 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.1Event 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


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

VariableRequiredDescription
MEDUSA_ADMIN_EMAIL✅ RequiredInitial admin login email
MEDUSA_ADMIN_PASSWORD✅ RequiredInitial admin password — set before first boot
JWT_SECRET✅ Auto-generatedSigns admin and customer JWTs
COOKIE_SECRET✅ Auto-generatedSigns admin session cookies
DATABASE_URL✅ Auto-injectedPostgreSQL SSL connection string
REDIS_URL✅ Auto-injectedRedis URI — includes ?family=0 for Railway compatibility
STORE_CORS✅ Auto-setCORS allowlist for your storefront domain
ADMIN_CORS✅ Auto-setCORS allowlist for the admin dashboard
AUTH_CORS✅ Auto-setCORS allowlist for auth endpoints
MEDUSA_WORKER_MODEOptionalshared (default), server, or worker for scaled deployments
DISABLE_MEDUSA_ADMINOptionalSet to true to disable the admin UI in headless-only deployments

Medusa.js v2 vs. Alternatives

Medusa (Railway)Shopify BasicShopify PlusWooCommerce
Monthly platform cost~$10–15$29/monthFrom $2,300/monthHosting 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


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

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.


Template Content

More templates in this category

View Template
Strapi
A popular self-hosted CMS

Milo
7.6K
Deploy
View Template
WordPress with Redis
Deploy WordPress with MariaDB and Redis

Noor Adn
View Template
Docmost
Self-hosted Confluence alternative with real-time collaborative editing.

Tasha