Petr ŠebelaPetr Šebela

Composable Commerce and MACH: A Revolutionary Modular Approach to E-Commerce

Time-consuming implementation of new modules? Working with old, unmaintained code? Technical debt? Slow loading times? If questions like these are troubling you, give the following article a read — it'll try to introduce you to composable commerce.

August 1, 2023|14 minutes read

Composable commerce is an innovative approach to e-commerce that builds an application out of existing solutions. Connecting software through APIs creates a flexible environment that lets you easily modify services and swap them out for others. That eliminates lengthy development burdened by technical debt, and lets you focus on fast time-to-market and time-to-value.

Composable commerce

What are the
benefits of composable?

The composable commerce concept is based on using existing solutions. By connecting through APIs, you sync up the functionality of individual pieces of software, which together make up the resulting application. End users interact with a headless frontend that's connected to the backend via API.

Combined with MACH architecture, this creates a flexible environment you can easily modify by swapping in different software, so there's no need to maintain these services in-house. The benefits of the composable commerce concept are:

Flexibility and agility (not limited by software)

There are plenty of services, both paid and open-source, that cover most requirements. Where needed, these solutions can also be customized. Choose whichever suitable solution supports a composable commerce approach (an API interface). A service can easily be swapped for another once it no longer fits your needs, so your application isn't locked into specific services.

You can also easily implement different sales channels (web, mobile app, voice assistant…) thanks to APIs. You get to define exactly how the resulting product looks and works. Services are maintained by their providers, so they stay up to date and are continuously improved without any need for in-house maintenance.

Time-to-value

By using existing, working, tested software, you save the time you'd otherwise spend building your own.

Time-to-market

Getting your product into real-world operation and in front of customers is absolutely essential. With composable commerce, you get there in a fraction of the time.

Developer experience

All the applications stay up to date, so you're never working with old, unmaintained code that no longer makes sense. All you have to handle is the integration and any extensions.

Auto-scale

The application runs on a cloud that supports auto-scaling. That means you'll avoid outages during traffic spikes, when the site is under heavy load from users.

When flexibility meets reality,
or, the downsides of composable

Using the composable commerce concept also comes with certain downsides. This mainly applies to paid external services running on a provider's external cloud. An open-source solution on your own cloud can usually be customized.

Dependence on external providers

An external service running on a provider's cloud can experience an outage that's outside your control. So it comes down to how reliable that provider's service is, and how well they're able to respond to an outage.

These services can also stop working entirely if the provider decides to discontinue them. That said, most offer an SLA agreement on higher tiers, guaranteeing they'll resolve problems and outages.

Higher monthly costs

If you're using external services running on their own cloud, you may end up with higher monthly costs than with a monolithic solution. On the other hand, compared to a monolithic solution, you save on the high upfront costs of building the application and on maintenance costs. You're not just paying for the use of the service — you're also paying for its own server and database.

Security and GDPR

The external provider is responsible for keeping your data safe. They need to secure the service so that only authorized users can access its data, and the same applies to the API interface. When it comes to storing website users' data, they also need to comply with GDPR.

MACH architecture

The second concept building on composable commerce is MACH architecture. Simply put, it's about the use of Microservices, API, Cloud and Headless. MACH, just like composable commerce, lets you transition to these concepts through gradual implementation. MACH architecture and the composable commerce concept connect and complement each other, offering an approach built for flexible, easily extensible application development.

Mach architektura

Microservices

Individual functions are separated into services that can be modified and developed independently, without affecting other parts. Each service serves its own specific purpose — such as search, checkout, or the product catalog. Each service runs independently, so if one fails, it doesn't take down the whole application.

API first

The individual services communicate with each other via APIs. That lets you freely change and combine services.

Cloud-native SaaS

Everything runs on a scalable cloud that can be adapted as needed. No installation is required, changes to the application happen instantly, with no need for the user to update anything. Changes to the application don't affect its operation or usability.

Headless (FEaaS)

Headless lets you run multiple frontends without being tied to a specific technology. It allows for better tailoring of the user experience. Browsing the frontend is faster, because the backend doesn't need to make as many database queries — connected software built specifically for that purpose handles it instead. A well-implemented headless solution enables significantly faster page loading than a monolithic solution, which has a positive impact on things like UX, conversions, and SEO.

Interested in frontend news?

Sign up for our newsletter or follow us on social media.

What should you choose?
Composable vs. monolith

