Case Study
Almarai Scan & Win — Reusable Consumer Promotion Platform
A reusable, Arabic-first campaign engine powering Almarai's seasonal consumer promotions. Shoppers sign in with a phone number, earn points by uploading receipts or product photos, playing branded mini-games and sharing posts, then redeem them in lucky draws — delivered as six-plus branded editions between 2025 and 2026.
- Status
- 6+ campaign editions delivered (2025–2026)
- Role
- Full-Stack Developer
- Platforms
- Mobile Web
Problem Statement
Almarai runs frequent seasonal promotions — Ramadan, summer, back-to-school, football, ice cream. Each one needs sign-up, proof of participation, fair points, prize redemption and CRM capture, and building every campaign from scratch was slow.
- Every short-lived campaign started from zero
- Shoppers on phones won't create passwords
- Points must be tied to real purchases or engagement
- Game results and points must resist replay
- Sign-ups needed to reach the CRM with campaign tags
- Arabic-first audience requiring full RTL support
The Solution
We built one campaign engine on React and Firebase and delivered it as a series of branded editions — Food Service, Summer, Ramadan, Ice Cream, Football and Safiya — each in its own isolated Firebase project. Campaign flags, translations, prizes and FAQs live as data, and each edition adds its own activity on top of the shared core.
- Phone Login
- Points Ledger
- Lucky Draw & Vouchers
- Branded Mini-Games
- Social Feed & Sharing
- CRM Sync
Key Features
Passwordless Sign-In
- Phone-number login via a custom-token Cloud Function
- Server-side Gulf dial-code and length validation
- Optional phone-OTP mode switchable per campaign
- Persistent sessions with Redux Persist
Points, Draws & Vouchers
- Spendable and lifetime points on every user
- Lucky-draw entries priced per gift
- Winner vouchers with codes, serials and email confirmation
- In-app notifications for approvals and awards
Replay-Resistant Mini-Games
- Unity WebGL games embedded in the app
- Single-use, server-issued 64-hex session tokens
- Difficulty rises with the day's play count
- Wins evaluated on the server
Proof of Participation
- Camera capture or upload of receipts and product photos
- In-app review queue for pending submissions
- OCR + LLM points mapping (2025), then automated receipt verification (2026)
Social Feed & Sharing
- Public feed of approved posts with live likes
- Server-rendered Open Graph pages so shared posts preview properly
- Referral tracking on shared links
CRM & Operations
- Automatic Mailchimp audience sync with campaign tags
- Campaign kill-switches stored in Firestore
- Voucher batch tool (QR code / barcode)
- Multi-threaded storage backup tooling
Tech Stack
Frontend
- React
- TypeScript
- Vite
- Redux Toolkit
- Tailwind CSS
- i18next (AR/EN, RTL)
- Unity WebGL
Backend
- Firebase Cloud Functions
- Cloud Firestore
- Firebase Storage
- Firebase Auth
Services
- Mailchimp API
- Google Gemini
- Taggun OCR
- Firebase Hosting
Architecture
Multi-Tenancy
One shared campaign engine, deployed per campaign into its own isolated Firebase project
Realtime
Firestore listeners for live feed likes and post updates
Data Model
Users → Submissions → Game Sessions → Gifts → Lucky Draw Entries → Vouchers → Public Feed → Notifications
My Responsibilities
- Campaign engine architecture on React and Firebase
- Passwordless phone login with server-issued tokens
- Points ledger, lucky draw and voucher flows
- Unity WebGL game integration with server-side sessions
- Open Graph share pages for social previews
- Mailchimp CRM integration
- Arabic/English RTL internationalisation
- Operational tooling: review queue, voucher tool, backups
Challenges Overcome
- Reusing one engine across campaigns with different activities
- Low-friction sign-in for a public audience
- Game integrity with client-side Unity builds
- Social previews for a single-page app
- Arabic-first UI with RTL and Arabic digits
Outcome
Six-plus editions shipped
Roadmap
- Consolidate editions into one configurable codebase
- Server-side transactions for all points movements
- Automated receipt verification across every edition
Impact
- At least six campaigns delivered on one reusable engine between early 2025 and mid-2026
- Every sign-up captured straight into Mailchimp with campaign tagging
- Proof-of-purchase checking moved from fully manual review toward AI-assisted auto-approval
- Operational tools support running and closing each campaign