Overview
E-Commerce Platform is a high-performance e-commerce solution built for an electronics distributor with a catalog exceeding 2 million products and peak traffic of 50,000 concurrent users during flash sale events. The primary goal: achieve a Lighthouse Score of 100/100 across all four categories (Performance, Accessibility, Best Practices, SEO) — a benchmark very few large-catalog e-commerce sites reach.
A headless commerce architecture was chosen: Magento 2 serves as the commerce engine backend (catalog management, orders, inventory) while React/Next.js handles the entire frontend, enabling extreme performance optimization that Magento's monolithic architecture cannot achieve on its own.
The Challenge
Building e-commerce with 2 million SKUs introduces technical challenges at every layer: database query optimization, search index management, cache strategy, and image delivery. Product listing pages with 48 items must load within 1.5 seconds even on a 3G connection — a hard client requirement.
Flash sales are the most demanding scenario: traffic spikes 20x within minutes of a sale opening, orders arrive simultaneously, and inventory must be perfectly accurate — zero oversell is non-negotiable under high concurrency.
Our Solution
Ventra Rocket designed a multi-layer caching strategy: CDN (CloudFront) for static assets and infrequently changing product pages, Redis for sessions, cart state, and real-time inventory counts, and full-page cache for anonymous users. Only authenticated requests reach the application server.
Product search runs entirely on Elasticsearch with indexes optimized for Vietnamese full-text search, faceted filtering across 30+ attributes, and "Did you mean?" suggestions. Search response time is under 50ms at the 99th percentile.
Key Features
- Headless Commerce Architecture: React/Next.js frontend fully decoupled from the Magento backend — achieves maximum performance with Static Site Generation for product pages.
- Elasticsearch Product Search: Vietnamese full-text search with ICU analyzer, typo tolerance, synonym support, and personalized ranking based on each user's viewing history.
- Real-time Inventory: Redis pub/sub updates stock counts on product pages in real time — shoppers see "3 items remaining" update live as others add to cart.
- Flash Sale Engine: Redis distributed locks prevent oversell absolutely, verified to hold under 10,000 simultaneous requests per second during load testing.
- Progressive Web App: Service Worker caches resources for offline browsing, push notifications for upcoming flash sales, and home screen install — return visit rate increased 45%.
Impact & Results
Achieved Lighthouse Score 100/100 across all four categories under real-world testing conditions — directly improving Google search rankings. First Contentful Paint 0.8s, Largest Contentful Paint 1.2s on a 4G connection, Total Blocking Time zero.
The Black Friday flash sale successfully processed 8,000 orders in the first 10 minutes with zero oversell and zero downtime. Conversion rate increased 52% over the previous platform, driven by improved UX and significantly faster page loads.
Tech Stack Details
Magento 2 as the headless commerce backend exposes a GraphQL API — this architecture preserves all existing Magento business logic and data models while replacing the frontend entirely. Next.js with ISR (Incremental Static Regeneration) rebuilds product pages automatically when price or inventory changes, balancing static performance with data freshness. Elasticsearch with a custom Vietnamese analyzer handles Vietnamese-language search far more accurately than the standard analyzer. Redis Cluster ensures high availability for cache and session storage even when individual nodes fail.