Medusa v2 Commerce Store (Backend + Storefront)

Deploys a Medusa 2.21 store: backend with admin dashboard, background worker, the Next.js 15 storefront from the official dtc-starter, Meilisearch search, Postgres, Redis and a Railway Bucket for product images. A community template.

What you get

  • Medusa Backend (Store and Admin API, admin at /app) and a separate Worker for subscribers, scheduled jobs, workflows and search indexing
  • The dtc-starter Next.js 15 storefront, pinned to a commit, receiving its publishable key automatically over the private network
  • Meilisearch v1.54.3 on a volume, kept private behind Medusa's search endpoint
  • Postgres 18 and Redis 8.2; migrations run in a pre-deploy step with demo region and products
  • A private Railway Bucket for uploads served through a read-only media proxy

Good for

  • A direct-to-consumer web shop with a custom Next.js storefront
  • A headless commerce backend for mobile apps, marketplaces or B2B portals
  • Multi-region stores with separate currencies, taxes and fulfilment settings
  • A proof of concept before moving off a hosted e-commerce platform

Services in this template

  • Storefront · from baranberkay96/medusa-railway
  • Meilisearch · image getmeili/meilisearch:v1.54.3
  • Redis · image redis:8.2
  • Postgres · image ghcr.io/railwayapp-templates/postgres-ssl:18
  • Worker · from baranberkay96/medusa-railway
  • Backend · from baranberkay96/medusa-railway
  • Media-Proxy · from baranberkay96/medusa-railway

Questions people ask

How do I log in to the admin?

Set MEDUSA_ADMIN_EMAIL on the Backend before deploying (default admin@example.com). After the services are healthy, open the backend domain at /app and log in with that email and the generated MEDUSA_ADMIN_PASSWORD from the Backend Variables tab, then change the password.

How do I take payments?

Payments are not live by default. Add STRIPE_API_KEY and STRIPE_WEBHOOK_SECRET on the Backend and NEXT_PUBLIC_STRIPE_KEY on the Storefront when you are ready.

What drives the cost?

Seven services run: Backend, Worker, Storefront, media proxy, Meilisearch, Postgres and Redis, plus bucket storage. Workers, Backend and Storefront can run more replicas. The template notes recommend the Hobby plan or higher, since Trial's 1 GB per service is likely to run out during imports and admin use.

What persists, and how do I upgrade?

Postgres, Redis and Meilisearch use volumes, and uploads sit in the Bucket. The starter commit and the Meilisearch plugin version are build arguments in the backend and storefront Dockerfiles; change them together and redeploy, and migrations run automatically. Upgrade Meilisearch with a dump or snapshot first.

Any licence notes?

Medusa, the starter and Meilisearch Community are MIT; Medusa Enterprise Edition materials and Meilisearch Enterprise parts (BUSL-1.1) are not enabled or used. Redis 8 is RSALv2, SSPLv1 or AGPLv3.

Full template README

Deploy and Host Medusa with Railway

Launch a complete Medusa v2 store on Railway: the Medusa backend with its admin dashboard, a background worker, the official Next.js storefront, Meilisearch-powered search, Postgres, Redis and product images in a Railway Bucket. The admin user and the storefront's API key are set up automatically on the first deploy. Community template.

About Hosting Medusa

Medusa is a headless commerce platform: a Node.js backend exposes Store and Admin APIs, and any frontend can sell through it. A production setup needs more than one process. Medusa recommends running the HTTP server and a separate worker for subscribers, scheduled jobs and workflows, both backed by Postgres and Redis, with uploads in object storage. This template builds the backend and storefront from the official medusajs/dtc-starter at a pinned commit, runs migrations in a pre-deploy step, stores files in a private Railway Bucket served through a small read-only media proxy, and hands the storefront its publishable key at start-up over the private network, so nothing has to be copied by hand.

Common Use Cases

  • Direct-to-consumer web shops with a custom Next.js storefront
  • Headless commerce backend for mobile apps, marketplaces or B2B portals
  • Multi-region stores with separate currencies, taxes and fulfilment settings
  • Migration or proof of concept before moving off a hosted e-commerce platform
  • Agencies building client stores on a reproducible, pinned stack

