Skip to main content

UniApp Quick Start

Prerequisites

Before you begin, ensure you have completed the following:

  1. Activate CloudBase Environment: Create Environment
  2. Install Node.js: Download Node.js (LTS version recommended)

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

View skill.md →

Develop with Skills

Tell the AI:

Use CloudBase Skills: Integrate CloudBase Web SDK in a UniApp app, including authentication and database

Skills docs →

You can also install CloudBase Skills manually:

npx skills add tencentcloudbase/cloudbase-skills -y

Install SDK

@cloudbase/js-sdk Combine with @cloudbase/adapter-uni-app allows you toin uni-app project

npm

npm i @cloudbase/js-sdk @cloudbase/adapter-uni-app

yarn

yarn add @cloudbase/js-sdk @cloudbase/adapter-uni-app

pnpm

pnpm add @cloudbase/js-sdk @cloudbase/adapter-uni-app

Initialize SDK

Add the following code to your uni-app project

./utils/cloudbase.js

import cloudbaseSDK from "@cloudbase/js-sdk";
import adapter from "@cloudbase/adapter-uni-app";

// passed inConfigurationoption
const options = {
uni: uni // passed in uni object,for imageVerification codeFunction
};

cloudbaseSDK.useAdapters(adapter, options);

const cloudbase = cloudbaseSDK.init({
// Environment ID
env: "{%ENV_ID%}",
// region
region: "{%REGION%}",
// Anonymous access token
accessKey: "{%PUBLISHABLE_KEY%}"
});

export default cloudbase;