gmi.software
01 · Your app

Mobile apps

When the app is slow to change, crashes or nobody owns it.

  • Develop or take over an app
  • Loyalty apps
  • Mobile app code audit
  • App maintenance and releases

SFD: 100,000+ downloads, 4.9 App Store rating

02 · Your shop

Online shops

When the platform takes a cut of every sale or blocks what you need.

  • Online shop development
  • Shop app analytics
  • Plan and prototype before you build

120+ projects delivered

03 · Systems behind them

Integrations

When orders, stock and points are copied by hand.

  • ERP, warehouse and payments
  • AI for one manual process
  • Workshops and estimate

100+ integrations

Before a call
  • App cost estimateScope and a budget range
  • Shop platform adviserDecisions, risks and options
  • Shop cost over 5 yearsOff-the-shelf or custom, compared

After workshops: an agreed scope and a fixed price for delivering it

All services →
SFDLoyalty and shopping app100,000+ downloads · 4.9 App Store ratingMój Świat KsiążkiLoyalty programme for a bookstore chain100,000+ downloadsEMKAMedical waste tracking app5000+ downloads in first month
All 120+ projects →App ideas library
TeamAbout usWho we are and how we workCareersHow we work and open roles
Contact and stackContact[email protected]TechnologiesReact Native, MedusaJS, Node.js and the rest
Reviews5.0 on Google4.9 on ClutchClutch ↗ (opens in a new tab)
Blog
ENBook a free consultation
What we do+−

01 · Your app

Mobile apps

  • Develop or take over an app
  • Loyalty apps
  • Mobile app code audit
  • App maintenance and releases

02 · Your shop

Online shops

  • Online shop development
  • Shop app analytics
  • Plan and prototype before you build

03 · Systems behind them

Integrations

  • ERP, warehouse and payments
  • AI for one manual process
  • Workshops and estimate

Before a call

  • App cost estimateScope and a budget range
  • Shop platform adviserDecisions, risks and options
  • Shop cost over 5 yearsOff-the-shelf or custom, compared
All services →
Projects+−
  • SFD100,000+ downloads · 4.9 App Store rating
  • Mój Świat Książki100,000+ downloads
  • EMKA5000+ downloads in first month
  • All 120+ projects →
  • App ideas library
Company+−
  • About usWho we are and how we work
  • CareersHow we work and open roles
  • Contact[email protected]
  • TechnologiesReact Native, MedusaJS, Node.js and the rest
Blog→
Book a free consultation

5.0 on Google · 4.9 on Clutch

Back to blog
E-commerce
Published: November 11, 2026
10 min read

What is Medusa.js v2 and how is its architecture built?

Medusa.js v2 from the inside: the four request layers, commerce and infrastructure modules, module isolation, workflows with step rollback, events, the admin and deployment. It ends with when to choose Medusa over SaaS and how to plan an implementation.

Mikołaj Lehman, CEO & Founder, GMI Software
Mikołaj Lehman
CEO & Founder, GMI Software

In brief

Medusa.js v2 is a headless commerce platform built on Node.js. Storefronts, the admin dashboard and other systems use it through its API. A request passes through four layers: an API route, a workflow holding the business logic, domain modules (cart, order, product and others) and a PostgreSQL database. Modules are isolated from one another, and data is connected through module links rather than direct relations. Custom features are added as modules, workflows, API routes and event subscribers. Medusa makes sense when a company needs its own logic and integrations that a SaaS platform cannot handle without compromise, and has a team that will maintain the code.

Medusa.js v2 is a headless commerce platform built on Node.js. Storefronts, the admin dashboard and other systems use it through its API. A request passes through four layers: an API route, a workflow holding the business logic, domain modules (cart, order, product and others) and a PostgreSQL database. Modules are isolated from one another, and data is connected through module links rather than direct relations. Custom features are added as modules, workflows, API routes and event subscribers. Medusa makes sense when a company needs its own logic and integrations that a SaaS platform cannot handle without compromise, and has a team that will maintain the code.

The short answer

Sources checked on 11 November 2026, against the Medusa v2 documentation; the latest release on that day was v2.22.6.

This guide is for a CTO, architect or product owner who is hearing about Medusa for the first time or assessing it as the foundation of a new store. It explains what a Medusa v2 application consists of, where your own logic goes and what you need to deploy next to it.

The short version: Medusa v2 is a Node.js server with an admin dashboard, built from independent domain modules. Business logic that touches several modules or external systems lives in workflows, which can roll back completed steps after an error. The storefront is a separate application that talks to Medusa through the API.

1. Four layers of a single request

