Overview
🌟 Having issues with CloudBase? Click here to consult Cloud Development Copilot, which is ready to answer your questions anytime. 📱 WeChat CloudBase users please log in via Mini Program Official Account.
CloudBase User Guide
I. Differences Between Mini Program CloudBase and Tencent Cloud CloudBase
1. CloudBase
CloudBase is a concept that describes all the capabilities of the entire ecosystem, detailing the abilities and functions from a platform perspective, as well as the product matrix.
Under the CloudBase concept, there are two instance products: WeChat CloudBase and Tencent Cloud CloudBase.
2. WeChat CloudBase
WeChat CloudBase (formerly Mini Program CloudBase) is jointly developed with the WeChat team, showcasing excellent cloud-native features in the WeChat ecosystem, such as cloud invocation, WeChat Pay, and obtaining information without authentication on the WeChat side, all of which are manifestations of WeChat's support.
The hallmark of WeChat CloudBase is that it is created under a Mini Program via the developer tools console. During creation, a Tencent Cloud account is registered as a WeChat Official Account (Mini Programs are a type of Official Account). Alternatively, you can choose to bind an existing Tencent Cloud account during creation, which avoids creating a new account.
Developers can access the Tencent Cloud official website console via WeChat authorization. In the Tencent Cloud CloudBase console, you can still operate the CloudBase environment.
Some new capabilities launched by CloudBase are visually reflected in the Tencent Cloud official website console. Certain capabilities (such as Cloud Function HTTP access service) require support and evaluation from the WeChat team before they can be reflected in the developer tools console.
So it's not that WeChat CloudBase lacks certain capabilities, but rather that they are not reflected in the console. Therefore, it can be concluded that WeChat CloudBase can still handle multi-end development such as WEB, and it excels even more in the WeChat ecosystem.
3. Tencent Cloud CloudBase
Tencent Cloud CloudBase is an independent instance product that can be created directly in the Tencent Cloud official website console without requiring a WeChat Mini Program, and it is also the environment where CloudBase capabilities are first applied.
Generally, when we say CloudBase supports certain capabilities, it primarily refers to "Tencent Cloud CloudBase" (the specific explicit support for Mini Program CloudBase still requires review and coordination with the WeChat team).
Tencent Cloud CloudBase also excels in multi-end support, with all current authentication-free integrations with other mini programs initiated from the Tencent Cloud CloudBase side. For example, the QQ Mini Program only supports Tencent Cloud CloudBase and does not support WeChat CloudBase.
So, when you do not rely heavily on the WeChat ecosystem and are developing multi-end applications, it is recommended to use Tencent Cloud CloudBase.
Currently, we are collaborating with multiple frameworks, and all CloudBase environments activated through these frameworks belong to Tencent Cloud CloudBase.
2. CloudBase SDK and Capabilities
1. WeChat CloudBase Developing WeChat Mini Programs
If you are using WeChat CloudBase to develop WeChat Mini Programs! It is recommended to use wx.cloud on the mini-program side and wx-server-sdk on the cloud function side. The documentation is all in the WeChat Official Documentation
2. Tencent Cloud CloudBase Developing WeChat Mini Programs
If you want to use Tencent Cloud CloudBase to develop WeChat Mini Programs, there are two optional methods:
- Your Tencent Cloud CloudBase environment belongs to a Tencent Cloud account bound to the target mini program. You can directly switch environments in the Tencent Cloud console. For details, see the documentation. After switching, you can use the environment directly in the mini program via wx.cloud, but you cannot manage it in the CloudBase console of the mini program developer tools.
- If your Tencent Cloud CloudBase environment's Tencent Cloud account is not bound to the target mini program, it is recommended to use the following approach: On the mini program side, use the JS-SDK. This SDK has built-in WeChat Mini Program adapter support and can be used directly. You need to configure the mobile security source (the application identifier should be filled with the mini program appid). The usage code is as follows:
Not using the WeChat-side SDK means you forgo the authentication-free support provided by WeChat and need to set up your own openid system. Unless you are developing multi-end applications, it is not recommended to do so.
In cloud functions, use the Node-SDK directly without adding key or secret information.
3. Tencent Cloud CloudBase Developing QQ Mini Programs
On the mini-program side, use qq.cloud, which provides an experience consistent with WeChat Mini Programs.
In cloud functions, use the qq-server-sdk, which provides an experience consistent with WeChat. For specific differences, refer to the documentation.
When developing QQ Mini Programs, there is a binding process for a Tencent Cloud account, which in this context refers to binding the Tencent Cloud CloudBase environment. Even if your bound Tencent Cloud account contains a WeChat CloudBase environment, it does not support QQ Mini Program development.
That is to say, QQ Mini Programs only support the Tencent Cloud CloudBase environment.
4. WeChat CloudBase Developing Official Account Web Pages
WeChat CloudBase can utilize the environment sharing capability to share environments with official accounts. Specifically, this enables native login on official account web pages and allows cloud functions to call official account server capabilities without authentication.
For details on environment sharing, refer to the official documentation. The official sample for official account web page login is here. You also need to write the cloud function cloudbase_auth.
There is a simple DEMO to help you get started quickly. The DEMO includes a pre-packaged login module that can be modified and used according to your needs.
Mini Program CloudBase natively supports only official accounts with webpage authorization capability. Currently, only verified service accounts are supported; other types of official accounts are not supported at present, and sharing the environment doesn't have much practical use.
Additionally, for non-personal entities, Mini Program CloudBase static website hosting can directly open any mini program without config. For specific implementation details, refer to the official example.
Finally, WeChat CloudBase can be used for official accounts to receive messages, passively reply to messages, and send template messages. For specific usage, refer to the WeChat Official Documentation.
If you want to implement official account messaging and template sending capabilities yourself, refer to the CloudBase Official Account Sample DEMO.
5. All CloudBase Development for Regular WEB and APP Applications
Whether it is Tencent Cloud CloudBase or WeChat CloudBase, both support the development of Regular WEB and other applications.
For WEB development or JS-based application development, you can basically use the JS-SDK. For specific language and framework requirements, you can directly build your own solution using the http api.
On the cloud function side, you can primarily use the Node-SDK. For more advanced requirements such as batch management, utilize the manage-sdk. If specific needs remain unmet, please send requests directly to Cloudbase@tencent.com for prompt evaluation.
We welcome contributions to the SDK. If you have an SDK contribution, please send the github repository link and relevant description to Cloudbase@tencent.com. After review, we will include it and enroll you in the Evangelist Program to convert into points.
3. CloudBase Billing Instructions
In the Mini Program console, you will see two types of billing: Tencent Cloud billing and WeChat-side billing. Tencent Cloud billing is further divided into subscription (prepaid) and pay-as-you-go models.
Here, Tencent Cloud billing refers to the deduction from the Tencent Cloud account balance after authorized login to the Tencent Cloud official website via WeChat. WeChat-side billing, however, is done through WeChat Pay QR code scanning.
Additionally, pay-as-you-go billing must be through Tencent Cloud billing. Although each Mini Program has two free quotas, if the quota is exceeded, you need to recharge on the Tencent Cloud official website to ensure sufficient balance; otherwise, service may be suspended.
You can use the balance of your primary Tencent Cloud account by binding your WeChat Official Account Platform (Mini Program-side Tencent Cloud account) to it in the personal information section.
4. Regarding CloudBase Related Issues
(1) Can cloud invocation be used in any WeChat CloudBase environment?
To use cloud invocation in WeChat Cloud Functions, three usage conditions must be met:
- Cloud functions in the WeChat CloudBase environment or the converted Tencent Cloud CloudBase environment
- Cloud functions must use wx-server-sdk (other options are not supported)
- Some cloud invocation APIs must be invoked by real users (e.g., Mini Program codes).
To use cloud invocation in WeChat CloudRun, only one usage condition must be met:
- The WeChat CloudRun environment belongs to or is shared with the target Mini Program.
Strictly speaking, cloud invocation in CloudRun provides a token for server-side calls that requires no developer management. Therefore, developers can directly call server-side interfaces or use the officially provided encapsulated services from CloudRun.
(2) Cloud Run brand upgraded to Weixin Cloud Run: Differences and connections with CloudBase
Beyond the brand upgrade from WeChat CloudBase's cloud hosting to WeChat CloudRun, an independent console was introduced. The original container engine evolved into a comprehensive backend project hosting solution, offering end-to-end, low-cost, enterprise-grade cloud-native capabilities—from code management to CI/CD pipeline deployment. This delivers more powerful features and a more user-friendly experience.
To summarize, both WeChat CloudBase and WeChat CloudRun are integral components of the WeChat Cloud services ecosystem co-developed by WeChat and Tencent Cloud. Both offer serverless and no-Ops capabilities. CloudBase primarily targets full-stack development scenarios with integrated frontend-backend architectures, making it ideal for individual developers. CloudRun is designed for decoupled architectures, supporting any language or framework, and offers greater suitability for team collaboration and enterprise-grade applications. The two services can also be used in combination.
Here are some DEMO starter sample projects for learning purposes:
(3) Are there any examples of WeChat Pay integration in Mini Program CloudBase?
Please refer to the WeChat Pay demonstration DEMO
CloudBase also offers a Profit Sharing Service. If required, you may submit an application.
V. Release Notes
- Updated on: July 7, 2021
- Update description: Will be updated periodically based on the development of CloudBase.
- If you still cannot find a solution after reviewing the above content, we recommend posting your question in the community.
- Related to Tencent CloudBase: Tencent Rabbit Nest (This is the first choice for CloudBase capabilities.)
- Related to WeChat CloudBase: WeChat Open Community (All WeChat-related questions can be asked here)
- Related to WeChat CloudRun: WeChat Open Community (All CloudRun-related questions can be asked here)
- Follow the "Tencent CloudBase" official account, reply with the keyword "join group" to access official communication groups for various product capabilities.