Free

E-Commerce & Headless Architecture

MPS

Decoupling WooCommerce with Next.js 16, React 19, and Tailwind v4 into a sub-second, multilingual headless storefront.
marinepartsystem.com
Marine Part System storefront — screenshot coming soon

01 — Overview

Marine Part System is an international e-commerce platform supplying critical boat engine parts, maintenance kits, and marine hardware across Europe. Engineered as a headless architecture, it replaces slow monolithic WordPress frontends with Next.js App Router, React 19, and Tailwind CSS v4, while keeping WooCommerce as a headless catalog backend.

The marine spare parts industry depends on massive technical catalogs — OEM diagrams, part cross-references, manufacturer compatibility. Monolithic WooCommerce setups struggle severely under those demands.

02 — The Problem

01Monolithic TTFB & server strain

Standard WordPress/WooCommerce rendering produced TTFB over 1.8s and frequent CPU throttling on shared hosting during seasonal European boating peaks.

02Complex multi-language cataloging

Four storefront languages (English, German, Dutch, Spanish) required localized URLs (/de/wagen, /es/carrito), hreflang tags, and metadata without duplicate-content penalties.

03Security & IDOR vulnerabilities

Sequential WooCommerce order IDs exposed customer names, shipping addresses, and phone numbers on checkout and order-received routes if not strictly gated.

04Heavy client bundles from animation libraries

Dependencies like Framer Motion added 30kB+ of runtime overhead, degrading mobile Interaction-to-Next-Paint for marina technicians and boaters.

03 — The Approach

A headless decoupling built on Next.js 16 App Router over Bun, with custom spring physics driven by requestAnimationFrame instead of Framer Motion, constant-time token verification for zero IDOR exposure, headless Rank Math SEO orchestration, and multi-tier edge caching with Cloudflare.

04 — Architecture

Headless decoupled Jamstack with edge reverse-proxy and stale-while-revalidate caching

01Edge & Presentation

Cloudflare CDN, Next.js 16, React 19, Tailwind CSS v4

Renders localized pages with SSR/ISR, handles canonical 308 rewrites, and uses WebP instead of expensive AVIF conversion.

02Business Logic & Middleware

TypeScript, Bun, Next.js Route Handlers & Server Actions

Validates orders via timing-safe HMAC equality, orchestrates cart tokens, and syncs Klaviyo webhooks.

03Headless Core & Content

WooCommerce REST API v3, WordPress, WPML, Rank Math SEO

Manages the product catalog, inventory, order processing, and localized taxonomy via REST endpoints.

04Analytics & Conversion

GTM, Google Ads Enhanced Conversions, Klaviyo API

Fires deduplicated e-commerce purchase events, tracking VAT-inclusive baskets across tax jurisdictions.

05 — Tech Stack

Next.js 16React 19BunTailwind CSS v4WooCommerce REST API v3WPMLRank Math SEOKlaviyoCloudflare

06 — Key Features

Quad-locale translated routing

Full native URL translation for English, German, Dutch, and Spanish — slugs like /de/wagen 308-redirect automatically, with dynamic hreflang sitemaps.

Faceted attribute filtering

Multi-parameter catalog filtering by engine manufacturer (Volvo Penta, Yanmar, Vetus, Nanni), condition, and OEM part number, cached with React.cache().

Zero-dependency spring physics

A hand-coded damped-harmonic-oscillator on requestAnimationFrame replaces Framer Motion for mobile drawer sheets, at 0kB library footprint.

Timing-safe IDOR protection

Constant-time cryptographic verification (timingSafeEqual) on order keys eliminates sequential-ID enumeration on every checkout endpoint.

Resilient Cloudflare mitigation

Custom HTTP adapters intercept Cloudflare Managed Challenges and upstream timeouts with graceful ISR fallbacks instead of crashing the UI.

Async VAT-reconciled tracking

Background workers build tax-inclusive Klaviyo event payloads from wc/v3 order data without adding latency to checkout.

07 — Under the Hood

Shared-hosting CPU starvation

Next.js image optimization was generating AVIF variants for every catalog image, locking shared-hosting CPUs during traffic spikes. Restricting next.config.ts to WebP only and raising minimumCacheTTL to 31 days cut server CPU usage by roughly 75% and eliminated 504 timeouts.

Order-data IDOR

Sequential order IDs in /checkout/order-received/{id} could be enumerated by any visitor, leaking GDPR-sensitive data. A getOrderForPublicView(id, key) function with constant-time key comparison now renders an identical not-found view for any invalid or missing credential.

Headless SEO canonical collisions

Rank Math's API returned canonical URLs pointing at the backend WordPress domain instead of the storefront. A custom mergeRankMathMetadata() with domain guardrails resolved the conflict and preserved 100% storefront canonical authority.

08 — Results

Storefront TTFB

Down from over 1.8s on the original monolithic WooCommerce stack.

Lighthouse SEO

Across all four locales, via hreflang, sitemaps, and headless schema.

JS bundle

Removed by replacing Framer Motion with custom rAF transforms.

Data leakage

Order-ID enumeration closed entirely with constant-time key checks.

Locales in sync

English, German, Dutch, and Spanish, fully translated and routed.

09 — Who It's For

— Boat owners & maritime engineers across Northern and Southern Europe

— Commercial shipping and marina repair workshops needing exact OEM replacements

— B2B European clients using reverse-charge VAT checkout

10 — FAQ

Why headless Next.js instead of a standard WooCommerce theme?

Standard themes carry heavy PHP query bloat and plugin conflicts. Decoupling the frontend gives sub-second transitions, granular caching, and React 19 ergonomics while WordPress stays the back office.

How are redirect loops avoided across four translated routes?

Next.js middleware uses a URL mapping table derived from the dictionary translations, so a non-canonical route 308-redirects to its localized form in a single hop.

How does the UI stay fast without an animation library?

Drawers and sheets run on a small damped-harmonic-oscillator written directly in TypeScript, applying transforms to DOM refs via requestAnimationFrame instead of loading Framer Motion.

Got a project that needs this kind of thinking?