Skip to content
adil

Alwafi for Computers

A bilingual storefront, a 24-model commerce backend, and the pipeline that ships it

Role
Design · Frontend · Backend · Database design · Infrastructure
Stack
Next.jsTypeScriptTailwind CSSExpressMongoDBRedisDockerPM2NGINXCloudflare

Alwafi for Computers (الوافي للحاسبات) is a Baghdad technology retailer with three decades of trading behind it. Storefront, API, data model, and infrastructure — designed, built, and run end to end.

01

The problem

The previous site had no caching layer. Every page view reached the database, so the store paid for the same query on every visitor.

600ms3ms
Average API response

600ms is not a slow graph — it is a customer comparing three laptops on a phone. And it failed in the wrong direction: the busier the shop got, the worse it served the people arriving to buy.

02

The design

The storefront as drawn in Adobe XD — desktop and phone, light and dark.

Alwafi landing page, light

Landing

Alwafi landing page, dark mode

Landing — dark

Alwafi laptops catalogue page

Catalogue

Alwafi product page for a Fantech headset

Product

Desktop — landing in light and dark, the catalogue, a product
Alwafi phone landing screen

Landing

Alwafi phone product screen with specification open

Product

Alwafi phone cart screen

Cart

Phone — landing, product with specification, cart
03

Architecture

Two codebases, deployed independently. Language is a route segment, so both directions are real, server-rendered, cacheable URLs.

BrowserCloudflareVercelNGINXPM2MongoDB
Product images never reach the API — they are served through a Cloudflare Worker.
Storefront
Next.js App Router · React Compiler · Tailwind
API
Express · TypeScript · Zod at every boundary
Data
MongoDB · 24 models · Redis on read paths
Size
~12k lines API · 23 route groups · 25 services
04

Not just a catalogue

The model list is closer to a small commerce platform than a storefront.

Access control

Roles and granular permissions on every route.

Affiliates

Referral programme with commission tracking.

Own analytics

Behaviour and visit data kept in-house.

Transactional email

Templates, triggers, and a delivery log.

Live notifications

Server-sent events, no polling.

Verified orders

OTP confirmation before an order stands.

Price matching

Customer requests, reviewed in-dashboard.

AI descriptions

For a catalogue too large to write by hand.
05

The shop runs it

A retailer whose pricing moves daily cannot wait on a developer. So the admin is bespoke — 28 sections. A generic CMS was never on the table: it would have meant fighting someone else's content shapes forever.

Layout
Homepage sections, navbar, brand logos, card styles
Content
Pages, buying guides, promo pages, spec templates
Commerce
Products with approvals, orders, promo codes, reviews
Languages
Translations edited in-dashboard — Arabic is not a dev task
Search
Its own SEO panel: business details, share cards, debug

Every section is gated by the permission system, so the same dashboard is safe for a junior staff member and for the owner.

06

Two directions

The store runs in English and Arabic. Arabic is right-to-left, so layout, iconography, and every directional affordance mirror — while numerals, SKUs, and Latin brand names stay left-to-right inside the same line of text.

Localisation runs on both sides of the wire: message formatting in the client, and a localisation layer in the API so emails, notifications, and order statuses arrive in the right language too.

07

Being found

A storefront nobody can find is a brochure.

Structured data

~24 schema.org types — Product, Offer, returns and shipping policy, ratings, FAQ, opening hours

Two languages
hreflang alternates and explicit canonicals on every URL
Share cards

Per-product OG images rendered at the edge, configurable from the dashboard

Feeds
Catalogue exported for Meta shopping and ads

Structured data makes the shop legible as a real Baghdad business rather than an anonymous domain. Share cards matter because a link pasted into WhatsApp — where a great deal of Iraqi commerce happens — arrives carrying the product, the price, and the shop.

08

Shipping and running

  1. 01

    Push to GitHub

    A webhook on the VPS pulls and restarts the service.

  2. 02

    Or run the full deploy

    Build, package, upload over SSH, install, reload.

  3. 03

    PM2 supervises

    API and webhook as separate processes, memory ceilings, split logs.

  4. 04

    NGINX and TLS

    Reverse proxy, certificates, firewall.

  5. 05

    Content stays fresh

    The dashboard invalidates static pages on demand.

Redis runs in Docker with append-only persistence. Releasing is a non-event.

09

Handling the rush

Alwafi's reputation was built over thirty years offline, so traffic arrived in rushes rather than a curve — the hardest shape to plan for, because the peaks break you and the average tells you nothing.

The answer was not more servers. It was making sure the same question never had to be answered twice: Redis in front of the read paths, a warming script so the first customer of a surge does not pay for everyone else, static pages at the edge with on-demand revalidation, and rate limiting on writes.

Two hundred times faster — and the shape matters as much as the size. The site no longer slows down as it gets busier. A rush loading the same category page costs about what one shopper costs.

10

Outcome

Search visibility followed. With structured data, working hreflang, a sitemap that stays current and generated share cards, the store began ranking for terms it had never appeared for — reaching customers who were not already looking for it by name.

Speed was the mechanism. A store that answers in 3ms feels maintained, and a store that feels maintained is one people hand their money to. The performance work and the trust are one result measured two ways.

That trust is what justified the scope. Roles, affiliates, analytics, the dashboard — none of it is speculative. Each part exists because the shop outgrew doing it by hand.

The strongest outcome is the one that sounds like a loss: the shop no longer needs a developer to run its own website. Catalogue, content, both languages, and its own SEO are handled in-house. A platform that has stopped depending on the person who built it is a finished one.