Web performance consultant for Medusa.js
Optimize web performance on Medusa.js stores
Medusa.js is the most modular headless commerce framework on the market, but a large catalog + synchronous workflows + a loose Next.js storefront drives TTFB up and breaks Core Web Vitals. I work on both the Medusa backend and the storefront to deliver a fast, stable e-commerce experience.
They trust me
Medusa.js symptoms calling for an audit
Poorly-framed Medusa.js stores show characteristic bottlenecks on the pricing engine, synchronous workflows, and the Next.js storefront.
💰 API TTFB drifting on product listings
The pricing engine resolves rules on every product card without cache. Redis cache on stable prices (per region/currency) drops catalog endpoint TTFB 40 to 70%.
🔁 Postgres N+1 on variants and options
Without targeted relations, loading a product triggers cascading queries on variants, prices, inventory, images. The pg_stat_statements profile exposes the patterns. Targeted select + missing indexes stabilize catalog queries.
📧 Synchronous workflows on order creation
Payment capture + confirmation email + ERP sync + search index in sync adds 500ms to 2s to response time. Splitting via Subscribers + Redis events moves everything that can move out of the critical flow.
🔎 Meilisearch or Algolia index rebuilt synchronously
Every product update triggers an index rebuild in the admin flow. Moving to an async queue (BullMQ or Redis Streams) frees the backend and avoids CPU spikes on every catalog import.
📦 Next.js storefront without ISR or disciplined RSC
revalidate: 0 everywhere, full hydration, payment SDK loaded on the home. Apply ISR on catalog + product pages, RSC + streaming, dynamic import on payment SDKs. Storefront LCP drops below 1.5s.
🖼️ Unoptimized product images, no CDN
Images served as JPEG from the bucket without transformation. Add a Sharp pipeline + AVIF/WebP, fronting CDN (Bunny, Cloudflare, Vercel) with long cache, strict responsive sizes. Catalog LCP stabilizes.
Medusa.js optimization methodology
4 steps to transform your performance
1. Postgres and Medusa logger profiling
Identify slow queries via pg_stat_statements, N+1 on variants/prices/inventory, overly synchronous workflows. Map most-called API endpoints and their storefront LCP impact.
2. Pricing and catalog optimization
Redis cache on stable price calculations, targeted select + relations on listings, missing Postgres indexes (region_id, customer_group_id), cursor pagination on very large catalogs.
3. Workflow and event splitting
Critical steps synchronous (payment, stock), secondary steps async via Subscribers + Redis events (emails, ERP sync, search index). Meilisearch/Algolia index rebuild on a dedicated queue.
4. Next.js storefront and CDN
Switch to ISR on catalog and product, RSC + streaming on rich pages, dynamic import of payment SDKs, Sharp + AVIF image pipeline, fronting CDN with long cache on assets and cacheable HTML.
1. Postgres and Medusa logger profiling
Identify slow queries via pg_stat_statements, N+1 on variants/prices/inventory, overly synchronous workflows. Map most-called API endpoints and their storefront LCP impact.
2. Pricing and catalog optimization
Redis cache on stable price calculations, targeted select + relations on listings, missing Postgres indexes (region_id, customer_group_id), cursor pagination on very large catalogs.
3. Workflow and event splitting
Critical steps synchronous (payment, stock), secondary steps async via Subscribers + Redis events (emails, ERP sync, search index). Meilisearch/Algolia index rebuild on a dedicated queue.
4. Next.js storefront and CDN
Switch to ISR on catalog and product, RSC + streaming on rich pages, dynamic import of payment SDKs, Sharp + AVIF image pipeline, fronting CDN with long cache on assets and cacheable HTML.
Mission commitments
Frequently asked questions
Is Medusa.js v2 production-ready?
Which DB for Medusa: Postgres only, or +Redis?
Do you have to use a Next.js storefront?
How are your Medusa.js engagements structured?
Drop your Medusa.js TTFB
Data 2023-2026
What my clients say
Excellent work.
Paul has significantly improved the site's speed and perfectly aligned it with Google's recommendations.
Professional, thorough, and efficient, I highly recommend.
Nicolas - April Moto
Digital & E-commerce Director
We are very satisfied with Paul's work. He is quick, available, and particularly effective. Since his arrival, very good results have been observed, both in terms of performance and responsiveness. A real asset for our team.
Léo - Luxury brand
E-commerce Product Owner
I don't know if we've said it enough.
But if you want to improve your loading speed,
Make Google happy and get your Core Web Vitals in the green,
Contact Paul Delcloy.
Florian Darroman - Les Makers
Co-founder
Medusa.js, modular headless commerce with performance to frame
Medusa.js has established itself as the open-source alternative to Shopify for teams that want to own their e-commerce stack end-to-end. Version 2.0 rewrites the core into a modular architecture (Modules, Workflows, Links), with a strict backend / storefront separation — typically a Next.js storefront calling the Medusa API through the Store API or Server Actions.
That modularity is a design strength, but opens performance debt angles that compound as soon as the catalog passes a few thousand products or traffic climbs. The web performance optimization angle on Medusa is multi-layer: Postgres profiled on catalog and pricing queries, Redis configured for cache and events, workflows split between sync and async, Next.js storefront on ISR or streaming with a strict JS budget.
Pricing engine and catalog, first work-stream
Medusa's pricing engine resolves complex rules (price lists, currencies, customer groups, region, sales channel) on every request. On a product listing rendering 50 cards with prices, the calculation can trigger cascading queries if relations aren't preloaded correctly.
Diagnosis via the Medusa logger and Postgres profiler (pg_stat_statements, EXPLAIN ANALYZE) exposes slow queries immediately. Moving to targeted select + relations instead of full fetch, plus a Redis cache on stable price calculations, drops API TTFB 40 to 70% on catalog endpoints. On high-SKU stores, it's often the lever that gets the storefront green on LCP.
Workflows and events, async by default
Medusa 2.0 introduces the Workflow Engine that orchestrates multi-step operations (order creation, refund, payment capture) with idempotency and compensation. It's powerful, but a poorly-split workflow runs steps synchronously that should be async: confirmation emails, ERP sync, Meilisearch or Algolia index updates.
Refactoring — critical steps synchronous (payment capture, stock), secondary steps async via Subscribers + Redis events — drops perceived order creation latency by hundreds of ms. Same logic as Laravel queues, but carried by Medusa's workflow primitives.
Next.js storefront, the Core Web Vitals battleground
The storefront is typically separated from the backend (Next.js, Remix, Astro). That's where LCP, CLS and INP — what Google measures — actually play out. Classic traps: revalidate: 0 everywhere instead of ISR on catalog pages, full hydration instead of RSC + streaming, Stripe or PayPal SDK loaded on the home when it's only useful at checkout.
The storefront audit covers JS bundle (250 KB gzip target on the home), product images (AVIF format, correct sizes, lazy below the fold), CDN cache on product pages, and precise RSC/Client splitting. On a properly framed Next.js Medusa storefront, you hold sub-1.5s LCP and sub-200ms INP even on 3G mobile.
Other expertise framework
Angular
Angular optimized: lazy modules, OnPush change detection, SSR Universal or Analog, signals, zone.js elimination. Stable Core Web Vitals on enterprise SPAs.
Learn moreAstro
Astro optimized: islands architecture, image optimization, view transitions, content collections. Near-static sites with green Core Web Vitals.
Learn moreDrupal
Drupal optimized: Render API and cache contexts, Dynamic Page Cache + BigPipe, Views performance, MySQL tuning. Core Web Vitals green on strategic templates.
Learn more