The Monolith Problem in E-Commerce
Most e-commerce platforms start as monolithic applications — Magento, WooCommerce, Shopify, or custom-built PHP/Java systems. This works well initially: fast time-to-market, simple deployment, and a single codebase to manage. But as the business grows, the monolith becomes a bottleneck.
The symptoms are predictable: page load times increase during traffic spikes, deployments require full-site downtime, a bug in the checkout flow crashes the entire catalogue, and adding new features takes months instead of weeks because everything is coupled to everything else. We've seen this pattern repeatedly across our e-commerce clients, and the solution is always the same: decompose the monolith into independent, scalable services.
When we worked with Your Games Room to deliver their new e-commerce platform, the existing Magento installation was struggling with 500 concurrent users during peak periods. The new cloud-native architecture handles 10,000+ concurrent users without breaking a sweat — and costs less to operate.
Headless Commerce: Separating Presentation from Business Logic
The first and most impactful architectural decision is going "headless" — separating the frontend presentation layer from the backend commerce engine. This means the product catalogue, cart, checkout, and order management run as APIs, while the customer-facing website (or mobile app, or kiosk, or voice interface) is a separate application that consumes those APIs.
The benefits are transformative:
- Frontend freedom: Build the customer experience with modern frameworks (React, Next.js) without being constrained by the commerce platform's templating system. Designers and frontend developers work independently of backend teams.
- Multi-channel: The same commerce APIs power your website, mobile app, in-store kiosks, and marketplace integrations. Build once, serve everywhere.
- Performance: Static site generation (SSG) and edge caching deliver sub-second page loads regardless of backend complexity. Product pages are pre-rendered and served from CDN — no database queries on every page view.
- Independent scaling: The frontend scales independently of the backend. During a flash sale, you scale the checkout service without scaling the entire platform.
Service Decomposition: What to Separate and When
Not every part of the monolith needs to become a microservice immediately. We decompose based on business domain boundaries and scaling requirements:
Core Services (Separate First)
- Product Catalogue Service: Product data, categories, attributes, pricing. High read volume, infrequent writes. Backed by Elasticsearch for search and DynamoDB for structured data. Cached aggressively at the CDN layer.
- Cart & Checkout Service: Shopping cart management, payment processing, order creation. Must be highly available and consistent. Backed by Redis for cart state and PostgreSQL for orders.
- Inventory Service: Stock levels, reservations, warehouse allocation. Requires strong consistency to prevent overselling. Event-driven architecture ensures all systems have accurate stock visibility.
Supporting Services (Separate Next)
- Customer Service: Profiles, addresses, preferences, order history. Separate from authentication — customers exist independently of how they log in.
- Pricing & Promotions Service: Dynamic pricing rules, discount codes, bundle pricing, loyalty points. Complex business logic that changes frequently — isolation prevents pricing bugs from affecting other services.
- Notification Service: Order confirmations, shipping updates, abandoned cart emails, marketing communications. Asynchronous by nature — perfect for event-driven architecture.
AWS Architecture for E-Commerce at Scale
Here's the AWS architecture pattern we use for high-traffic e-commerce platforms:
- CDN & Edge: CloudFront for static assets, pre-rendered pages, and API caching. Lambda@Edge for personalisation, A/B testing, and geo-routing without origin round-trips.
- Compute: ECS Fargate for containerised services (no server management, automatic scaling). Lambda for event-driven processing (order events, inventory updates, notification triggers).
- Data: Aurora PostgreSQL for transactional data (orders, customers). DynamoDB for high-throughput reads (product catalogue, sessions). ElastiCache Redis for cart state and frequently-accessed data. Elasticsearch for product search and filtering.
- Events: EventBridge for service-to-service communication. SQS for reliable message delivery. SNS for fan-out notifications.
- Search: OpenSearch (Elasticsearch) with custom relevance tuning, faceted filtering, and typo tolerance. Handles autocomplete, category navigation, and full-text product search.
Performance: Sub-Second Page Loads at Scale
E-commerce performance directly impacts revenue. Amazon famously found that every 100ms of latency costs 1% in sales. Our architecture delivers consistent sub-second page loads through multiple layers of optimisation:
- Static generation: Product pages, category pages, and landing pages are pre-rendered at build time. No database queries on page view — just static HTML served from CDN.
- Incremental regeneration: When product data changes, only affected pages are regenerated. No full-site rebuilds.
- API response caching: Frequently-accessed API responses (product details, category listings) cached at the CDN edge with intelligent invalidation.
- Image optimisation: Automatic format conversion (WebP/AVIF), responsive sizing, and lazy loading. Images served from CloudFront with aggressive caching.
After migrating Your Games Room to our cloud-native architecture, page load times dropped from 4.2 seconds to 0.8 seconds, conversion rate increased by 23%, and infrastructure costs decreased by 40% despite handling 20x more traffic.
Migration Strategy: From Monolith to Microservices
We never recommend a big-bang rewrite. Instead, we use the strangler fig pattern (detailed in our legacy modernisation guide) to migrate incrementally:
- Week 1-2: Deploy headless frontend alongside existing monolith. Route a percentage of traffic to new frontend while it still calls the monolith's APIs.
- Week 3-6: Extract product catalogue service. New frontend calls new service; old frontend still works unchanged.
- Week 7-10: Extract cart and checkout. This is the highest-risk migration — extensive testing and gradual traffic shifting.
- Week 11-16: Extract remaining services (customer, inventory, notifications). Decommission monolith.
Throughout this process, the existing site continues operating normally. Customers never experience downtime or degraded functionality.
Scaling Your E-Commerce Platform?
Talk to our architects about migrating to a cloud-native commerce architecture.
Discuss Your Platform →