Headless e-commerce backend for an AI-built storefront

By Tracklayer · Updated 2026-11-20

Short answer: if you built a storefront with an AI tool and it needs products, carts, orders and an admin for staff, run Medusa as the backend. Medusa is a headless commerce platform: a Node.js server exposes Store and Admin APIs, and any frontend can sell through it. The Tracklayer template deploys Medusa 2.21 on Railway with its admin dashboard, a separate worker, Meilisearch, Postgres, Redis and a bucket for images. It also deploys the official Next.js starter storefront, which you can keep, replace or use as a reference.

Deploy Medusa on Railway

When this makes sense

An AI-built storefront is mostly screens. A shop also needs a catalogue, prices per region, stock, carts, orders, taxes and an admin that non-developers can use. Rebuilding that logic in generated code is slow and easy to get wrong. A headless backend keeps those rules in one place while the frontend stays yours.

Use cases listed in the template documentation:

If you only need a content backend (pages, articles, media) rather than a shop, see the Directus guide instead.

What the template deploys

Seven services run in one Railway project:

Service Purpose Public
Backend Store and Admin API, admin dashboard at /app, runs migrations before each deploy Yes
Worker Subscribers, scheduled jobs, workflows and search indexing No
Storefront Official Next.js 15 starter shop Yes
Media-Proxy Read-only server for images in the private bucket Yes
Meilisearch Product search, on a volume No
Postgres Database No
Redis Sessions, events, workflows, locking, cache No

Search stays private: the storefront calls Medusa’s POST /store/search, so the Meilisearch key never reaches the browser. If you clear MEILISEARCH_HOST on the Backend and Worker, Medusa falls back to its built-in Postgres search.

Deploy it, step by step

  1. Choose a paid plan. The template notes recommend Hobby or higher. Trial’s 1 GB per service is likely to run out during imports and admin use.
  2. Set MEDUSA_ADMIN_EMAIL on the Backend to your own address before deploying. No other input is required.
  3. Deploy and wait. The Backend pre-deploy step runs migrations and creates a demo store. The Storefront waits for the Backend on its first start, so the first deploy takes a while.
  4. Open the admin at https://<backend-domain>/app. Sign in with your email and MEDUSA_ADMIN_PASSWORD from the Backend Variables tab. Change the password.
  5. Open the Storefront domain. The demo region and products should be live. The storefront receives its publishable API key from the Backend over the private network at start, so nothing is copied by hand.
  6. Replace the demo data with your own products, regions and prices in the admin.

Connecting your own storefront

The included storefront shows how a frontend talks to Medusa. If you keep your AI-built frontend instead:

After adding custom domains, the template notes list the variables to update: STORE_CORS, ADMIN_CORS, AUTH_CORS and MEDUSA_BACKEND_URL on the Backend, and NEXT_PUBLIC_MEDUSA_BACKEND_URL and NEXT_PUBLIC_BASE_URL on the Storefront.

What it costs

The figures below are estimates from the template’s TEMPLATE.md for a small store (a few hundred products, light traffic). They were not measured on Railway. They use Railway prices of $10 per GB of RAM per month, $20 per vCPU per month, $0.15 per GB of volume per month and $0.015 per GB of bucket storage, with 2 GB assumed in the bucket. Network egress is not included.

Load RAM vCPU Estimated monthly cost
Idle about 1.2 GB about 0.09 about $14
Typical about 2.7 GB about 0.84 about $45

Each extra Worker replica adds about 0.7 GB and 0.2 vCPU, roughly $11 per month at typical load by the same estimate. Your bill depends on traffic, catalogue size and bucket use.

Scaling and upgrades

The Backend, Worker and Storefront are stateless and can run more replicas; raise the Worker’s replica count when background jobs queue up. Meilisearch, Postgres and Redis run as single instances because each owns a volume. The starter is pinned to a commit, so upgrades are deliberate, not automatic.

Limitations and licence notes

Other options

Browse all guides.

FAQ

How do I log in to the Medusa admin?

Set MEDUSA_ADMIN_EMAIL on the Backend service to your own address before deploying (the default is admin@example.com). When all services are healthy, open the backend domain at /app and sign 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 off by default. Add STRIPE_API_KEY and STRIPE_WEBHOOK_SECRET on the Backend, and NEXT_PUBLIC_STRIPE_KEY on the included storefront, when you are ready. Then enable the Stripe provider per region in the admin.

Is the data kept when I redeploy, and how do I upgrade?

Postgres, Redis and Meilisearch each use a volume, and uploads go to a Railway Bucket. The starter commit and the Meilisearch plugin version are build arguments in the backend and storefront Dockerfiles. Change them together, check the plugin's Medusa compatibility and redeploy; migrations run automatically. Take a dump or snapshot before upgrading Meilisearch.

Are there licence restrictions?

According to the template's NOTICE.md, Medusa and the DTC starter are MIT, and Medusa Enterprise Edition materials are not enabled. Meilisearch Community Edition is MIT; its Enterprise parts (BUSL-1.1) are not used. Redis 8 is offered under RSALv2, SSPLv1 or AGPLv3. If licensing matters for your business, check with a lawyer.