Executive Summary
Waafi Ecommerce is an enterprise-grade, fully managed e-commerce platform built by WaafiTech for Bangladesh's fast-growing f-commerce and SME market. Where off-the-shelf WordPress solutions consistently failed business owners the moment their operations grew beyond the basics, Waafi Ecommerce delivers a purpose-built, AI-powered, and deeply scalable alternative — one that grows with the business, not against it.
The platform consolidates 15+ operational modules — from multi-warehouse inventory management and double-entry accounting to AI-driven marketing automation, supplier purchase order management, customer support ticketing, real-time fraud detection, and enterprise-level layered security — into a single, cohesive product. It is the software WaafiTech's clients always needed but could never find.
The Problem: A Market Underserved by Technology
Bangladesh's f-commerce ecosystem is remarkable. Tens of thousands of entrepreneurs built real, profitable businesses entirely through Facebook — organic communities, loyal repeat customers, and genuine brand equity. But when they tried to graduate to proper e-commerce, they hit a wall.
The technology providers available to them fell into two camps: cheap WordPress theme shops that handed over a site and disappeared, and enterprise software vendors whose pricing was aimed at multinationals. There was nothing serious, affordable, and purpose-built for the Bangladeshi market in between.
"My previous developer gave me a WooCommerce site. It worked for three months. Then my inventory numbers stopped making sense, orders started duplicating, and when I asked for a fix, he said he'd need to rebuild everything. I'd already paid him twice." — A typical client conversation before Waafi Ecommerce.
The specific gaps WaafiTech observed across dozens of client conversations:
- No real inventory management. Stock was tracked in Excel or WhatsApp groups. Overselling was common. Multi-warehouse operations were impossible.
- No profitability visibility. Revenue was visible; actual profit — after COGS, shipping, payment gateway fees, courier COD charges, and returns — was not.
- No marketing automation. Abandoned carts were invisible. Dormant customers were forgotten. Flash sales meant posting manually on Facebook.
- No supplier management. Purchase orders tracked in spreadsheets, no reorder automation, no supplier contact system.
- No fraud detection. Fake phone numbers placed COD orders with no intention to receive — costing merchants thousands monthly with zero visibility.
- No scalable architecture. Adding a second warehouse, a second brand, or a second staff member required developer intervention every time.
- No security posture. No rate limiting, no bot protection, no audit trails, no role-based access. One disgruntled employee could access everything.
- No tracking intelligence. GA4, Facebook Pixel, TikTok Pixel, and Microsoft Clarity were either misconfigured or entirely absent, making paid marketing a guessing game.
Our Approach: Design for the Business, Then Engineer for Scale
WaafiTech began Waafi Ecommerce with an explicit rule: no feature would be built without a corresponding real-world business scenario it solved. Every sprint began with a business problem, not a technical idea.
This meant spending time with actual f-commerce operators — watching how they processed orders, communicated with suppliers, resolved customer complaints, tracked returns, and where they felt the most pain. The product roadmap was built bottom-up from those conversations.
The technical architecture followed a complementary principle: build for the scale the client will need in 18 months, not the scale they need today. Every data model was designed with multi-tenancy, multi-warehouse, and multi-currency in mind from day one.
Technical Architecture
Frontend & Rendering
Waafi Ecommerce is built on Next.js 16 with React 19, using the App Router with a carefully considered mix of Server Components, Client Components, and Suspense streaming. Product listing pages are statically generated with on-demand revalidation. Dashboard pages load data in parallel using Suspense boundaries, ensuring the screen appears instantly while data streams in. The storefront scores 95+ on Lighthouse performance across all tested configurations.
Database Design
PostgreSQL serves as the primary database, with a schema designed specifically for e-commerce. Key design decisions:
- Products and variants are properly separated, with each variant carrying its own SKU, price, stock level, and independent image gallery (up to 15 images).
- Orders cascade through a state machine (pending → confirmed → processing → shipped → delivered → returned) with every state transition logged with actor and timestamp.
- Inventory movements are tracked as a 7-bin ledger model (available, reserved, committed, inTransit, damaged, returned, quarantine) — every adjustment has an immutable source record.
- Accounting entries follow double-entry bookkeeping — every order automatically generates revenue, COGS (Weighted Average Cost), shipping cost, gateway fee, and tax entries.
- Batch/lot management tracks manufacture and expiry dates per warehouse — sorted FEFO (First Expiry, First Out) automatically.
Caching & Performance
Redis handles session state, real-time cart persistence (survives browser close), rate limiting counters, fraud check token caching (2-hour TTL), and frequently-read catalog data. This allows Waafi Ecommerce to handle traffic spikes — flash sales, SMS blast responses — without infrastructure changes.
Object Storage
All product images, gallery assets, invoices, category banners, brand logos, and media are stored in Cloudflare R2, served through a custom domain. R2's zero-egress pricing model means storage costs scale predictably with catalog size, not traffic.
Core Platform Modules
Catalog Management
Full product management with Simple, Variable, and Digital product types. Each product supports up to 15 images (5MB each), YouTube video embeds, Rich Text descriptions, SEO metadata with live Google preview, scheduled publishing, and variant-specific pricing, SKUs, stock levels, and independent image galleries. The category system supports unlimited nesting with tree-view management. Combo products bundle multiple items with custom pricing. Flash sales with countdown timers restore original prices automatically on expiry.
Order Management & Returns
Orders flow through an automated state machine with context-aware action buttons at each step. Manual order creation supports WhatsApp/phone orders with customer registration, coupon application, and multi-source tracking (Facebook, Instagram, WhatsApp, etc.). A full return management system handles item-level returns with condition tracking (GOOD/DAMAGED), refund calculation minus restocking fees and reverse shipping costs, and a multi-step approval workflow (requested → approved → received → completed). Every order generates a printable invoice.
Inventory & Warehouse Management
A 7-bin stock model gives complete visibility into stock state at any moment. Multi-warehouse support with transfer order management (pending → approved → shipped → received). Batch/lot tracking for expiry-sensitive products (food, cosmetics, medicine) sorted FEFO. Barcode generation (CODE128 + QR) with bulk PDF export sized for standard label printers (62×38mm, 3 per A4 row). 10 inventory reports including AI-powered stock replenishment predictions and sale clearance recommendations powered by Claude AI.
Marketing & Growth
A complete marketing stack: coupon engine (percentage, fixed, Buy X Get Y, free shipping) with usage limits and customer-level restrictions; campaign builder (14 campaign types including Flash Sale, Eid, Black Friday) with scheduling and performance analytics; customer segmentation with rule-based automatic segment refresh; abandoned cart recovery with email and SMS sequencing; announcement system (8 placement types including exit-intent and showcase grid) with frequency controls and countdown timers; banner management for 6 placement types with desktop/mobile image variants; SEO blog with rich-text editor; newsletter with segmentation by purchase history; combo deals; and curated collections. Backed by a multi-tab marketing analytics dashboard with custom date ranges, period comparison, and CSV/PDF export.
Courier Integration & Fraud Detection
Native API integration with Pathao, Steadfast, and RedX couriers. A configurable 3-tier delivery rate per courier (Inside Dhaka, Sub-City, Outside Dhaka) calculates shipping costs automatically based on weight. A real-time fraud check system queries all three courier networks for a phone number's delivery history, computing a 0–100 safety score with per-courier breakdown (delivery attempts, success rate, cancellation rate). Orders from high-risk numbers are flagged automatically on the order detail page.
Double-Entry Accounting
Every order, return, inventory adjustment, and supplier purchase automatically generates double-entry accounting journal entries. The P&L dashboard shows actual profitability by product, category, time period, or sales channel — not just revenue. Weighted Average Cost (WAC) methodology tracks inventory valuation across warehouse transfers and purchase receipts.
Supplier & Purchase Order Management
Full supplier profile management with product assignment, contact details, and payment terms. Purchase order creation with line-item stock receipt — automatically updating inventory and generating accounting entries on goods receipt. Supplier performance tracking.
Customer Support Ticketing
Customers open support tickets linked to specific orders. Staff respond with full order context visible in the same view. Priority levels, SLA tracking, internal notes, and complete ticket history for both customers and agents.
AI Automation Layer
The AI automation system is built on n8n as the workflow orchestrator, connecting Waafi Ecommerce's internal APIs with Claude AI and other leading AI providers. Key workflows:
- Abandoned Cart Recovery: Customers who add to cart but don't complete purchase receive a personalized email sequence (immediately, after 2 hours, after 24 hours) with AI-generated copy tailored to the specific products they left behind. SMS follow-up is triggered for customers who haven't opened the emails.
- Dormant Customer Re-engagement: Customers who haven't placed an order in a configurable period (default 60 days) are automatically identified, segmented by purchase history, and receive personalized offers generated by AI based on what they previously bought — not generic discount blasts.
- Intelligent Courier Routing: When an order is ready for dispatch, the system evaluates the delivery address, available courier APIs, current delivery times, and pricing — then automatically selects the optimal courier and books the pickup.
- AI Stock Replenishment Prediction: Analyzes demand patterns, customer behavior, order history, and sales velocity to recommend reorder quantities with priority scoring (Critical/High/Medium/Low) and supporting reasons.
- AI Sale & Clearance Recommendations (Claude AI): Identifies slow-moving stock (dead stock, ageing inventory) and recommends discount percentages with urgency scoring and reasons. Falls back to an algorithmic approach when AI is unavailable.
- AI-Powered Product Descriptions: Merchants generate SEO-optimized product descriptions from basic input directly within the admin panel.
Enterprise Security Framework
Security was designed in layers, not bolted on:
- Cloudflare Turnstile on all public-facing forms — login, registration, checkout, contact — to block automated abuse without degrading user experience.
- API rate limiting at per-IP and per-endpoint granularity using Redis, with automatic temporary blocks for sustained abuse patterns.
- Dynamic IP block list — admins can block IPs manually or rules trigger automatic blocks, with configurable expiry (temporary ban vs. permanent).
- Granular role-based access control — individual permissions for each system action (canCreate, canRead, canUpdate, canDelete per module), assignable per user. The admin panel renders only the UI elements the current user has permission to see.
- Full activity audit log capturing every security-relevant event (login attempts, permission changes, order modifications, inventory adjustments, payment verifications) with privacy-safe IP hashing (SHA-256, 20-char truncated — never raw IP stored).
- Staff session management — admins can view and terminate active sessions for any staff member in real time.
- Fraud order detection — phone number risk scoring via Pathao, Steadfast, and RedX courier networks, with a composite 0–100 safety score and per-courier breakdown surfaced directly on the order detail page.
Analytics & Tracking
All tracking follows a dual server-side + client-side approach:
- Google Analytics 4: Standard client-side tag plus server-side Measurement Protocol events for purchases — 100% order attribution even through ad blockers.
- Facebook Conversions API: Server-side event deduplication with client-side pixel for maximum signal quality for Meta campaign optimization.
- TikTok Events API: Server-side events alongside the client-side pixel — TikTok's recommended implementation for commerce advertisers.
- Microsoft Clarity: Session recordings and heatmaps for UX analysis and CRO.
Results & Impact
Waafi Ecommerce went from concept to production in 8 months and has since been deployed for multiple WaafiTech clients. Measurable outcomes:
- Inventory discrepancy rate dropped from an average of 18% (spreadsheet-based) to under 0.5% within the first 90 days.
- Abandoned cart recovery workflows recover 12–19% of otherwise-lost orders, depending on the product category.
- Merchants report an average of 6 hours per week saved on manual order processing and inventory reconciliation.
- Average storefront Lighthouse performance score: 96/100 on desktop, 91/100 on mobile.
- Zero reported security incidents across all deployed instances since launch. Multiple automated attack campaigns detected and blocked.
- Fraud order detection has saved clients an estimated 15–22% reduction in failed COD deliveries in the first month of activation.
What We Learned
Building Waafi Ecommerce reinforced several things WaafiTech believes strongly about software for growing businesses:
First, accounting and inventory must be first-class citizens, not features added after the "real" e-commerce functionality. Every business decision — what to restock, which product to promote, which customer segment to target — is downstream of accurate financial data.
Second, AI automation delivers the most value when it's invisible. The highest-impact workflows (abandoned cart, dormant customer re-engagement, courier routing, stock prediction) run entirely in the background. The merchant sets a rule once and the system handles it.
Third, security is not optional for any business handling customer data and payment information. The IP blocking, Turnstile, fraud detection, and activity logging systems have already caught and stopped multiple automated attack campaigns.
Finally, design for the 18-month version of your client's business. Every client who came to WaafiTech with a "small" business either grew significantly or planned to — and the ones whose platforms couldn't grow with them eventually lost that growth to their competition.