The main advantage of composable over a monolithic solution is agility for working efficiently with individual PBCs (packaged business capabilities). A PBC is quite similar to a microservice, except that a PBC handles complex functionality (cart, CRM, helpdesk...). Microservices, however, can also handle more complex functionality, in which case they can overlap with PBCs.

The composable concept focuses development on a specific PBC, without needing to worry about the rest of the application. A PBC can easily be swapped for another without affecting other functionality, and it's easy to extend. Using an open-source or paid solution managed by a provider keeps the PBC up to date without any need for in-house maintenance.

Thanks to the headless approach, you can achieve a more user-friendly environment. It lets you create an unlimited number of sales channels targeting different platforms (web, mobile apps, voice assistants…) — ideally using a PWA (progressive web application) to create a user-friendly environment for users on mobile devices.

Porovnání Composable commerce a Monolithic platform

An example of an architecture using
the composable commerce concept

At the core of this architecture is the open-source Medusa, which implements the commerce modules (PBCs):

  • PIM (Product information management) - product management
  • OMS (Order management system) - order management
  • Cart + checkout
  • CRM (Customer relationship management) - customer management
  • ROS (Retail Operating System) - order fulfillment including returns + booking management
  • Tax management
  • Price management + discount and promotion management
  • WMS (Warehouse management system) - warehouse management

If we wanted to go deeper into the composable commerce concept and wanted more complex PBCs, we could use, for example:

Connected to Medusa is our own “EventBridge”, which receives webhooks from Medusa. Medusa sends webhooks in response to events (an order being completed, an account being created…). EventBridge then carries out the necessary actions — for example, after an order is completed, it creates an invoice in Fakturoid, sends an informational email through Sendgrid, adds bonus points to Talon.one or forwards the necessary data to the ERP system ABRA Flexi.

Medusa is also connected to other PBCs:

  • Website content
    • Strapi - an open-source CMS (content management system). Strapi is used to manage and display content on the frontend
  • Customer service
  • Search engine
    • Meilisearch - an open-source search engine (an alternative to ElasticsearchAlgolia). Medusa syncs products, categories, and articles to Meilisearch, where they get indexed
  • Payment&Shipping
  • Marketing
  • Monitoring
    • Pagespeed.one - website speed monitoring
    • Sentry - error monitoring
    • Prometheus - server monitoring
    • Slack - the e-shop sends notifications to our internal Slack - for example, letting us know a new order has come in
  • Invoicing
  • ABRA Flexi - the ERP is used to manage e-shop operations

What matters to the user:
the frontend

We present customers with a frontend that runs on the REACT framework Next.js. Alternatively, you could also use an existing storefront solution, such as StoreFront XVueStorefront or ReactStorefront. The frontend displays data it retrieves from the individual PBCs. Content for the app is handled by the open-source CMS Strapi, from which the frontend retrieves the data to display.

Product/category/article search is powered by the search engine Meilisearch. We also use it to list and filter products in the catalog. Meilisearch can be an ideal solution for an e-shop thanks to its “Search as you type” feature, which lets users see results instantly.

Live chat Smartsupp serves as online support for customers.

Product detail pages, adding to cart, and checkout are all handled by Medusa, which — besides its standard API — also provides a Storefront API for interacting with the frontend. Our work is also made easier by the JavaScript client or Medusa React.

As our payment gateway provider, we use Comgate.

Login, registration, and the user profile — including an order overview — are also handled through Medusa, which supports all of these features.

The loyalty program and rewards use the external Talon.one service, which offers the products Loyalty management a Rewards management.

How to get started?

You can transition to the composable commerce concept gradually, within an existing solution. Break your project down into the individual PBCs that make up your application. For each PBC, use a suitable open-source or paid solution, or build your own.

One way to build your own PBC is to separate a part of the application into its own service with its own API interface. This lets it communicate with the application core, other PBCs, and the frontend.

Once the application is broken down into individual PBCs with API interfaces, you can start implementing sales channels — a frontend for web browsers and mobile apps.

The goal is to split functionality into PBCs that each have their own database and API interface. This lets them communicate with each other and with the frontends (sales channels). The application also stays flexible and runs on a scalable cloud.

Conclusion

Composable commerce and MACH architecture represent the future of commerce platforms. This concept offers flexibility, agility, easy integration of sales channels, and sustainable application development. By using existing solutions connected through APIs, businesses can build an ideal software stack and focus on the end product.

Composable commerce makes it easy to modify and extend your application, without the time-consuming work of developing and maintaining legacy code. MACH architecture — with its microservices, API-first approach, cloud-native environment, and headless structure — brings the benefits of fast page loading, easy service swapping, and automatic scaling.