VeloDev
/ Case Study

Headless B2B Configurator & ERP Portal

Next-Matrix is the headless rebuild of a legacy B2B ordering portal for made-to-measure shutters. A Next.js 15 App Router client replaces the old server-rendered WordPress pages and handles product configuration, live pricing, technical drawings and dealer reports, while WordPress and WooCommerce stay behind custom REST endpoints as the data and order backend.

Role
Full-Stack Developer · sole developer, end-to-end
Timeline
2019 - Present
Category
Headless E-commerce / B2B SaaS
Backend CMS
WP Headless REST API (JWT)
Technology Stack
  • Next.js 15.5
  • React 19
  • TypeScript 5.7
  • Redux Toolkit 2.9
  • Zustand 4.5
  • TanStack Query 5.9
  • Konva / React-Konva
  • Raphael (SVG)
  • Mantine 8.3
  • AG Grid 34.2
  • ApexCharts
  • i18next
  • jsPDF
WORKSPACE VIEWS (7)

Switch tabs to preview different system panels. Click the screenshot to zoom.

https://next-matrix-v3.vercel.app/reports?tab=compare
01 / 07

Reports: Multi-Year Comparison

Advanced data dashboard illustrating multi-year (2023-2026) SQM ordering volumes and total transaction values for top companies using interactive line graphs.

In production
115
Registered dealer companies
8,900+
Orders processed
System Audits (Vercel Production)
99/100
Perf
98/100
A11y
100/100
Best Pr.
100/100
SEO
LCP (Speed)0.58sINP (Response)22msCLS (Layout)0.00
/ Engineering snapshot

Challenge

A legacy WordPress B2B ordering portal for made-to-measure shutters had become slow and hard to extend, while the configuration rules kept growing: every product option feeds a dense pricing formula that dealers expect to see recalculated instantly.

What I owned
  • Frontend architecture of the Next.js 15 / React 19 App Router client, end-to-end.
  • The configurator engine and its pricing/validation rules.
  • Client and server state strategy (Zustand + TanStack Query) and the REST contract with the headless WordPress backend.
  • The incremental migration path off the legacy platform, without interrupting live ordering.
Result
  • Sub-second order calculation on configurations with hundreds of dependent options.
  • Live for 115 registered dealer companies, with 8,900+ orders processed through the platform.
  • New product families ship as configuration, not as another parallel implementation.
Key engineering decisions
  1. Decouple the frontend instead of rewriting WordPress

    WordPress and WooCommerce stay as the data and order backend behind custom REST namespaces, so years of business data and admin workflows survive the migration. Only the client is rebuilt.

  2. Split client state from server state deliberately

    Zustand holds the in-progress configuration, TanStack Query owns everything fetched. Server state is cached with a 5-minute stale threshold and a 10-minute garbage-collection window, which removes repeat API hits during catalog navigation.

  3. Compute pricing on the client, verify on the server

    The configurator evaluates formulas locally so the dealer sees the price update as they type; the backend re-validates before an order is accepted, so a manipulated client cannot change what is charged.

  4. Let the React Compiler handle memoization

    Instead of scattering useMemo and useCallback through a form with hundreds of dependent fields, the React 19 compiler configuration handles it — noticeably fewer re-renders, with far less code to maintain.

  5. Centralize report data in one shared context

    The multi-tab reports page fetched the same finance data per tab. Moving the fetch loops into a shared provider means each data set is fetched once instead of once per tab, and it removed the chart rendering jitter.

/ architecture

With the React frontend separated from WordPress, cached data is served without a round-trip to the backend. Calls to WordPress are authenticated with JSON Web Tokens, and CORS is handled at the routing layer by a Next.js proxy.

Client Side

Next.js 15 Frontend

Renders client-side routes, initializes local Zustand/Redux stores, and renders Canvas drawings.

Bearer JWT token
API Proxy

Reverse Proxy (Next)

