Cloud Computing 7 min read

How WeChat’s Serverless Cloud Functions Powered Billion-User Red Packet Covers

During the 2022 Chinese New Year, WeChat leveraged Serverless cloud functions and cloud development to handle the explosive demand of red‑packet cover creation, achieving sub‑ten‑thousand‑yuan costs, supporting over 100 million daily calls, and delivering rapid, scalable, and cost‑effective deployment for developers.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
How WeChat’s Serverless Cloud Functions Powered Billion-User Red Packet Covers

Project Background

Since the launch of the WeChat Red Packet Cover Open Platform in 2020, enterprises and individuals have been able to customize festive red‑packet covers, generating massive traffic spikes during the Chinese New Year period. In 2022, the pandemic‑induced shift to online celebrations increased reliance on digital red‑packet covers while limiting offline promotional activities.

Business Characteristics

Highly unpredictable traffic peaks, often reaching billions of requests in a short window, creating sudden server load pressure.

Short, fast, and lightweight product lifecycle targeting rapid deployment for the holiday period.

Serverless + Cloud Development Solution

WeChat’s Cloud Function (Serverless) and Cloud Development platform were chosen to meet these requirements, offering:

No need to manage deployment, scaling, or resource provisioning; the platform scales automatically.

Seamless access to WeChat private network APIs without OAuth authentication, simplifying OpenID retrieval.

Built‑in monitoring via WeChat Developer Tools, providing real‑time metrics and alert bots.

Integrated security with private WeChat network links, eliminating certificate and key management.

Architecture Overview

The CGI layer for the red‑packet cover service is built on the Svrkit framework, with inter‑service communication via synchronous RPC. Cloud Functions handle the API gateway, while Cloud Development provides backend services, databases, and storage.

Project Benefits

1. Stable Handling of Billion‑Level Traffic

The Serverless solution enabled the system to process over 100 million cloud‑function invocations per day during the New Year peak, with total costs kept under a few thousand yuan.

2. Cost Reduction and Efficiency Gains

Compared with traditional pre‑provisioned servers, the pay‑as‑you‑go model reduced infrastructure expenses by at least 30 % and eliminated external traffic fees, as WeChat absorbs the public‑network traffic for mini‑program backends.

3. Accelerated Business Growth

The rapid development cycle (less than two weeks) allowed brands, KOLs, and IP owners to launch timely campaigns, leading to repeated viral success and increased user engagement during the festival.

Code Example: Cloud Function Invocation

The following snippet shows how to call the Red Packet Cover authentication API from a Cloud Function using the wx-server-sdk:

const cloud = require('wx-server-sdk');
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV });
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.redpacketcover.getAuthenticationUrl({
      "openid": "xxxxxxxxxxmTo5lAUQxxxxxxxxxx",
      "ctoken": "xxxxxqpHPu1xxxxx"
    });
    return result;
  } catch (err) {
    return err;
  }
};

This approach requires no manual token handling; WeChat automatically authenticates the request.

Other Use Cases

Beyond the New Year campaign, the same Serverless Cloud Development stack has supported projects such as Sichuan Tianfu Health Pass, Shenzhen Airport mini‑program, and the CCTV Mid‑Autumn Festival lottery.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ServerlessCost Optimizationscalable architectureCloud FunctionsWeChatcloud developmentred packet
Tencent Cloud Developer
Written by

Tencent Cloud Developer

Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.