Project: 03Live

Liliana Work Clothes: Scaling the Unscalable

Next.js 15Medusa v2PostgreSQLDockerE-commerce
Medusa v2 E-commerce Architecture | Murrells Inlet, SC (33.551N, 79.041W) | South Carolina Digital Logistics

// [1/3] The high-performance Medusa v2 storefront.

Project Overview

LilianaWorkClothes.com is a specialized B2C e-commerce platform built to handle industrial-scale inventory with a "Lean Data" philosophy. The primary challenge was managing 4,000+ products (each with up to 500+ variants) on a resource-constrained 2GB RAM / 2-CPU VPS without sacrificing performance or SEO.

Inventory Scale4,000+

Active products managed with high-variance attributes.

Social Proof17,000+

Verified eBay reviews synced via custom Medusa module.

Load Time< 800ms

Sub-second LCP achieved through recursive pre-rendering.


01 // High-Variance Optimization: Instant Load at Scale

The most critical technical hurdle was the "Variant Bloat" problem. Industrial workwear (like Red Kap pants) often features 500+ variants per parent product due to the combinations of Color, Waist, and Inseam. Standard API fetches would result in massive, slow-loading JSON payloads.

The Solution: Surgical Field Selection & Sequential Funnels

  • Surgical Field Selection: Instead of standard wildcard expansions, I implemented a strict query logic that fetches only the specific fields required for the initial render (e.g., variants.calculated_price.calculated_amount). This keeps the Next.js data cache payloads well under the 2MB threshold, preventing memory spikes and ensuring sub-second response times.
  • Sequential Selection Funnel: I re-engineered the product selection logic into a 3-layer explicit funnel (Color -> Waist -> Inseam). By enforcing sequential data expansion, the storefront avoids the "combinatorial explosion" of trying to calculate every possible option state at once, resulting in a near-instant UI response even for products with hundreds of options.

02 // The "Lean Data" Architecture (Medusa v2)

The backend utilizes Medusa JS v2, leveraging the new DML (Data Modeling Language) to build custom modules that bypass legacy "bloat."

Key Technical Implementations:

  • Surgical Field Selection: To prevent payload spikes from high-variance products, the system enforces strict expansion rules. Instead of requesting a full product object, the storefront queries only the specific nested price and variant data required for the current view, keeping JSON responses under the 2MB Next.js cache limit.
  • Custom Module: Product Reviews: Built a dedicated Medusa module for social proof. It handles both verified storefront reviews and 17,000+ synced eBay feedbacks using an optimized RDBMS schema rather than standard metadata blobs.
  • Event-Driven Lifecycle: Automated the entire customer journey (Welcome -> Order -> Shipment -> Review Request) using Medusa v2 Subscribers and Scheduled Jobs.

02 // Social Proof Bridge (eBay Sync)

To bridge the trust gap for a new storefront, I built a custom eBay Feedback Synchronization Engine.

  • Idempotent Import: A Node.js CLI script that queries the eBay Trading API, performs a diff-check against the local PostgreSQL store, and upserts reviews based on ebayItemId matching.
  • Social Proof Volume: Successfully imported and categorized 17,000+ positive feedbacks, providing instant authority to the new platform.
  • Automated Social Proof: A nightly cron job ensures the local review database stays in sync with market activity without manual intervention.

03 // VPS Optimization & "Senior Polish"

Operating a massive catalog on a 2GB VPS required extreme optimization at every layer of the stack.

Performance Hardening:

  • Recursive Static Pre-rendering: Implemented a recursive batching loop (1,000 items/batch) in generateStaticParams to ensure 100% of the 4,000+ products are pre-rendered for instant loads and SEO visibility.
  • Containerized Orchestration: Managed via a Docker-Compose stack (Backend, Storefront, Redis, PostgreSQL) with Caddy as the reverse proxy. Internal container communication is locked to a private network, exposing only the Caddy HTTPS ports.
  • Surgical Image Cleanup: A weekly automated job audits the physical static/ directory against the database, removing orphaned high-res assets to prevent disk exhaustion.

04 // Result: The Technical ROI

  • SEO Dominance: Achieved 100% catalog indexation on Google Merchant Center (GMC) despite complex "Factory Irregular" labeling requirements.
  • Performance: Lighthouse scores of 95+ for accessibility and SEO.
  • Stability: Zero-downtime deployments via GitHub Actions and Docker-DHCR, with 64% steady-state RAM utilization on a 2GB machine.


[Technical Metadata]

  • Platform: Medusa v2 (Custom Build)
  • Frontend: Next.js 15 (App Router)
  • Email: Resend / React Email
  • Infrastructure: Vultr VPS (2 vCPU / 2GB RAM)