Skip to main content

MiniProgram Quick Start

Prerequisites​

Before you begin, ensure you have completed the following:

  1. Activate CloudBase Environment: Create Environment
  2. Development Tools: Download and install WeChat DevTools
  3. Mini Program Account: Register WeChat Mini Program to get your AppID

Sign in to the CloudBase console with an account associated with your mini program. To use an existing Tencent Cloud account, complete account binding first.

For more details, see: MiniProgram 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:

Read https://docs.cloudbase.net/skill.md and set up CloudBase for me.
Tell me when you're done, and suggest the most relevant next steps.

View skill.md →

Develop with Skills​

Tell the AI:

Use CloudBase Skills: Integrate CloudBase in MiniProgram, including database and cloud storage

Skills docs →

You can also install CloudBase Skills manually:

npx skills add tencentcloudbase/cloudbase-skills -y

Want the AI to think in mini-program terms? The WorkBuddy Expert Center has a CloudBase mini-program expert — requirement breakdown, page structure, and which cloud API to use, all the mini-program way. Open the expert →

Initialize SDK​

in app.js InitializeCloudBase:

NativeAPI Initialize​

mostCloudBasecapabilities canUse Mini ProgramNative API directlyCall,NoneneedInstall SDK,If NativeAPI Not supported pleaseUse Client SDK performCall

App({
onLaunch() {
wx.cloud.init({
env: "{%ENV_ID%}"
});
}
});

Client SDK Initialize​

Install

Use Client SDK before please firstInstall SDK

inMini Program package.json theinDirectory(usually miniprogram Directory)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");

App({
onLaunch() {
wx.cloud.init({
env: "{%ENV_ID%}"
});
this.globalData.cloudbase = init(wx.cloud);
},
globalData: {}
});