Product sample · Commerce
Bazaar Store
A storefront and back office in one page: catalogue with variants, cart pricing with promos and shipping, checkout with COD/eSewa/Khalti adapters, an order state machine and inventory that reserves and releases stock.
12products
24variants
48tests
0deps

The problem
Commerce breaks at the edges.
A cart is easy. The bugs live at the edges: a discount that must be allocated across lines without losing a paisa, a variant that sells out while the cart is open, an order that cannot move backwards without breaking the ledger.
Bazaar Store is a small commerce system that takes those edges seriously and tests them.
What we built
Money, stock and state.
- Integer-minor-unit pricing with line discounts, promo validation and a shipping threshold.
- Stock that reserves on cart, releases on abandonment and commits on payment.
- An order state machine with legal transitions for pack, ship, deliver, cancel and refund.
- Back office with revenue, low-stock alerts, inventory adjustment and an order desk.
Architecture
How it is put together
storefront demo
├─ catalogue / product / cart / checkout (buyer)
├─ admin: orders, inventory, revenue (operator)
└─ src/: money, promos, cart pricing, inventory,
order state machine, payment adapters, revenue
localStorage persistence · node:test for every module
Stack
TypeScriptVanilla JSCSS
Security and money
- Discounts are allocated with largest-remainder so line totals sum exactly to the discounted total.
- Stock reservation is explicit (reserve/release/commit) rather than a single decrement.
- Payment adapters share one interface; the mock rail records a verifiable transaction id.
- Illegal order transitions are rejected by the state machine, not by button visibility.
Screens
Product surfaces

Similar work
Building something in this category?
We can walk you through the architecture, the payment integration and the failure cases on a call, including the parts that were hard.