Rewrites paths from /api/matrix/* to backend host to bypass CORS locks. Injects headers via Middleware.

REST API (JSON)
Headless CMS

WordPress Engine

Processes order formulas, stores customer profiles, logs SQL entries in WooCommerce DB.

/ capabilities

A comprehensive overview of custom components engineered to run under Next-Matrix:

Dynamic Configurator Engine

Manages shutters, awnings, and battens configuration. Employs condition validation (Ecowood, Wood, Biowood) parsing dimensions, layout configuration rules, and condition dependencies instantly.

Canvas Technical Sketches

Integrates Konva canvas drawing tools and Raphael SVG builders directly in layout configurator steps, allowing users to draw structures and save blueprints to order attachments.

Factory Query Tickets

Order issue resolution interface mapping backend tickets categorized by status indicators: stgh_pending, stgh_answered, and stgh_closed, so operators can respond without leaving the portal.

Repairs Filing Desk

A portal dedicated to B2B claiming. Clients can select past order reference codes, detail issues, and attach multiple images using custom file-upload hooks directly connected to WordPress.

Advanced Reports & Charts

A shared Reports Context coordinates API calls to pull transaction stats, rendering responsive line and bar charts (ApexCharts) comparing users, materials, and monthly metrics across fiscal years.

Container ETA Tracking

Shipment schedules mapping total SQM, panels, cartons, and container weights. Supports debounced keyword lookup (300ms), 50-500 pagination, and dynamic PDF exportation via jsPDF.

/ WP-REST INTEGRATION DETAILS

The platform talks to WordPress through custom REST endpoints, with JWT-authenticated requests. Because editing is context-dependent, a product-type detector reads cart item metadata and picks the matching endpoint for each item.

JWT Token Authorization Flow

Login is handled via POST /wp-json/jwt-auth/v1/token, which returns a JWT. Before an authenticated request, the client checks the token's expiry claim (exp) and then attaches the standard header:

headers: {
  Authorization: 'Bearer ' + token
}

Dynamic Endpoint Routing

Instead of querying a single endpoint, utils/cart/productTypeDetector.ts reviews structural variables. When shop_type === 'pos', it maps to POS endpoints. If uk or fob is set, it maps to UK/FOB components shop. Defaults map to custom shutter forms.

Primary API Route MappingREST
ActionHTTP MethodREST Endpoint Path
Get Cart ProductsGET/wp-json/custom/v1/get-cart-products/{id}
Add Shutter ProductPOST/wp-json/custom/v1/add-shutter-product
Clone/Delete ItemDELETE/POST/wp-json/custom/v1/{clone|delete}-{cart|pos|component}-product
Factory Tickets ListGET/wp-json/custom/v1/factory-queries
Register Product RepairPOST/wp-json/custom/v1/add-order-repair
Get Containers ETAGET/wp-json/custom/v1/containers
/ data models

Standard TypeScript models map raw REST properties to typed React configurations, aligning components across all configuration pages.

types/types.tsx (Cart & Order Models)TypeScript
interface Cart {
  id: number;
  title: { rendered: string };
  date: string;
  meta: {
    type: 'normal' | 'sample' | 'awning' | 'components';
    shop_type?: 'pos' | 'uk' | 'fob';
  };
  deliveryStatus?: string;
}

interface Order {
  order_number: string;
  panels: number;
  frames: number;
  cartoons: number;
  sqm: number;
  items: number;
  weight: number;
  deliveryStatus?: string;
}
types/types.tsx (User Model)TypeScript
interface User {
  id: string;
  username: string;
  email: string;
  display_name: string;
  roles?: string[];
  company?: string;
  billing_company?: string;
}
/ performance

B2B configurators evaluate dense formulas. Three changes keep the interface responsive and the loading gaps short:

React Compiler

Enabled the React Compiler so React 19 components are memoized automatically, removing hand-written useMemo and useCallback, with noticeably fewer re-renders.

React Query Cache Strategy

Server state is cached with TanStack Query: a 5-minute stale threshold and a 10-minute garbage-collection window, so browsing the catalog does not repeat the same API calls.

Shared Reports Context

Finance data fetching lives in one shared context provider for the whole multi-tab reports page, so each data set is fetched once instead of once per tab and the charts no longer jitter while rendering.

/ screens

Click on any of the screenshots below to open them in the lightbox viewer.