E-Commerce 2024 * Live

NUSACART

A full-stack e-commerce platform built for Indonesian small-to-medium businesses - featuring real-time inventory management, multi-vendor support, and a Rupiah-native payment gateway integration. Designed to handle the chaos of flash sales at scale.

https://nusacart.id/admin/dashboard
Dashboard
Products
Orders
Vendors
Analytics
Settings
Dashboard
+ New Product
Rp 84M
Revenue This Month
1,247
Orders Today
312
Active Vendors
Order ID
Customer
Amount
Status
#ORD-20240891
Budi Santoso
Rp 345.000
shipped
#ORD-20240890
Siti Rahma
Rp 128.500
pending
#ORD-20240889
Agus Wijaya
Rp 790.000
delivered

THE PROBLEM

Indonesian SMBs were stuck using WhatsApp catalogs and spreadsheets to manage their online stores. Existing platforms like Tokopedia were either too expensive or too rigid for small vendors. NusaCart was built to fill that gap - a self-hosted, open-source alternative with full control over inventory, pricing, and customer data.

The biggest challenge was building something robust enough for flash sales (where hundreds of orders can hit in under a minute) while keeping the UI simple enough for vendors with minimal tech experience.


CHALLENGES & SOLUTIONS

01
Race conditions during flash sales. When 300+ users hit "Buy Now" simultaneously, inventory counts would desync. Solved using SELECT FOR UPDATE with PostgreSQL row-level locking and a Redis queue to serialize order writes.
02
Payment gateway fragmentation. Indonesia has 12+ popular payment methods (GoPay, OVO, DANA, virtual accounts). Built a unified PaymentAdapter interface so each provider plugs in without touching core logic.
03
Real-time inventory sync. Multiple vendor admins editing stock at the same time caused stale reads. Implemented a WebSocket broadcast system using socket.io rooms per vendor - updates propagate to all tabs instantly.
src/orders/createOrder.ts TypeScript
01async function createOrder(payload: OrderPayload) { 02 return db.transaction(async (trx) => { 03 // Lock the product row to prevent race conditions 04 const product = await trx('products') 05 .where({ id: payload.productId }) 06 .forUpdate() // SELECT FOR UPDATE 07 .first(); 08 09 if (product.stock < payload.qty) 10 throw new Error('Out of stock'); 11 12 await trx('products') 13 .where({ id: payload.productId }) 14 .decrement('stock', payload.qty); 15 16 const [orderId] = await trx('orders').insert(payload); 17 await redis.publish('inventory:update', payload.productId); 18 return orderId; 19 }); 20}

RESULTS

After 6 months in production across 8 pilot vendors in Bandung and Jakarta, NusaCart processed over 14,000 orders without a single inventory desync error during flash sales.

14k+
Orders processed
99.8%
Uptime over 6 months
<200ms
Avg. API response time
0
Race condition errors
<- previous project
ClimaTrack
// Weather dashboard with real-time data viz
<- view project
next project ->
DevBoard
// Real-time project management tool
view project ->