Game Development 8 min read

Solving Mini‑Game Server Dependency with Cloud Development: A Case Study of "LeXiang Garden"

By adopting Tencent Cloud Serverless functions, the developers of the mini‑game “LeXiang Garden” eliminated the need for a dedicated backend, directly accessed WeChat authentication, stored tokens, and implemented global leaderboards with just two cloud functions, dramatically lowering the barrier to mini‑game creation.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
Solving Mini‑Game Server Dependency with Cloud Development: A Case Study of "LeXiang Garden"

I am Dai Chang‑Xin from Shanghai Xiangwu Talk, responsible for game client development.

Xiangwu Talk is a community platform where users can give each other items for free. To increase interaction, we launched a mini‑game called "LeXiang Garden". The whole client was completed in just three days.

The main pain point was the heavy reliance on a backend server. Initially, tasks such as planting, watering, and collecting water droplets were implemented using browser cache, which meant that if the server was not ready, player progress would be lost after clearing the phone cache. Moreover, many WeChat APIs (login, user avatar, access_token, content moderation, etc.) can only be called from a server, forcing us to build a middle‑layer.

We identified two major server dependencies for mini‑games:

1. WeChat interfaces must be invoked from a server. Without a middle‑layer, we cannot perform user login, fetch avatar or openid, or call content‑review APIs.

2. Game features (e.g., saving level progress, global leaderboards) require server‑side logic.

To break this dependency we adopted cloud development (Tencent Cloud Serverless). Cloud functions provide native WeChat authentication, allowing us to obtain openid and unionid directly, and to refresh access_token via timed triggers. The token, valid for two hours, is stored in the cloud database and refreshed automatically, ensuring it never expires.

With cloud development we eliminated the need for a dedicated server for WeChat API proxying. The backend and WeChat interfaces are completely decoupled, regardless of whether the client runs as an H5 game or a WeChat mini‑program.

We also used cloud functions together with the cloud database to implement a global leaderboard. The first function fetches up to 100 entries from the database (the limit is sufficient for our needs) and returns the ranking. Adding an index on the query fields dramatically improves performance.

The second function reports player data; it consists of a single line of code (shown in the original article as an image).

In total, only two cloud functions were required to replace all server‑side functionality for the game.

Beyond this case, cloud development can be used for many scenarios such as bypassing WeChat HTTPS domain restrictions, storing global game settings, persisting personalized player data, and more. Future extensions may include WebSocket‑based chat, frame‑synchronised real‑time battles, log services for analytics, and large‑scale data analysis.

By leveraging cloud development, the barrier to mini‑game creation is dramatically lowered.

serverlessdatabaseCloud FunctionsWeChatcloud developmentleaderboardmini-game
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

login 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.