According to the Medusa architecture overview, a request from the storefront or admin first reaches an API route. The server runs on Express.js. The route runs a workflow, the workflow uses modules, and the modules read and write data in the database.

Medusa supports only PostgreSQL as its main database. Another database can be connected only inside a custom module. The table shows where your own code goes in each layer.

1. Four layers of a single request
LayerWhat it doesWhere your own code goes
API routes (HTTP)Entry point for the storefront, admin and external systemsA route.ts file in the src/api directory
WorkflowsBusiness logic made of stepsThe src/workflows directory
ModulesData and operations of one domain or one integrationThe src/modules directory
DatabasePersistent storage of module dataMigrations generated for modules

2. Commerce modules and infrastructure modules

A module is a package of features for one domain: data models (tables) and a service that manages them. After installation the modules on the list of commerce modules are available, including cart, order, product, pricing, promotion, inventory, payment, tax, customer and user. The exceptions are the loyalty module, installed as a plugin, and the Enterprise Edition RBAC module. Their features are exposed through ready-made API routes.

The second group consists of infrastructure modules. They handle technical services, and the provider behind each of them can be replaced:

  • Event Module: event publishing and subscriptions (pub/sub).
  • Workflow Engine Module: workflow orchestration.
  • Caching Module: caching data that is expensive to compute.
  • Locking Module: locks when several processes access the same resources.
  • File Module: file storage, for example product images.
  • Notification Module: sending notifications to customers and users.
  • Analytics Module: forwarding events to an external analytics tool.

Watch the names: the loyalty module on the commerce modules list requires installing the Loyalty Plugin (Medusa v2.14.0+) and, according to the documentation, handles gift cards. A module's name does not yet tell you whether it covers your process; check the description of its features.

3. Module isolation and links between modules

The principle of module isolation means that a module cannot see the services or data models of other modules. Your module cannot, for example, call the product module's service or define a direct relation to its tables.

Data from different modules is connected through module links. For each link Medusa creates a separate table that stores only the IDs of the linked records, with no foreign key constraint. Data from several modules is retrieved with the Query tool.

For an architect this gives a simple rule: you store your own business concept, such as a brand or a trade agreement, in your own module and connect it to a product or customer with a link. You do not change the tables of core modules; according to the documentation, isolation lets you add your own module to an application without side effects on the rest of it.

4. Workflows: business logic with step rollback

According to the workflows documentation, a workflow is a series of steps that completes a task. Unlike a regular function, Medusa tracks the progress of each step, lets you define rollback logic and runs long actions asynchronously. A workflow is executed from an API route, an event subscriber or a scheduled job.

Rollback is described by a step's compensation function: if a step created a record and a later step failed, the compensation deletes that record. This way data in Medusa and in external systems is not left in an intermediate state.

A hypothetical example, not a client project: a wholesaler wants each store order to reach the ERP. The workflow could look like this:

  1. Retrieve the order with its items and customer data using Query.
  2. Map the data to the ERP format: item codes, units, customer account number.
  3. Create the document in the ERP through an integration module; the compensation cancels the document if a later step fails.
  4. Store the ERP document number in your own module and connect it to the order with a module link.
  5. Report the failure to the person responsible if the workflow fails. This is not another workflow step: after an error Medusa runs the compensations, not the remaining steps, so the report is handled by the code that ran the workflow (subscriber, API route or scheduled job).

5. Events, subscribers and scheduled jobs

Medusa emits events during core operations, for example order.placed after an order is placed. The events and subscribers guide shows how to handle them with an asynchronous function in the same codebase, without a separate webhook application.

A subscriber runs outside the main flow, so it suits side actions such as a confirmation email. If the action is essential to the flow itself, the documentation points to workflow hooks instead.

Scheduled jobs run a function on a cron expression while the application is running, for example to sync products with an ERP. For actions that must run while the application is stopped, the documentation recommends custom CLI scripts called by the operating system's scheduler.

Events are handled by the Event Module. The local version, used by default, is meant for development; for production the documentation points to the Redis-based module.

6. Admin, storefront and deployment

The Medusa Admin dashboard is installed together with the application. According to the admin development guide, you can add widgets to existing pages and add new pages, but you cannot change the layout, design or content of existing pages. For heavy changes the documentation suggests building your own dashboard on the Admin API.

The storefront is a separate application. A starting point can be the Next.js Starter Storefront, which since v2.14.0 is placed in one repository (monorepo) with the Medusa application when you install with create-medusa-app. You can also build your own frontend in any technology.

The deployment overview separates the Medusa application (server and admin) from at least one storefront, and they are deployed separately; the server connects to PostgreSQL and Redis. For production the documentation recommends two instances of the same application: a server for requests and a worker for background tasks, and the hosting plan must offer at least 2 GB of RAM. The alternative is managed hosting on Medusa Cloud.

