Mini Program Quick Start
Through this guide, you will learn how to use cloud development in mini programs, including core features such as databases, cloud storage, and cloud functions.
Preparation
Before you begin, ensure that you have completed the following preparations:
- Enable Cloud Development Environment: [Enable Cloud Development Environment](/quick-start/create-env#Method 1: WeChat Developer Tools (Recommended for Mini Program Developers))
- Development Tools: Download and install the WeChat Developer Tools
- Mini Program Account: Register for WeChat Mini Program, obtain the AppID for the Mini Program
Step 1: Create a Mini Program project
Open the WeChat Developer Tools and log in using WeChat scan.
Create a new Mini Program project:
- Enter your Mini Program AppID
- Select the project storage directory
- Select "WeChat CloudBase" for the backend service
- Check "Agree to the CloudBase Service Terms"
⚠️ Note: The backend service must select "WeChat CloudBase" to use the cloud development feature.
- Select a template: It is recommended to choose the "CloudBase Basic Template"
Step 3: Initialize the CloudBase Environment
Initialize CloudBase in app.js:
// app.js
App({
onLaunch() {
// Initialize CloudBase
if (!wx.cloud) {
console.error('Please use base library version 2.2.3 or later to utilize cloud capabilities');
} else {
wx.cloud.init({
env: env: 'your-env-id', // Replace with your environment ID
traceUser: true,
});
}
}
});
💡 Note: Replace
your-env-idwith your actual environment ID
Step 3: Experience CloudBase Features
After creating the project, you can experience the following features:
- Database: Click the 'Database' button to experience CRUD operations.
- Cloud Storage: Click the 'Storage' button to experience file upload and download
- Cloud Functions: Click the 'Cloud Functions' button to experience server-side logic invocation
Advanced Guides
- Database Operations
- Cloud Storage Management
- Cloud Function Development
- WeChat Mini Program Official Documentation