Skip to content
Menu
Portfolio
  • Artificial Intelligence
  • Personal Projects
  • Assignments
  • Algorithms
  • Notes
  • Home
Portfolio

Sweepstakes Marketing

Posted on May 14, 2025July 12, 2025

TRY THE DEMO AT https://luckydraw.hebo.life/

You can view the source code on GitHub at https://github.com/Leon-bo-He/big-market

This Raffle module is a pivotal component of the comprehensive Marketing Platform, designed to enhance user engagement through diverse promotional activities such as raffles, point accumulation, redemptions, and rebates.

The following is the Business Process Diagram for the module:


Technical Architecture

  • Architecture Design: The project adopts a microservices architecture with Domain-Driven Design (DDD) principles and a front-end/back-end separation, ensuring scalable, maintainable, and flexible development.
  • Core Technologies:
    • Backend: Spring Boot, MyBatis, MySQL, Redis, RabbitMQ
    • Frontend: React, TypeScript

Raffle Module Highlights

  • Versatile Raffle Mechanisms: Supports various raffle types including general raffles, blacklist filtering, targeted user groups, draw times based raffles, and unlockable rewards after multiple draws.
  • Design Patterns Utilized: Incorporates Template, Chain of Responsibility, and Factory patterns to enhance code extensibility and maintainability.
  • Performance Optimization: Engineered to handle high-concurrency scenarios, achieving 400–600 TPS on a 4-core, 16GB RAM server, with response times ranging from 70ms to 150ms.

Core Responsibilities

  • Domain Model Design: Defined comprehensive domain models for the raffle process, segmenting it into pre-draw, in-draw, and post-draw phases, each with extensible behaviors such as user eligibility checks, inventory deduction, and fallback rewards.
    • More details on the different draw stages:
      • In the pre-draw stage, we perform blacklist filtering and a rule-weight check to guarantee rewards based on the number of user raffle attempts;
      • In the in-draw stage, we verify whether the drawn reward is unlocked, perform inventory deduction.
      • In the post-draw stage, we check prize inventory and return a fallback reward if the prize is unavailable or locked.
  • Database Schema Design: Structured raffle-related tables including strategy, strategy_rule, strategy_award, and rule_tree to facilitate scalability and flexibility.
  • Process Standardization: Established a standardized raffle process using the Template pattern, integrating the Chain of Responsibility for draw actions and the Composite pattern for dynamic post-draw rule processing.
  • API and Trigger Layer: Developed a unified API standard with a trigger layer encompassing listeners, tasks, HTTP, and RPC modules, treating all actions as triggerable events.
  • Inventory Management: Implemented Redis-based inventory deduction with segmentation and locking mechanisms to prevent overselling, complemented by asynchronous queues and scheduled tasks for database synchronization.
  • System Decoupling via RabbitMQ: Implemented system decoupling with RabbitMQ to handle the raffle awarding process, asynchronous account adjustment messages, behavior-based rebates, and to trigger database inventory updates and delayed queue clearing once Redis cache inventory is depleted.
  • Development and Deployment: Proficient in using IntelliJ IDEA, WebStorm, Docker, MySQL, cloud servers, and SSH tools, successfully deploying the project to a live environment.

The system design is as follow:

The following are some screenshots about the project’s frontend UI.

  • UI_1
  • UI_2
  • UI_3
  • UI_4
  • UI_5

The following are the database design. This project used sharded database and sharded tables for user activities. More details can be viewed in the images.

CATEGORIES

  • Artificial Intelligence
  • Personal Projects
  • Notes
  • Algorithms

  • University of Maryland
  • CMSC426 - Computer Vision
  • CMSC320 - Introduction to Data Science
  • CMSC330 - Organization of Programming Languages
  • CMSC216 - Introduction to Computer Systems
©2025 Portfolio | WordPress Theme by Superbthemes.com