# perk/mm-loyalty ## Hero ### From 500ms endpoints to enterprise-grade in time for a global brand launch. M&M's needed a loyalty platform ready for thousands of concurrent users. The existing infra wasn't close. Bleu rebuilt the performance layer, monitoring, and incident response before the hard launch date. ## Context In early 2025, Perk landed their biggest opportunity yet: M&M's wanted to launch "M&M's Fun Club" – a customer engagement platform that would go live in February 2025. The problem was the existing infrastructure wasn't ready for primetime. Endpoints were responding in 500ms+. The codebase was riddled with n+1 queries and memory allocation issues. There was no comprehensive monitoring, no incident response system, and no confidence the platform could handle the traffic a major global brand would bring. With thousands of concurrent users expected and a hard launch date approaching, Perk needed more than incremental improvements – they needed a complete technical transformation. - Endpoints responding in 500ms+ with n+1 queries and memory allocation issues - No comprehensive monitoring or incident response system - Infrastructure not ready for global brand traffic - Hard launch date in February 2025 ## Our role We took ownership of the technical foundation. Rebuilding infrastructure from the ground up while shipping the features M&M's needed for launch. The stakes were clear: if the platform failed during launch, it wouldn't just hurt Perk's relationship with M&M's — it would undercut confidence that Perk could operate at enterprise expectations. ### Quote > "These aren't small clients. We have real repercussions as a company if things go wrong, even financial penalties for downtime. It's nice that I'm not up at night worried it's going to break." ## What changed The platform moved from fragile under load to stable in production. Response times dropped from 500ms+ to under 50ms. Load testing validated 10,000 concurrent users, and since launch the platform has maintained 99.984% uptime. - M&M's launched on schedule in February 2025 with zero downtime during the critical launch period - Response times from 500ms+ to under 50ms - 10,000 concurrent users validated through load testing - 99.984% uptime since launch ## Areas we took ownership of #### Infrastructure Rebuild Replaced manual deployments with Infrastructure as Code using AWS CDK. - **Infrastructure as Code**: Replaced manual deployments with Infrastructure as Code using AWS CDK. Implemented enterprise security standards from day one and designed for horizontal scalability to handle unpredictable traffic spikes. #### Performance Optimization Achieved 90% latency reduction through systematic optimization. - **Systematic Optimization**: Achieved 90% latency reduction through systematic optimization – eliminating n+1 queries, adding strategic indexes, and resolving memory allocation issues throughout the codebase. Validated everything through rigorous load testing until the application handled 10,000 concurrent users smoothly. #### Receipt Scanning System Built the core engagement mechanic for the platform. - **Receipt Scanning**: Built the core engagement mechanic: customers submit receipts containing M&M's products, the system processes and validates them automatically, and users redeem rewards for M&M's branded merchandise. #### Gaming Challenges Implemented interactive mini-games integrated into the platform. - **Gaming Challenges**: Implemented interactive mini-games integrated into the platform with a point-based reward system and exclusive M&M's-themed challenges. #### Notification System Platform-wide notifications and targeted user messaging. - **Notifications**: Added a notification system for platform-wide messaging and targeted user communications, giving M&M's another way to react to user activity during launch. #### Custom Frontend Built a dedicated frontend for the M&M's experience. - **M&M's Frontend**: Built a dedicated frontend for M&M's on top of the rebuilt platform, giving the brand its own customer-facing experience without forking the core system. #### GraphQL API Designed a new API specifically for the M&M's frontend. - **New GraphQL API**: Designed a new GraphQL API specifically for M&M's frontend, with optimized queries that eliminated the n+1 problems plaguing the legacy REST endpoints. #### Data & Analytics CSV processing engine and admin dashboards. - **Data Processing**: Built a CSV processing engine that exports millions of rows in seconds, plus admin dashboards for metrics including access patterns, retention data, and stock information. #### APM & Monitoring Established health check routines and proactive issue detection. - **Health Check**: Established weekly health check routines monitoring infrastructure, email delivery, and response times – enabling proactive issue detection before users notice problems. #### Security Hardening Implemented OTP system with protection against attacks. - **OTP System**: Implemented a one-time password system with protection against brute-force attacks, rainbow table attacks, and birthday problem vulnerabilities. #### On-Call & Incident Response 24/7 coverage with senior engineers on rotation. - **On-Call Rotation**: Set up 24/7 coverage with senior engineers on rotation, ensuring 100% incident response coverage with rapid resolution protocols. #### Webhook System Configurable webhooks for real-time event emission. - **Webhooks**: Built configurable webhooks for real-time event emission, enabling synchronization between M&M's infrastructure and Perk. ## Why this partnership works M&M's launch required both speed and precision — there was no room for the platform to give way under pressure, and no time to build slowly. Bleu operated as an extension of Perk's team, taking full ownership of technical decisions while Perk focused on the client relationship and launch coordination. ## Outcome The M&M's Fun Club launch established that Perk could support a global-brand rollout under real operating constraints. By rebuilding infrastructure, improving performance, and putting reliability practices in place before launch, the team shipped in February 2025 without downtime and left Perk with a foundation it could reuse on later enterprise work.