Medusa logov2.17.2
Railway logoDeploy Ready ↗
ARCHIVE // 02
COMMERCE ARCHITECTURE & MONOREPO

SYA Store — Medusa v2 & Next.js 15

A high-performance ecommerce platform combining Medusa v2.17.2 backend with a responsive Next.js 15 App Router storefront.

Backend (Medusa 2.0)Storefront (Next.js 15)PostgreSQLRedisS3 / MinIOMeilisearchResend EmailStripe & LencoRailway Deployment
MONOREPO TAXONOMY

Dual-Engine System Architecture

Engineered as an enterprise-grade monorepo cleanly isolating backend commerce mechanics from dynamic presentation layers.

DIRECTORY: /backendMedusa v2.17.2

Commerce Engine & Workflow Server

Autonomous commerce backbone delivering automated SKU deduplication, strict option normalization, transaction orchestration, and localized payment rails.

  • Automated SKU normalization & write-time middleware
  • Title-case option value sanitation & audit CLI
  • PostgreSQL database & Redis event bus / cache
  • Resend transactional email workflows
  • Stripe & Lenco payment provider extensions
DIRECTORY: /storefrontNext.js 15 App Router

Editorial Front-End Experience

High-performance React 19 storefront featuring partial prerendering, frosted-glass interactive navigation, and instant Google One Tap auth.

  • Frosted-glass responsive navigation & account drawer
  • Instant Google OAuth with FedCM token reject fallbacks
  • Intelligent checkout autofill & priority address resolution
  • Dynamic shipping labels from cart.shipping_methods
  • Full wildcard product hydration with zero layout shift
CORE ADVANCEMENTS

Key Features & Architectural Enhancements

Every feature was engineered to eliminate edge-case friction, ensure database integrity, and deliver frictionless customer conversion.

01Centralized Normalizer & Write-Time Guard

SKU Duplication Prevention & Sanitization

Large-scale ecommerce databases frequently suffer from SKU drift due to whitespace padding, casing inconsistencies, or non-printable unicode artifacts. We engineered a write-time middleware interceptor and automated CLI that enforces strict SKU hygiene before database persistence.

Technical Pillars:
  • Sanitizes strings by trimming and collapsing irregular whitespace
  • Removes non-printable unicode artifacts and standardizes casing
  • Write-time middleware intercepts /admin/products endpoints
  • Safe audit and merge CLI script (sku-audit.ts)
  • Automated Jest regression test coverage
02Title-Case Sanitizer & Deduplication Engine

Product Option Value Normalization

Prevents duplicate variant attributes (such as 'Red', 'RED', and ' Red ') from fragmenting store analytics, inventory tracking, and client-side faceted filtering. Sanitizes all incoming option values to standard title-case formatting.

Technical Pillars:
  • Standardizes option strings prior to variant association
  • Automated dry-run audit CLI (option-value-audit.ts)
  • Safe merge flag to consolidate orphaned duplicate values
  • Comprehensive Jest test suite verifying edge cases
03Priority Address Resolution & Progressive Disclosure

Smart Checkout Auto-Fill

A frictionless multi-step checkout experience that prioritizes customer profile defaults while gracefully falling back to recent successful order addresses without destructive overwrites.

Technical Pillars:
  • Dynamic address resolution hierarchy reducing cart friction
  • Non-destructive progressive disclosure for Company & Address Line 2
  • Maintains customer address profiles intact across sessions
  • Instant Google Places autocomplete integration
04Real-Time Rate Presentation from cart.shipping_methods

Dynamic Shipping Method Resolution

Eliminates hardcoded delivery assumptions. Resolves carrier pricing and delivery timelines dynamically across Cart, Checkout, Order Review, Payment, and Confirmation screens.

Technical Pillars:
  • Zero hardcoded delivery estimates or carrier labels
  • Direct query bindings to cart.shipping_methods
  • Multi-region dynamic tax and tariff alignment
  • Accurate real-time receipt generation
05Instant Session Reactivity & FedCM Fallbacks

Identity, Google One Tap & Responsive Navigation

A bespoke frosted-glass navigation bar featuring dynamic user greetings ('Hi, {firstName}'), quick order lookups, and resilient Google One Tap authentication engineered to bypass FedCM token rejections in incognito sessions.

Technical Pillars:
  • Account drawer with Profile, Orders, and Address books
  • Synchronous NextAuth & Medusa session termination
  • Custom sya:auth cross-component event dispatcher
  • Resilient fallback for partitioned cookie environments
06Wildcard Query Projections & Accordion Fallbacks

Full Product Hydration

Leverages Medusa remote query field wildcards (*) to ensure complete hydration of dimensional metadata, weight classifications, care materials, and inventory specifications across all device viewports.

Technical Pillars:
  • Zero layout shifts during dynamic specification rendering
  • Deep query hydration for dimensions, weight, and materials
  • Graceful degradation for partial inventory entries
  • High-efficiency client-side memoization
ECOSYSTEM INTEGRATIONS

Production-Ready Connectors

Pre-wired integrations spanning identity, communications, payment gateways, geographic validation, search, and storage.

Identity & Auth

Google OAuth + Google One Tap

NextAuth + Medusa JWT cross-session synchronization with FedCM fallback.

Transactional Emails

Resend & React Email

Bespoke transactional email templates for order creation, fulfillment, and receipts.

Payment Processors

Stripe & Lenco Gateways

Multi-currency checkout supporting credit, debit, and localized African payment rails.

Address & Geolocation

Google Maps Places API

Real-time address autocomplete and geographic postal verification.

Catalog Search

Meilisearch Engine

Instant typo-tolerant search indexing products, variants, and categories.

Object Storage

S3-Compatible Storage

Seamless asset hosting via Railway Buckets, Cloudflare R2, AWS S3, or MinIO.

DEVELOPER RUNBOOK

Local Setup, CLI Audits & Cloud Deployment

Comprehensive developer instructions for running local infrastructure, bootstrapping the backend, executing audit CLIs, and launching on Railway.

Local Infrastructure

Root docker-compose.yml orchestrating PostgreSQL, Redis, Meilisearch, and MinIO storage.

TERMINAL
Start all local supporting services in detached mode
docker compose up -d

Note: Exposes MinIO Console at http://localhost:9005 (medusa / supersecret) and Meilisearch at http://localhost:7700.

CLOUD INFRASTRUCTURE

One-Click Deployment on Railway

SYA Store includes native Nixpacks / Dockerfile profiles optimized for Railway. Link the repository to automatically provision Postgres, Redis, and unified container instances.