Webline Dashboard
Complete e-commerce control center
Overview
Comprehensive admin panel for managing the Webline e-commerce platform. Built with Next.js 16 and oRPC for end-to-end type safety, featuring real-time data synchronization, order lifecycle management, and a dynamic promotion engine.
Architecture
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, Tailwind CSS 4 |
| API | oRPC with end-to-end TypeScript type safety |
| Auth | Better Auth (passkey, 2FA, OAuth support) |
| Gateway | Cloudflare Worker with resilience patterns |
| Database | Cloudflare D1 + Drizzle ORM (25+ tables) |
Order Lifecycle Management
Complete state machine for order tracking:
pending_payment → confirmed → processing → shipped → delivered
↓
cancelled (from any state)
Each transition triggers:
- Inventory updates
- Customer notifications
- Analytics events
- Webhook dispatches
API Gateway Resilience
Rate Limiting (Sliding Window)
| Tier | Limit | Window |
|---|---|---|
| API | 100 requests | 60 seconds |
| Auth | 5 requests | 300 seconds |
| Search | 30 requests | 60 seconds |
| Upload | 10 requests | 3600 seconds |
Circuit Breaker Pattern
- Closed State: Normal operation, requests pass through
- Open State: After 5 failures, all requests fail-fast for 30 seconds
- Half-Open State: Test single request, reset or re-open based on result
Retry with Exponential Backoff
delay = baseDelay * 2^attempt + random(0, 100)ms
// Capped at maxDelay (10 seconds)
Customer:
Webline TechnologiesPeriod:
6 monthsPerformance:
Features:
Indigo Primary
Success Green
Error Red
White
Challenge: Resilient Microservices Gateway
The Problem
Building an API gateway that handles rate limiting, circuit breaking, and graceful degradation across multiple backend services while maintaining sub-100ms response times.
The Solution
Implemented a Cloudflare Workers gateway with multiple resilience patterns:
- Sliding Window Rate Limiting: Token bucket algorithm with KV storage for distributed state
- 3-State Circuit Breaker: Automatic failure detection and recovery (5 failures → 30s cooldown)
- Exponential Backoff with Jitter: Prevents thundering herd on retry storms
- Stale-While-Revalidate: Serve cached responses immediately, refresh in background
- Non-blocking Telemetry:
waitUntil()for async logging without latency impact
Challenge: Complex Order State Management
The Problem
E-commerce orders have complex lifecycles with multiple state transitions, each requiring atomic updates across inventory, payments, and notifications.
The Solution
Designed an event-driven order system:
- State Machine: Explicit transitions with validation rules (e.g., can't ship a cancelled order)
- Soft References: Order items preserve product history even after deletion
- Transaction Logging: Every state change recorded with timestamp and actor
- Queue-Based Side Effects: Notifications and analytics processed asynchronously via Cloudflare Queues
Challenge: Flexible Promotion Rules
The Problem
Marketing teams need to create complex promotional campaigns with time-based triggers, usage limits, and stacking rules—without developer intervention.
The Solution
Built a dynamic promotion engine:
- Rule Builder: Admin UI for creating conditions (user registration date, cart value, product categories)
- Coupon Validation Middleware: Real-time checking with clear error messages
- Redemption Tracking: Per-user limits with atomic increment operations
- A/B Testing Support: Multiple promotion variants with automatic winner selection
The admin dashboard Gerald delivered gives us complete control over our e-commerce operations. The order lifecycle tracking is seamless, and the promotion engine has become essential for our marketing campaigns. What impressed me most was the resilient API gateway architecture—the circuit breaker and rate limiting ensure our system stays stable even under heavy load. Gerald's ability to architect complex systems while keeping the user experience simple is outstanding.
Patrick Gitau
Chief Executive Officer · Webline Technologies Ltd.
Would you like to be featured here as well?
Feel free to use the contact form or other contact options.

