Skip to main content

Node.js Quick Start

Prerequisites​

Before you begin, ensure you have completed the following:

  1. Activate CloudBase Environment: Create Environment
  2. Get API Credentials: Get your environment ID and API key from CloudBase Console

For more details, see: Node.js 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 HTTP API in a Node.js backend service, including database and storage

Skills docs →

You can also install CloudBase Skills manually:

npx skills add tencentcloudbase/cloudbase-skills -y

Install SDK​

@cloudbase/node-sdk allows you toin Node.js serverUse JavaScript/TypeScript access CloudBase services and resources。

npm​

npm i @cloudbase/node-sdk dotenv

yarn​

yarn add @cloudbase/node-sdk dotenv

pnpm​

pnpm add @cloudbase/node-sdk dotenv

Initialize SDK​

Add the following code to your Node.js project

./utils/cloudbase.js​

const cloudbaseSDK = require("@cloudbase/node-sdk");
require("dotenv").config();

const cloudbase = cloudbaseSDK.init({
env: process.env.CLOUDBASE_ENV_ID,
secretId: process.env.CLOUDBASE_SECRETID,
secretKey: process.env.CLOUDBASE_SECRETKEY
});

module.exports = { cloudbase };

.env​

info

please go to Tencent Cloud Console/APIkey management GenerateAPIkey

Tencent Cloud Console/APIkey management

# Environment ID
CLOUDBASE_ENV_ID={%ENV_ID%}

# Tencent CloudAPIkeyID
CLOUDBASE_SECRET_ID={%SECRET_ID%}

# Tencent CloudAPIkeyKey
CLOUDBASE_SECRET_KEY={%SECRET_KEY%}