Why you should have at least one middleware with your E-Commerce

Don’t stuff your e-commerce with all the logic, split it up for stability, performance, security and maintainability.

Pixabay — Idea

First, What is a middleware?

Middleware is a very loose term, but basically, it’s a piece of software between 2 other pieces of software. Software A can’t communicate with software B; a middleware in between will allow them to communicate.

  • The other person learns English.
  • You hire a translator.

What can we do with a middleware?

Before seeing exactly how a middleware can help us let’s see an example of what a middleware can do for your e-commerce.

Advantages of a Middleware


Not having the code for connecting the ERP to the e-commerce in the e-commerce, means less code in the e-commerce solution. Which means fewer chances for :

  • new code added to affect your customers and therefore your sales


Also, some e-commerce solutions will slow down as more code is added to them; even if that particular code is not executed in a particular page. In the case of Magento for example, this is mostly due to divers cache containing data from all the modules. So having less code in Magento will also increase performances.


A Middleware can also be very easily duplicated; imagine you are migrating to a new ERP, and a particular low traffic low sales country migrates before the others in order to test the new ERP.

Maintainability / Security

Depending on your business model you e-commerce solution might not have a dedicated development team working on it full time. You are happy with your solution and do not need to make changes often. This does not mean you must not keep the solution up to date. The e-commerce application is exposed to the public and therefore to attacks. You must therefore update your solution constantly.

Cons to a Middleware

There are 3reasons I can think of for not having a middleware:

  • Additional hosting costs; this is more relevant. If you are using a modern hosting solution you can actually even use lambdas for executing the middleware which makes them cheap. We could install the middleware on the same server as the e-commerce solution but that’s not ideal as you would add common version dependencies between both application which would make maintenance more complex.
  • Added complexity to the architecture.


In my opinion, these cons are non-issues, and any additional cost or the additional architectural complexity pays for itself very quickly.

Passionate web developer. Symfony lover. Writing as a hobby. Sad Magento 2 developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store