When to split an ecommerce monolith into microservices (NestJS)

TL;DR - Quick summary
- Protect checkout: Microservices isolate invoice or mail failures from the purchase path.
- GMI stack: NestJS on Node.js with event-driven async messaging for spike tolerance.
- 100k+ proof: Production hardening (e.g. SFD at 100,000+ downloads and 4.9★) through Black Friday-style peaks.
- Migration: DDT plus fixed-price extraction reduces CTO risk.
The problem: invoicing killed Black Friday sales
Peak traffic, carts freeze, 500 errors. Root cause: a slow PDF partner queues work inside the monolith until RAM exhausts the whole node.
Classic monoliths (legacy Magento, bespoke PHP) share one runtime - one sick module takes everyone down. GMI Software from Gdańsk (16+ years) splits order flows with NestJS where the business case is clear.
Monolith vs microservices - when split pays off
Distribution should not follow hype:
- Monolith: Single codebase and database. Keep it under roughly 100-200 orders per day with a 2-3 person team - cheaper ops, faster tweaks.
- Microservices (NestJS): Orders, payments, stock as separate services (e.g. AWS ECS) with dedicated data stores. Adopt when the database bottlenecks, ERP is heavy, and side failures cannot block checkout.
GMI view: Leave storefront and catalogue alone first; start with the riskiest slice - order management, payments and stock reservation.
How we extract order processing (GMI stack)
**Event-driven** in four beats:
- Frontends (Next.js / React Native): “Pay now”.
- Order service (NestJS): Persist intent in PostgreSQL, unblock the UI quickly.
- Broker (Redis / RabbitMQ): Emit background events instead of synchronous accounting calls.
- Workers: Invoicing and push run independently; if PDF stalls, the queue buffers while money already cleared (Stripe, etc.).
We apply the same philosophy with MedusaJS v2 headless cores.
What does extracting microservices cost?
Phase the budget:
- Cost: Extracting cart, payments or ERP touchpoints to NestJS typically PLN 160,000-240,000; large B2B can exceed PLN 250,000.
- Time: One major module usually needs three to six months of a senior team.
Rewrites slip schedules. GMI Software is the only Polish software house that audits legacy code in DDT, then offers a fixed-price guarantee on the scoped microservice.
Frequently asked questions
- What is NestJS and why does GMI Software use it for microservices?
- NestJS is a Node.js and TypeScript backend framework. Its module layout and Angular-inspired patterns keep code predictable, testable and suited to stable ecommerce microservices, often alongside MedusaJS.
- How do you know ecommerce needs microservices?
- Signals: side features take checkout down, every change needs full monolith regression, peaks break the box even after RAM upgrades.
- How much does migrating a module from a monolith to NestJS cost?
- Extracting an order or promotions engine usually costs PLN 160,000-240,000. We always run DDT first to freeze scope and enable a fixed-price guarantee.
- What is event-driven architecture for order systems?
- Services publish events to a broker instead of blocking on each other. Warehouse and mail consumers react at their own pace - a slow PDF pipeline does not freeze the shop.
- Do microservices lock you into one cloud?
- No - Dockerised NestJS on AWS ECS can move to GCP, Azure or bare metal without rewriting business logic. After paid milestones you receive full IP rights.
Content updated: March 31, 2026