A Developer's Guide to Sub-Second E-Commerce Checkouts
Every 100ms of checkout latency costs 1% in conversion. Here are the edge-caching, database indexing, and headless cart techniques we implemented.
21 Oct 2026 · 2 min read
A Developer's Guide to Sub-Second E-Commerce Checkouts
In e-commerce performance engineering, the checkout funnel is sacred ground.
Amazon famously demonstrated that every 100ms of incremental page latency reduces sales conversion by 1%. At checkout—where buyers are typing credit card numbers and mobile OTPs—lag, layout shifts, or spinning loading indicators trigger immediate cart abandonment.
Here is the architectural playbook behind Dariyo's sub-second checkout experience.
1. Eliminate Client-Side Waterfall Fetches
The traditional single-page application (SPA) architecture suffers from severe network waterfall chaining:
- Browser downloads JavaScript bundle (400ms).
- App mounts and requests current user session (250ms).
- App requests cart items (200ms).
- App requests available shipping carriers for entered pincode (300ms).
- App requests tax calculation for line items (250ms).
Total time before the user can interact: Over 1.4 seconds.
The Server-Driven Approach
In Dariyo, checkout calculation is centralized in a single server-side evaluation step (pricing.service.ts):
- Cart items, coupons, shipping rules, tax state, and customer discounts resolve in a single round trip.
- Next.js Server Components stream pre-rendered HTML to the browser with zero layout shift.
- The UI renders instantly even on flaky 4G mobile connections.
2. Decoupled Ephemeral Guest Sessions
Forcing shoppers to create a password or verify email before displaying payment totals is conversion poison.
Dariyo utilizes lightweight, cryptographically signed guest JWT tokens generated on the initial page load:
- Guests can add items to carts, apply discount codes, and test pincode delivery without account creation.
- When they complete mobile phone OTP verification via Firebase, their guest cart converts atomically into a persistent customer record without reloading the screen.
3. Atomic Indexing and Compound Database Queries
Database query latency at checkout must never exceed 15 milliseconds. We achieve this through targeted MongoDB compound indexes:
// Order status and customer lookup compound indexes
OrderSchema.index({ customerId: 1, createdAt: -1 });
OrderSchema.index({ status: 1, paymentStatus: 1 });
ProductVariantSchema.index({ productId: 1, sku: 1 }, { unique: true });By pairing strict index coverage with in-memory Redis session storage, the Dariyo checkout engine responds in under 80ms, delivering a smooth, frictionless purchasing experience that converts visitors into loyal repeat customers.
- performance
- checkout
- nextjs
- caching
- optimization
