Deployment
Backend — Railway
The Medusa backend (packages/api) is deployed to Railway as a Node.js service.
- Create a Railway project and point it at the repo.
- Set Root Directory to the repo root.
- Set the required env vars (database URL, JWT secret, cookie secret, Redis URL).
- Railway builds and starts the service automatically on push.
Storefront — Railway
The Next.js storefront (apps/storefront) is deployed to Railway.
Required env vars:
| Var | Purpose |
|---|---|
MEDUSA_BACKEND_URL | Medusa backend URL |
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY | Publishable key from the Medusa admin |
NEXT_PUBLIC_BASE_URL | Public storefront URL |
NEXT_PUBLIC_DEFAULT_REGION | Default region (e.g. us) |
NEXT_PUBLIC_SANITY_PROJECT_ID | Sanity project id |
NEXT_PUBLIC_SANITY_DATASET | production |
NEXT_PUBLIC_SANITY_API_VERSION | Pinned API version |
SANITY_API_READ_TOKEN | Server-only read token |
SANITY_REVALIDATE_SECRET | Webhook signature secret |
Admin + Vendor — Railway
Deploy apps/admin and apps/vendor as separate Railway services. Both are static React + Vite builds; configure the build command to bun run build and the publish directory to dist/.
Sanity Studio
Studio is hosted on Sanity's managed infrastructure. Deploy schema changes with:
cd apps/storefront
bun run studio:deploy