Node.js Quick Start
- AI Quick Start
- Full Developer Guide
Prerequisites
Before you begin, ensure you have completed the following:
- Activate CloudBase Environment: Create Environment
- Get API Credentials: Get your environment ID and API key from CloudBase Console
Client
Configure your AI tool to connect with CloudBase capabilities. Supports local and hosted connection. See connection modes.
Step 1: Install / Configure CloudBase
Step 2: Chat with AI
Enter the following in your AI chat in order:
prompt
Install CloudBase Skills: run npx skills add tencentcloudbase/cloudbase-skills -yUse CloudBase Skills: Use CloudBase Skills: Integrate CloudBase in a Node.js backend service, including database and storagePrerequisites
Before you begin, ensure you have completed the following:
- Activate CloudBase Environment: Create Environment
- Get API Credentials: Get your environment ID and API key from CloudBase Console
For more details, see: Node.js Full Documentation
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
# Environment ID
CLOUDBASE_ENV_ID={%ENV_ID%}
# Tencent CloudAPIkeyID
CLOUDBASE_SECRET_ID={%SECRET_ID%}
# Tencent CloudAPIkeyKey
CLOUDBASE_SECRET_KEY={%SECRET_KEY%}