E-commerceAPI/backend · E-commerce
Customer RFM segmentation engine
Designed and built a customer segmentation engine for a multi-store e-commerce operator, scoring customers on recency, frequency and spend and grouping them into 11 marketing segments. Custom probabilistic data structures kept it fast on hundreds of thousands of records, with a concurrent server and API layer on top.
Problem
The client needed to score and segment a large customer base from raw order data for marketing, with no scalable way to do it.
Solution
Working architecture-first, the developer agreed data structures and pseudocode with the client before coding, then built a Spectral Bloom Filter class and hash-table segment structures, normalised RFM scores and assigned customers to 11 segments, with boundary customers placed in both adjacent segments. The engine was reworked after testing on about 471,000 records, and extended with a multithreaded UNIX-socket client/server layer, an actix (Rust) API calling the PHP scripts, storefront drawers and a Laravel API deployed to a remote server.
Key features
- Normalised RFM scoring per customer
- Segmentation into 11 segments with boundary handling
- Spectral Bloom Filter and hash-table segment structures
- Tested on about 471,000 records
- Multithreaded UNIX-socket client/server protocol
- Rust actix API layer calling PHP scripts
- Storefront add-to-cart and size-chart drawers
- Laravel API deployed to a remote server
Tech stack
- Bloom filters
- Laravel
- PHP
- Rust
- Shopify
- UNIX sockets
- actix