Three systems sound like more work than one, and at the start they are. In return, you never have to bend a webshop into a CMS, or a CMS into a webshop. In this post I walk through how I put the three together, how a booking moves through the system from the first click to a paid order, and which mistakes I've paid for along the way. The examples come mainly from NaturRo, where the stack runs in production, and from Watt-E, where the same two backends are used in a looser way.
Why split commerce and content
Most e-commerce platforms try to be a shop and a CMS at the same time. That works fine as long as the content is a product description, a few images and a price. It starts to creak when the content is what sells the product: a hiking trip with a daily itinerary, a map, a gallery, a packing list and practical info, or a landing page that marketing needs to change without waiting for a developer.
The other way round, a CMS can show a product just fine, but it isn't built for carts, inventory, regions, payments, discount codes and orders. That kind of logic is tedious to write yourself and expensive to get wrong.
So I split the responsibilities:
- Medusa owns everything to do with money and stock: products, variants, prices, capacity, cart, payment, discount codes and orders.
- Payload owns everything meant to be read: pages, descriptions, images, SEO fields and translations.
- React is the only thing the customer sees. The frontend fetches from both and puts it together into one page.
There is one rule I never break: a price, a date or an available seat must not live in the CMS. They always come live from Medusa. As soon as the same piece of information exists in two places, you end up with two sources of truth, and one of them is wrong. In NaturRo's admin it says so in the help text on the field that links a trip to the shop: Medusa is the source of truth for price, capacity and dates.
When does the split make sense
The split isn't free. There are two admin panels, two databases, two sets of upgrades and a frontend that has to know both. I recommend it when at least a couple of these are true:
- The content is a big part of why people buy. The product page is a story, not just a data sheet.
- The products fit badly into a standard webshop: experiences with departure dates and capacity, add-ons, subscriptions or gift cards.
- You need a frontend that looks and behaves exactly as the project requires, without being locked to a theme.
- The client wants to own their data and platform instead of paying monthly for a closed solution.
- Content and commerce are edited by different people, who shouldn't be able to break each other's work.
If you sell ordinary goods with a short description and have no special needs, a ready-made SaaS shop is often the most sensible choice. I'd rather say that out loud at the start than after six months of development.
The architecture
NaturRo lives in a single pnpm monorepo. Each part has its own app:
apps/web: the React frontend, built with Vite.apps/cms: Payload v3.apps/medusa: Medusa v2.apps/map-service: a small FastAPI service that turns GPX files into SVG maps for the trip descriptions.packages/sharedandpackages/ui: shared types, interfaces and UI components.
Both backends use the same Postgres container, but each has its own database. That keeps operations simple without mixing data.
The frontend doesn't know the backends
Page components in the frontend never talk to Payload or Medusa directly. They only know two interfaces, a ContentRepository and a CommerceRepository, and my own view models such as a trip, a cart or an amount. Behind each interface sits an adapter that fetches from the right system and translates the response into the view model.
Dependencies only go one way: pages call hooks, hooks call interfaces, and interfaces are implemented by adapters. The concrete adapters are only created in two places in the code. All of it is enforced with lint rules, so the Payload adapter can't import the Medusa adapter or the other way round.
That sounds like a lot of ceremony for a webshop. It pays off the first time an API changes shape, or when a new page needs data from both systems. I fix one mapper instead of twenty components, and I can test the pages without the backends running.
Medusa is accessed with the official JS SDK and a publishable key. Payload is accessed over plain REST. There's no extra backend-for-frontend layer in between. That's one less thing to run.
The link between content and commerce
The link is deliberately boring. A trip in Payload has a text field, medusaProductHandle, holding the handle of the matching Medusa product. That is the whole integration. The frontend fetches the trip from Payload, reads the handle and asks Medusa for the rest.
That simplicity comes with a cost worth knowing about: if the handle is misspelled, there's no error. The booking calendar just shows that there are no open dates. It's the kind of bug that looks like a business decision, which is why it's one of the first things I check when a trip "can't be booked".
It also means some actions need both systems. To pause a trip, it has to be set to draft in Payload and have its status set to draft in Medusa. Do only one, and the page can be gone while the product can still be bought, or the other way round.
One booking from first click to paid order
The best way to explain the split is to follow a single booking through NaturRo:
- A visitor lands on a trip page. The page is prerendered at build time, so both people and search engines get finished HTML straight away. The text, images and SEO fields come from Payload.
- The frontend asks for departures. Using the trip's handle, it calls a custom endpoint in Medusa that returns all departures with price, capacity and number of available seats in one call. The booking calendar therefore doesn't need a request per date.
- The customer picks a date. Each departure date is a variant of the trip's product with its own capacity. Inventory in Medusa makes sure a full departure can't be booked.
- The customer picks add-ons. Meals, gear and accommodation are separate products added to the cart alongside the trip. Any single-room supplement is set per trip.
- The cart is created. It's created with the publishable key and in the Denmark region with Danish kroner. The region's id is baked into the frontend at build time, and if it's missing, the app looks it up on startup.
- Shipping is chosen automatically. A hiking trip doesn't need shipping, but Medusa still requires a shipping method. The frontend picks a free "Ingen forsendelse" (no shipping) option before completing the cart, so the customer never sees a shipping step.
- The customer pays. Payment happens with Stripe Elements right on the page, by card or MobilePay. MobilePay sends the customer over to the app and back again, and when the customer lands on the confirmation page, the frontend completes the cart and turns it into an order.
- The order is processed. A subscriber in Medusa reacts to the new order, sends a confirmation email and issues codes if the order contains gift cards.
- The customer can create an account. After a guest checkout, the customer can create an account that takes over the order, without having had to log in to buy.
Each step belongs to one system. Content comes from Payload. Everything involving money, seats and orders happens in Medusa. The frontend ties it together. So when something goes wrong, it's fairly clear where to look.
Experiences in a webshop engine
Medusa is built to sell goods, so experiences take a bit of thought. Modelling them like this has worked well:
- One trip is one product. The product carries the name and handle, while all content about the trip lives in Payload.
- One departure is one variant. The variant holds the departure date and capacity in its metadata, and the stock level matches the number of seats.
- Add-ons are their own products. That way they can be priced and stock-managed separately and reused across trips.
- Gift cards are products. When a gift card is bought, Medusa creates a discount code that the recipient can redeem on a later booking.
The advantage is that everything afterwards is plain Medusa: orders, discounts, refunds and reports work as usual, because no parallel booking engine has been built next to it.
Payments in Danish kroner
Payments are where small assumptions get expensive. Three things have taken up the most space:
Pick one unit for amounts, and stick to it. Medusa returns amounts in exactly the unit you seeded the prices in. NaturRo uses øre (cents) everywhere. Watt-E uses kroner. Both work. The most expensive bug came from assuming product prices and cart amounts used different units, and then multiplying by 100 in one place and not the other. The fix was to bring every amount under one policy and one mapper in the frontend.
The Stripe plugin assumes kroner. The standard Stripe integration multiplies the amount by 100 itself, because it expects kroner. With prices in øre, that produced payments a hundred times too large. The fix was a small wrapper around the payment provider that passes the amount through unchanged.
Test and live with one variable. Stripe has no test switch of its own; test or live is decided by which key you use. I have a STRIPE_MODE variable that picks between the test key and the live key, so the switch happens in one place. On the other hand, the payment provider's id is written in three places, and one time the three drifted apart, checkout went down. It's now documented as a warning in the project.
Watt-E: same systems, looser coupling
Watt-E shows that the split doesn't have to be tightly woven together. Here Medusa and Payload each have their own database and their own Docker image, and Medusa sits in an optional add-on to the platform's compose setup. The core platform runs without knowing about Medusa.
Medusa is set up to sell a physical device and a monthly platform subscription. The subscription is built as a custom module with workflows and background jobs for renewal and expiry. When an order is paid, a subscriber grants the customer access to the platform.
Payload manages the landing page content and news. The pricing page uses the same pattern as NaturRo: each pricing card in the CMS has a product handle, and the price itself is fetched live from Medusa. The price is deliberately not stored in the CMS.
Commerce is switched off by default. The Stripe module is only registered when there is a key, and the frontend only shows the store when it's configured. That means commerce can be switched on when the business is ready, without changing the rest of the platform.
Operations on Coolify
Both projects run with Docker Compose on Coolify. Most of it is standard, but a handful of details made the difference between stable operations and late-night restarts:
- Medusa's admin is built together with the server and served under
/appon the same domain as the API. The admin panel's backend URL is baked in at build time, so it has to be set as a build variable. Otherwise the login page tries to call localhost, and you can't log in even though everything looks fine. - Migrations run on startup with a timeout, so a migration that hangs can't block the container forever.
- Telemetry is switched off. A telemetry call made Medusa hang on startup.
- The database pool starts at zero connections. An idle connection made migrations hang.
- Keep-alive is set higher than the proxy's. Traefik reused connections that Node had already closed, which caused sporadic errors. With a longer keep-alive in Node, they went away.
- The frontend is prerendered at build time. A headless browser renders every static page and every trip to static HTML and writes a sitemap, so a plain client-side React app can still be read by search engines.
Pitfalls in Medusa v2
Medusa v2 is good, but there are a handful of things you only learn by running into them. I now check these before I start debugging:
- Prices need a region. Ask for
calculated_pricewithoutregion_id, and Medusa answers with an error instead of a price. In custom endpoints, the region and currency have to be passed along as pricing context. - Every product needs a shipping profile. Otherwise
cart.completefails with an error saying the cart's items require shipping profiles the shipping method doesn't cover. It's the least obvious of them all. - Publishable key to exactly one sales channel. If the key is linked to several, creating carts fails. Use the key's token, which starts with
pk_, not its id. - Build variables get baked in. Every
VITE_*variable is inlined into the frontend's code at build time. If one is missing from the Dockerfile, the SDK falls back to the site's own domain, and the calendar just shows "no dates". You get no error, only wrong behaviour.
None of them are hard to fix once you know them. But if you don't, together they can easily cost a week of mysterious bugs before checkout works.
Checklist before you go live
- One unit for amounts has been decided and written down, and the Stripe integration uses the same unit.
- The region and currency are set, and every price lookup passes the region.
- Every product has a shipping profile, and a shipping method exists even if nothing ships.
- The publishable key is linked to exactly one sales channel.
- Every build variable is declared in the Dockerfiles, and the built bundle contains the right URLs.
- Every piece of content linked to the shop has a handle that exists in Medusa.
- There's a procedure for pausing a product in both systems.
- Test payments have been completed with both card and MobilePay, including the trip back from the MobilePay app.
- Both databases have been backed up, and a restore has been tested.
What you get out of it
- Real e-commerce. Medusa is built for commerce, with variants, inventory, regions, payment, discount codes and orders.
- Content you can edit freely. Trips, pages and campaigns are changed in Payload without touching prices or checkout.
- One cohesive frontend. The customer never notices there are two systems behind it.
- Room for the unusual. Departure dates, add-ons, gift cards and subscriptions are built as ordinary Medusa code.
- Your own data. Everything runs on your own Postgres databases and your own server, not in a closed SaaS.
Looking for a Payload CMS developer in Denmark? Read more about how I work with Payload.
Working in the same stack?
Do you build with Medusa and Payload yourself, or are you considering a similar split between commerce and content? Happy to share experience on booking flows, payments in Danish kroner and keeping two systems separate without it becoming a headache. Get in touch.

