Migrating an e-commerce platform that generates millions in monthly revenue is like changing an airplane engine mid-flight. Here’s how we did it.

Why Headless?

Our Magento 2 monolith was reaching its limits:

  • Performance: Time to First Byte > 800ms
  • Scalability: Black Friday = cold sweats
  • Velocity: 3 weeks for a header change
  • Multi-channel: Impossible to properly feed the mobile app

Target Architecture

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Next.js   │     │   Next.js   │     │    App      │
│   (Web FR)  │     │   (Web US)  │     │   Mobile    │
└──────┬──────┘     └──────┬──────┘     └──────┬──────┘
       │                   │                   │
       └───────────────────┼───────────────────┘

                    ┌──────▼──────┐
                    │  API Layer  │
                    │  (GraphQL)  │
                    └──────┬──────┘

       ┌───────────────────┼───────────────────┐
       │                   │                   │
┌──────▼──────┐     ┌──────▼──────┐     ┌──────▼──────┐
│   Magento   │     │  Algolia    │     │   Stripe    │
│  (Backend)  │     │  (Search)   │     │ (Payments)  │
└─────────────┘     └─────────────┘     └─────────────┘

The Strangler Fig Strategy

No big bang. We migrated progressively:

  1. Months 1-3: API Gateway + first static pages
  2. Months 4-6: Headless product catalog
  3. Months 7-9: Decoupled checkout
  4. Months 10-12: Customer account + loyalty
  5. Months 13-18: Optimizations and global rollout

Patterns That Saved the Project

Feature Flags Everywhere

if (featureFlags.isEnabled('headless_checkout', { country: user.country })) {
  return <HeadlessCheckout />;
}
return <LegacyCheckout />;

Canary Deployments by Country

Monaco first, then Belgium, then France. Each country was a full-scale test.

Dual-Write for Data

For 6 months, every write went to both the old AND the new system. Belt and suspenders.

Post-Migration Numbers

MetricBeforeAfterDelta
TTFB847ms89ms-89%
LCP4.2s1.1s-74%
Conversion2.1%2.8%+33%
Deploys/week215+650%

What We’d Do Differently

  1. Invest earlier in observability — We flew blind for too long
  2. Automate E2E tests from day 1 — Technical debt accumulates fast
  3. Involve business stakeholders earlier — Some legacy features were critical without us knowing

Conclusion

18 months is a long time. But today, we deploy 15 times a week without stress, our site loads in under a second, and our developers are (almost) happy.

Headless migration isn’t an end in itself — it’s the beginning of a new velocity.