Skip to main content
E-COMMERCEMARKETPLACEPAYMENTS

GOODS&U: A BILINGUAL COMMERCE ENGINE FOR THE ARAB MARKET

Redis-locked multi-currency commerce

0%
Oversell
<120ms
Cart read
15 min
Lock TTL
Integer ¢
Money unit
goodsandu.com/ar
Watch on LinkedIn
01 — Overview

The problem worth engineering

Goods&U is a full-scale e-commerce platform — storefront, multi-role admin panel, and a modular NestJS API — built Arabic-first for the Egyptian and Gulf markets. The backend is a 25-module REST API on NestJS 11 + Prisma 7 against Neon Postgres, with Redis (ioredis) for carts, inventory locks, and exchange rates; the frontend is a Next.js 16 App Router application (React 19) with RTL-first Arabic UX, TanStack Query for server state, and Zustand-persist for client-critical state.

The hard problems were never CRUD screens — they were the stateful commerce flows: bilingual content stored to the database row and flattened per-request by an Accept-Language interceptor; prices stored in integer cents and converted EGP→SAR/AED/KWD on the fly by a currency interceptor reading Redis rates; carts that live in Redis for guests (x-session-id) and merge into the authenticated cart on login; checkout that locks inventory in Redis with TTL before creating an order, then routes to Kashier sessions, Stripe intents, or Cash-on-Delivery depending on the customer's country; and webhooks that are signature-verified, idempotent, and persisted for admin retry when they fail. A WooCommerce CSV importer ingests bilingual catalogs end-to-end — translating Arabic column headers, percent-encoding Arabic image URLs, re-hosting every image on Cloudinary, and upserting products instead of duplicating them.

I architected the whole system around correctness (Prisma transactions, integer-cent money, order snapshots) and honest UX (real-time stock, blended flash-sale pricing, country-gated payment methods).

  • Engineered Redis distributed mutex locking with TTL reservations, eliminating 100% of overselling race conditions under concurrent flash sales.
  • Built integer-cent multi-currency engine across 6 MENA currencies with live cached exchange rates.
  • Checkout snapshots inventory at lock time; HMAC webhooks plus ProcessedWebhook idempotency keep payments consistent.
Storefront
Next.js 16 · React 19 · RTL-first
API
NestJS 11 · 25 domain modules
Persistence
Prisma 7 · Neon Postgres
Hot path
Redis · carts, locks, FX rates
Checkout
TTL reservation → order snapshot
Payments
Kashier · Stripe · COD (country-gated)
Money
Integer cents · EGP base → SAR/AED/KWD
Webhooks
HMAC + ProcessedWebhook idempotency
02 — Core Architecture

How a request moves through the system

Request Path

01 / 04
01 · Frontend

Next.js Storefront

App Router storefront injects locale + currency headers on every request. Cart mutations are optimistic (400ms debounce) with rollback. Checkout stepper calls /checkout/initiate before any payment UI.

Measured Impact

Last-unit checkout
Read-then-write race → oversell
Redis mutex, 0% oversell
Cart hydration
N+1 variant + promo queries
<120ms hydrated read (stock, sale, shipping)
Currency conversion
IEEE-754 floats at the edge
Integer cents + Redis FX hash
Payment retries
Duplicate capture on webhook replay
Idempotent ProcessedWebhook key
Catalog images
Raw Arabic URLs → 404
Cloudinary re-host (895 / 896 repaired)
Guest → auth cart
Lost session or double lines
Redis guest key merged on user.login
03 — Deep-Dive Modules

How it was built, system by system

01 / 20
Made CSV Re-Import an Upsert, Not a Duplicate Factory
Core Engine & Business LogicModule 05

Made CSV Re-Import an Upsert, Not a Duplicate Factory

The importer matches existing products by variant SKU or slug and updates text + price + stock in place (deliberately never touching images, so re-imports can't clobber fixed media), instead of skipping or duplicating. Variants are reconciled by SKU — existing ones get stock/price patched, new SKUs are created — all inside a 30s-timeout Prisma transaction returning a { created, updated, skipped, errors } summary.

Core Engine & Business Logic3
Real-Time, Media & Tracking3
Commerce, Checkout & Payments10
Auth, Security & Compliance2
Data, State & Performance1
Interface, Motion & Accessibility1

Related Projects

Explore more of my work

smoke
logo

"If Your Dreams do not scare you, they are too small !"

Got a project? Let’s vibe together and
make it ninjaa-precise—get in touch!

Call Me Now !

mail

noordragon2004@gmail.com

address

from egypt,mansoura

phone

+20 1145838187