Rock8Cloud
Blueprints

Medusa + TanStack Start Commerce - Blueprint

Headless commerce starter with Medusa 2, a TanStack Start storefront, PostgreSQL, and Redis

A complete headless commerce starter built with Medusa 2 and TanStack Start, managed as a Turborepo monorepo with Bun workspaces. One repository, two services, a database, and Redis, all wired up on deploy.

Tech stack:

LayerTechnology
CommerceMedusa 2 - API, admin dashboard at /app, workflows, modules, port 9000
StorefrontTanStack Start + Medusa JS SDK + Tailwind v4 on React 19, port 3000
DatabasePostgreSQL via DATABASE_URL
RedisCache, event bus, workflow engine and locking for Medusa, via REDIS_URL

The storefront covers the whole buying path: catalog, categories, search, product variants, cart with promo codes, a three-step checkout, order confirmation, and customer accounts. Its UI is in Czech. Change the copy to suit your shop.

View on GitHub →

What You Get

  • A private clone of the monorepo in your GitHub account, one repo for both services
  • Two Rock8Cloud services: the Medusa backend with its admin, and the storefront
  • A managed PostgreSQL database and a managed Redis, pre-wired via DATABASE_URL and REDIS_URL
  • A seeded store on the first boot: a Europe region, demo products, and the publishable API key the storefront already uses

JWT_SECRET, COOKIE_SECRET and the admin password are generated per deploy. The CORS variables and the backend URL of the storefront are set to the service URLs automatically.

The backend starts with 1 GiB of memory. Medusa idles near 460 MiB, so do not size it below that.

Deploy it from Blueprints in the dashboard, or from an agent over MCP with deploy_blueprint and the medusa-tanstack slug.


First Sign-In

The first backend boot runs the migrations, seeds the store, and creates the admin user, so it takes a few minutes. The storefront shows an empty shop until then.

  1. Open the backend service and read MEDUSA_ADMIN_EMAIL and MEDUSA_ADMIN_PASSWORD in its environment variables. The email is the one you entered in the deploy dialog, admin@example.com by default
  2. Sign in at <backend URL>/app

Migrations

Migrations run only while the database is empty, to keep restarts fast. After you add a migration or upgrade Medusa, deploy the backend once with FORCE_MIGRATE=true.

Publishable API Key

The Store API answers only requests that carry a publishable key. The seed creates the key with a pinned value that the storefront already uses, so both work on the first deploy. A publishable key is public by design.

To use your own key, set MEDUSA_PUBLISHABLE_KEY on the backend before its first deploy and VITE_MEDUSA_PUBLISHABLE_KEY on the storefront, with the build stage, to the same pk_... value. Later changes go through Settings > Publishable API Keys in the admin.

Custom Domains

The storefront bakes the backend URL in at build time (VITE_MEDUSA_BACKEND_URL). After adding a custom domain:

  • Domain on the backend: update VITE_MEDUSA_BACKEND_URL on the storefront and redeploy it, then update ADMIN_CORS and AUTH_CORS on the backend
  • Domain on the storefront: update STORE_CORS on the backend

Product Images

Images uploaded in the admin are stored on the container disk and do not survive a redeploy. The demo products use hosted images. Configure a Medusa file provider backed by S3 Storage before you rely on uploads.


Customizing

  • API routes go under apps/backend/src/api/, data models under apps/backend/src/modules/
  • Subscribers in apps/backend/src/subscribers/ run through the Redis event bus
  • Admin widgets and pages go under apps/backend/src/admin/
  • Storefront pages go under apps/tanstack-storefront/src/routes/, with their Medusa calls as server functions in src/lib/server/

Each service builds from its own Dockerfile (apps/backend/Dockerfile and apps/tanstack-storefront/Dockerfile) with the repository root as the build context. Push to your default branch and Rock8Cloud rebuilds both.


On this page