Demo · Nov 2026 –
Uniform e-commerce: multi-storefront, retail and corporate
My role · I built the system
A uniform workshop sold both retail and corporate but had no place online. The product has many branches: colour and size, name and badge embroidery, corporate bulk orders.
A multi-storefront e-commerce platform: sub-storefronts by domain under an umbrella brand; retail and price-free corporate quotes in one system (colour × size matrix, personalised name list).
A cart priced on the server and an order that decrements stock atomically. A panel the owner runs from a phone (with a bulk-sales switch). A 3D embroidery preview for a surgical cap.
Demo: it runs in a password-gated preview; it has been shown to the owner. There is no real store yet; the domain, real content and hosting are pending.
Sub-storefronts by domain under an umbrella brand: separate identities, a shared catalogue and order core; a setup that avoids looking like a reseller.
A product × colour × size matrix and a personalised name list (ten different names, sizes) in one quote; a sample flow; the owner can switch bulk sales off.
Bulk product upload from Excel/CSV (preview, confirm), photo upload, a single-product form, business and delivery settings, cancellation and stock return.
A cart priced on the server, an order that decrements stock atomically in a single Postgres function, a token-protected confirmation page.
Text embroidery on a surgical cap: font and thread colour, placement and size, touch-and-drag; photo-based placement on flat products; a panel preview in the order detail.
Inside the core, exploded view
The total the customer sees is only compared: the server computes the price itself and writes nothing if they differ (409).
Preview first, then apply: the preview fingerprint is recomputed on apply and nothing is written if it differs; the write is all-or-nothing.
Order, lines and stock decrement run in one transaction; SKUs are locked in order and the whole transaction rolls back if stock falls short. Opened up below.
pg_cron cancels unpaid orders; state is re-checked after locking, so an order an admin just approved is not cancelled.
One core under an umbrella brand
One codebase and one database; theme, titles and sitemap are separate per storefront. An unknown address returns 404. Six storefronts are defined, two are open (umbrella gate and medical), four are “coming soon”. With no domain attached, the demo picks the storefront with a setting.
A single free-text note could not carry ten different names and sizes for ten pieces; a demo trial exposed it. The fix is a name list: pasted from Excel, bad rows reported by line number, names per size cannot exceed that size’s quantity, and pieces not on the list are made without a name.
Two customers can order the same last item at once. The order, its lines and the stock decrement are written in one database transaction; a shortfall rolls it back. On a real database with stock 10, two parallel orders of 6: one accepted, one rejected, stock 4 (script not in the repository).
The server computes the price; the on-screen total is only compared, and a mismatch writes nothing and shows the new total. If an order whose reply was lost is resent with a corrected address, the difference is caught and the customer warned. An independent review caught both.
A wrong file would corrupt prices and stock, and there is no undo. So a file saved from Excel as CSV is previewed before anything is written: what changes, which row is wrong and why. If the preview differs at approval, the write stops. One transaction; stock is kept by default, no deletions.
The spot on the cap is saved as angles and size, independent of the model’s shape, and the server validates it. The photo or fabric colour behind the preview is saved with the order too, so even if photo order changes later, the owner sees in the panel the spot the customer saw.
Untied view: raw records from the evidence table, not a live log.
Private repository · git history (9–25 Nov 2026)
Private repository: demo on request.