7. When to choose Medusa over a SaaS platform

First, the licence: according to the licence file in the repository, Medusa is available under the MIT licence, except for the Enterprise Edition materials, which require a separate commercial agreement. No licence fee for the core does not mean no cost: you pay for hosting, development and maintenance.

The decision depends on how much of your process goes beyond a standard store and who will maintain the code. The table shows conditions, not a ready verdict.

7. When to choose Medusa over a SaaS platform
SituationPoints to MedusaPoints to SaaS
Sales logicPricing, approval or ordering rules that cannot be expressed in platform settingsThe process fits a standard cart and promotions
IntegrationsSeveral systems (ERP, PIM, WMS) with two-way data exchange and error handlingOne or two integrations available as ready-made apps
ChannelsOne backend for the web store, a mobile app and a sales rep portalA single web store
TeamAn in-house team or partner who knows TypeScript and will maintain the codeNo technical team after launch
InfrastructureReadiness to run PostgreSQL, Redis and workers, or a choice of Medusa CloudYou prefer the vendor to own the core infrastructure

If you sell to businesses and need contract pricing, credit limits and a clear split of responsibility with the ERP, the topic is covered in the Medusa B2B ecommerce guide.

8. The path to implementation

The order below reduces the risk of designing the architecture before understanding the process. Each step ends with a document or a working piece that can be checked.

A time and budget estimate makes sense only after steps 1 and 2, because it depends on the number of custom modules and integrations rather than on Medusa itself.

  1. Describe the sales process: who buys, how the price is formed, what happens after the order, what the exceptions are.
  2. Map the process to modules: what the commerce modules cover, what needs a custom module and what stays in the ERP.
  3. Design integrations as workflows: steps, compensations and who is told about a failure.
  4. Build the shortest purchase path from catalogue to ERP order and check it on test data.
  5. Prepare production: a separate server and worker, Redis for events, database backups and monitoring.
  6. Plan upgrades: who checks new Medusa releases, how often, and how custom modules are tested after an upgrade.

Frequently asked questions

Is Medusa.js free?
The code in the repository is available under the MIT licence, except for the Enterprise Edition materials, which require a separate agreement. Implementation costs are hosting (your own or Medusa Cloud), development of custom modules and integrations, and maintenance.
Which database does Medusa v2 require?
PostgreSQL. The documentation states it is the only supported main database. Another database, such as MongoDB, can be connected only inside a custom module. Production also needs Redis, among other things for events.
Does Medusa include a ready-made storefront?
There is the Next.js Starter Storefront, which can be installed with the application and extended. The storefront remains a separate application, so you can also build your own frontend or a mobile app on the same API.
What is the difference between a module and a workflow?
A module holds the data and operations of one domain and cannot see other modules. A workflow combines steps that use several modules and external systems, tracks their progress and rolls back completed steps after an error.

Describe the process you want to move to Medusa

Describe the process you want to move to Medusa.

Content updated: November 11, 2026

Mikołaj Lehman, CEO & Founder, GMI Software
Mikołaj Lehman
CEO & Founder, GMI Software

Mikołaj Lehman is the CEO and founder of GMI Software. On the blog, he covers decisions around mobile apps, ecommerce and digital product delivery.

  • Mobile apps and React Native
  • Headless and B2B ecommerce
  • MedusaJS
  • Digital product delivery

Google Preferred Sources

See GMI more often in Google

Add gmi.software as a preferred source. Google may highlight our new articles more often in Top Stories and supported AI experiences.

Share article:

Related articles

E-commerce

Multi-vendor marketplace on MedusaJS: what you need to design

Vendor model, data and permission isolation, offer publishing, per-vendor orders and the limits of the Medusa v2 core. Ends with the criteria for building the module yourself or adopting a ready-made one.

→
E-commerce

Playwright E2E testing for ecommerce: a cart and payment regression plan

An E2E test plan for the purchase path of an online store: cart, session, payment on simulated provider responses, return from the payment gateway and order status after a failure, with Playwright settings for CI.

→

Let’s discuss your project.

Tell us what you need. We’ll suggest the next step.

[email protected]
gmi.software Sp. z o.o.ul. Jana Heweliusza 11 / 819
80-890 Gdansk, Poland
Rated 5.0 out of 5 on Google5.017 client reviews on Google
TechnologiesReact NativeExpoNext.jsReactTypeScriptMedusaJS3D configuratorsNode.jsNestJSPostgreSQLDockerAWSPlaywrightMaestro
© 2026 gmi.software Sp. z o.o.
Privacy PolicyTerms