Dependencies for Medusa Hosting

  • Medusa 2.21 backend (server + worker) and Next.js 15 storefront from medusajs/dtc-starter
  • Postgres 18 and Redis 8.2 (Railway base services)
  • Meilisearch v1.54 with @rokmohar/medusa-plugin-meilisearch
  • Railway Bucket for uploads, plus a Bun media proxy for public file URLs

Deployment Dependencies

Implementation Details

Service Source Purpose
Backend dtc-starter apps/backend (Medusa 2.21.2) Store/Admin API, admin at /app, runs migrations before each deploy (public)
Worker same image, MEDUSA_WORKER_MODE=worker Subscribers, scheduled jobs, workflows, search indexing (private, scalable)
Storefront dtc-starter apps/storefront (Next.js 15) Customer-facing shop (public)
Media-Proxy oven/bun:1.4.2-alpine + template code Serves images/videos from the private Bucket (public, read-only)
Meilisearch getmeili/meilisearch:v1.54.3 Search engine, volume /meili_data (private)
Postgres postgres-ssl:18 Database (private)
Redis redis:8.2 Sessions, events, workflows, locking, cache (private)

First login

  1. Before deploying, set MEDUSA_ADMIN_EMAIL on the Backend to your address (default admin@example.com). No other input is needed.
  2. Wait for the Backend pre-deploy (migrations + demo store) and for all services to turn healthy; the Storefront waits for the Backend on its first start.
  3. Open https://{backend-domain}/app and log in with MEDUSA_ADMIN_EMAIL and the generated MEDUSA_ADMIN_PASSWORD from the Backend's Variables tab. Change the password.
  4. Open the Storefront domain: the demo region and products are live. Add Stripe keys (STRIPE_API_KEY, STRIPE_WEBHOOK_SECRET on the Backend, NEXT_PUBLIC_STRIPE_KEY on the Storefront) when you are ready to take payments.

Scaling workers: raise the Worker's replica count in Railway; it is stateless and coordinates through Redis. The Backend and Storefront are stateless too and can run more replicas. Meilisearch, Postgres and Redis keep one instance each (they own volumes).

Search: the storefront calls Medusa's POST /store/search; Meilisearch stays private and its key never reaches the browser. To fall back to Medusa's built-in Postgres search, clear MEILISEARCH_HOST on the Backend and Worker.

Custom domains: after adding domains, update STORE_CORS, ADMIN_CORS, AUTH_CORS and MEDUSA_BACKEND_URL on the Backend, NEXT_PUBLIC_MEDUSA_BACKEND_URL and NEXT_PUBLIC_BASE_URL on the Storefront, and S3_FILE_URL if the media proxy gets its own domain.

Pinning and upgrades: the starter commit (DTC_STARTER_REF) and the Meilisearch plugin version (MEILISEARCH_PLUGIN_VERSION) are build arguments in services/backend/Dockerfile and services/storefront/Dockerfile. Change them together, check the plugin's Medusa compatibility, and redeploy; migrations run automatically. Upgrade Meilisearch with a dump/snapshot first, following its upgrade guide.

Why Deploy Medusa on Railway?

Railway runs the backend, worker, storefront and data services side by side on a private network, with pre-deploy migrations, generated secrets, volumes, a managed bucket and per-second billing. You get a production-shaped Medusa store from one deploy and can scale the API, workers and storefront independently as traffic grows.

Guides for this template

View Medusa v2 Commerce Store (Backend + Storefront) on railway.com

Similar templates

TemplateCategoryDeploymentsDeploys
Chatwoot
A customer communication platform
Other5,871
Ubuntu-Linux
Ubuntu terminal accessible via web browser
Other4,926
Ubuntu SSH + Claude
ARA TM —SSH server with root access + Claude Code pre-installed.
Other4,682
Debian-Linux
Debian terminal accessible via web browser.
Other2,883
Code Server
VS Code in the browser
Other2,787
Kali Linux (Web Terminal)
Instant Kali Linux browser terminal powered by ttyd
Other2,632