MiniGame (Native API) Quick Start
Prerequisites
Before you begin, ensure you have completed the following:
- Activate CloudBase Environment: Create Environment
- Development Tools: Download and install WeChat DevTools
- Mini Program Account: Register WeChat Mini Program to get your AppID
For more details, see: MiniGame (Native API) Full Documentation
Install the CloudBase AI Plugin
Optional: If you develop with an AI coding assistant (such as Cursor, Claude Code, CodeBuddy, etc.), we recommend completing this step so the AI has CloudBase development capabilities.
Copy the AI prompt into your AI IDE
Enter the following in your AI chat:
Help me get set up with CloudBase. Do the following:
1. Open https://docs.cloudbase.net/skill.md and follow the instructions.
2. When done, tell me you're ready and suggest the most relevant next steps.
Develop with Skills
Tell the AI:
Use CloudBase Skills: Integrate cloud development in MiniGame (Native API), including database and cloud storage
You can also install CloudBase Skills manually:
npx skills add tencentcloudbase/cloudbase-skills -y
Initialize SDK
in game.js InitializeCloudBase:
NativeAPI Initialize
mostCloudBasecapabilities canUse Mini GameNative API directlyCall,NoneneedInstall SDK,If NativeAPI Not supported pleaseUse Client SDK performCall
wx.cloud.init({
env: "{%ENV_ID%}"
});
Client SDK Initialize
Install
Use Client SDK before please firstInstall SDK
inMini Game package.json theinDirectory(usuallygamerootDirectory)execute:
npm i @cloudbase/wx-cloud-client-sdk --save
InstallDoneafter,inWeChatClick in developer tools tool → Build npm。
Initialize
const { init } = require("@cloudbase/wx-cloud-client-sdk");
wx.cloud.init({
env: "{%ENV_ID%}"
});
const cloudbase = init(wx.cloud);