Migrating an E-commerce Store to Headless Commerce Architecture
Your monolith struggles under peak loads. You launch a mobile app and a B2B portal—each needs its own interface but shares the product catalog. Typical scenario: a store on WooCommerce or Magento, catalog page render time > 2 seconds, frontend team blocked by backend releases. We have encountered this many times. Headless Commerce is an engineering solution that separates backend (catalog, orders, payments) and frontend (storefront). The backend becomes an API layer; the frontend is an independent application on React, Vue, Next.js, or a mobile client. This is not about trends but concrete trade-offs. A hybrid architecture retains part of the monolith if full headless is excessive.
After migration, metrics change dramatically: TTFB for static catalog pages drops from 500 ms to 20 ms (CDN), LCP from 3 s to 1 s. Our experience: more than 30 projects converting stores to headless, average conversion increase of 15–25% due to speed. This pays back migration in 6–12 months. Hosting savings up to 40% from reduced server load. Evaluate your project—contact us for a preliminary audit.
What problems does headless solve?
- Slow page load. The monolith renders every page on the server, wasting time on PHP request-response cycle. With headless, you get static HTML from CDN.
- Frontend dependence on backend. The design team cannot push a new page without a backend release. Headless enables independent deployments.
- Multiple sales channels. One backend serves web storefront, mobile app, and POS terminals.
- High scaling costs. Under load, it's easier to scale the frontend layer with static assets than the entire monolith.
Why migration to headless is an investment
Although migration requires resources, it pays back through:
- Independent deployment — frontend features ship without backend blockers.
- Loading speed — competitors can't catch up if your store loads 3x faster.
- A/B testing the storefront via Edge Middleware.
- Additional revenue from conversion lift and infrastructure savings (up to 40%) make migration worthwhile.
How we conduct migration
Phase 1: Audit and API design (2–3 weeks)
We compile a full entity map: products, categories, orders, customers, discounts. We capture all custom fields and non-standard logic. After the audit, we write an OpenAPI 3.0 specification — this contract lets the frontend team start work immediately.
Phase 2: Building the API layer (4–8 weeks)
We choose a headless platform. Most often we use Bagisto (Laravel) with the bagisto/graphql-api package or Medusa.js for Node.js stacks. Example catalog query:
query GetProducts($categoryId: ID, $page: Int) { products( categoryId: $categoryId page: $page limit: 24 ) { data { id sku name price images { url altText } variants { id price attributes { code value } } } paginatorInfo { currentPage lastPage total } } } Phase 3: Strangler Fig — gradual replacement
Instead of a big-bang switch, we deploy in parallel. Nginx proxies part of the requests to the new API, part to the old monolith. Each page is migrated separately: first catalog, then checkout, personal cabinet. This approach is described by Martin Fowler. Nginx configuration:
location /api/v1/ { proxy_pass http://new-api-backend:8000; } location / { proxy_pass http://old-monolith:80; } The share of traffic hitting the monolith gradually drops to zero.
Phase 4: Data migration (3–5 weeks)
If the platform changes, e.g., from WooCommerce to Bagisto, we write import scripts. Data is exported in chunks via REST, processed with queues. Each step is logged for rollback.
Phase 5: Frontend application (6–10 weeks, concurrently)
We build the storefront on Next.js with ISR. Example product page:
// pages/products/[slug].tsx export async function getStaticProps({ params }) { const product = await commerceClient.getProduct(params.slug); return { props: { product }, revalidate: 3600, }; } Cart and authentication live in the API. The cart token is stored client-side:
const useCart = () => { const [cartToken, setCartToken] = useLocalStorage('cart_token', ''); const addToCart = async (productId: string, qty: number) => { const response = await api.post('/api/v1/checkout/cart/add', { product_id: productId, quantity: qty, }, { headers: cartToken ? { 'cart-token': cartToken } : {}, }); if (response.data.token) { setCartToken(response.data.token); } }; }; What the work includes
- Audit of the current monolith and custom logic
- API design with OpenAPI 3.0 specification
- Deployment of headless backend (Bagisto / Medusa / your choice)
- Development of frontend storefront (Next.js / Nuxt / React)
- Data migration with validation and rollback
- Load testing (up to X concurrent users)
- Integration documentation and team training
- Post-launch support: 3-month warranty
How to migrate to headless: 5 steps
- Audit the monolith and custom logic.
- Design API contracts (OpenAPI 3.0).
- Parallel deployment of headless backend (Strangler Fig).
- Gradual switching of pages and routes.
- Decommission the old monolith after full migration.
All timelines range from 3 to 5 months depending on complexity. Cost is calculated individually—contact us for a precise estimate.
Performance comparison
| Metric | Monolith (PHP SSR) | Headless (Next.js ISR) |
|---|---|---|
| TTFB (catalog) | 400–800 ms | 20–50 ms (CDN) |
| LCP | 2.5–4 s | 0.8–1.5 s |
| Frontend deployment | With backend | Independent |
| A/B testing | Complex | Edge Middleware |
Headless wins in speed by 3–5x, directly impacting conversion. If you want to measure the potential improvement for your store, order a preliminary audit.
Additional platform comparison
| Platform | Language/Framework | License | Suitable for |
|---|---|---|---|
| Bagisto | Laravel (PHP) | Open source | Customization, B2B |
| Medusa.js | Node.js (Express) | Open source | Modern stores |
| Vendure | TypeScript (Nest.js) | Open source | Enterprise, flexibility |
Detailed analysis after migration shows: TTFB reduction of 90%, LCP reduction of 60%, INP reduction of 40% thanks to CDN and static content. Core Web Vitals pass the green zone. This is confirmed by our project practice.
Order a preliminary audit to estimate the improvement for your store.







