Add Authentication to a UniApp Project with CloudBase
Use @cloudbase/adapter-uni-app in a UniApp project to integrate CloudBase Auth. One codebase runs across H5, WeChat Mini Program, Alipay Mini Program, Douyin Mini Program, iOS, and Android with shared login state.
Add Authentication to a Web React Project with CloudBase SDK
Use @cloudbase/js-sdk in a Vite + React 18 project to integrate CloudBase Authentication. Covers SMS Verification Code, email verification code, and WeChat QR Login, with persistent login state and a Route Guard.
Add CloudBase AI (DeepSeek / Hunyuan) to a WeChat Mini Program
Use wx.cloud.extend.AI to call DeepSeek / Hunyuan and other CloudBase platform models directly from a Mini Program frontend, consume textStream with for-await for streaming output, no self-hosted LLM gateway required.
Add CloudBase AI (DeepSeek / Hunyuan) to Next.js
Use @cloudbase/node-sdk in a Next.js Route Handler to call CloudBase AI streamText, convert AsyncIterable to ReadableStream for the frontend, and consume the streaming response in a Client Component with fetch + getReader.
Add CloudBase Authentication to Next.js
Use @cloudbase/js-sdk in a Next.js 14+ App Router project to integrate anonymous/SMS/WeChat QR Login, store login state in cookies, read identity in Server Components via cookies(), and intercept unauthenticated requests with middleware.
Add CloudBase Authentication to WeChat Mini Programs
Use @cloudbase/js-sdk@2.27.3 + @cloudbase/adapter-wx_mp@1.3.1 to let a WeChat Mini Program log in to a standalone CloudBase Environment using a ticket issued by a Cloud Function.
Build RAG with CloudBase PostgreSQL + pgvector
Enable the pgvector extension on CloudBase PostgreSQL, write a pair of ingest / retrieve Cloud Functions, and run the complete RAG pipeline: document chunking → embeddings → vector search → prompt assembly → LLM answer.
Call a CloudBase Cloud Function in WeChat Mini Program
Use wx.cloud.callFunction to call a Cloud Function directly from a Mini Program. The Cloud Function side uses wx-server-sdk to automatically obtain the OPENID — no auth token required, BaaS-style calls.
Deploy a Mastra TypeScript Agent to CloudBase Run
Write an agent and tools with Mastra 1.x, use mastra build to produce a Hono server, write a multi-stage Dockerfile, and deploy to CloudBase Run with tcb cloudrun deploy — including OpenAI key injection and CloudBase database tool integration.
Deploy a Next.js 14+ App Router Application to CloudBase Run
Use standalone output + a multi-stage Dockerfile + tcb cloudrun deploy to deploy a Next.js application to CloudBase Run in one shot, with SSR, streaming, custom domains, and environment variables.
Deploy a React SPA to CloudBase Hosting
Run vite build to generate dist, upload to CloudBase static website Hosting via tcb hosting deploy, get automatic CDN acceleration + HTTPS; configure index.html as the error page fallback in the Console to resolve React Router refresh 404s.
Deploy a Vue SPA to CloudBase Hosting
Run vite build to generate dist, upload to CloudBase static website Hosting via tcb hosting deploy, get automatic CDN acceleration + HTTPS; configure index.html as the error page fallback for Vue Router history mode.
Deploy an MCP Server to CloudBase Run
Write an MCP Server with @modelcontextprotocol/sdk + Hono that supports Streamable HTTP transport, package it with a multi-stage Dockerfile, deploy it to CloudBase Run via tcb cloudrun deploy, and connect Cursor / Claude Code / Windsurf directly via URL.
File Upload in WeChat Mini Program with CloudBase Cloud Storage
Use wx.chooseMedia to select media, upload to Cloud Storage via @cloudbase/js-sdk's uploadFile, store the fileID in the database, and render with getTempFileURL. Covers cloudPath naming, Temporary URL caching, and Security Rules.
Fix Common CloudBase Authentication Errors in WeChat Mini Programs
The 10 most common errors when integrating CloudBase Custom Login in WeChat Mini Programs: symptoms, root causes, and fixes with code.
Layered Secrets and Environment Variable Management for Cloud Functions / CloudBase Run
Separate dev / staging / prod configurations across three environments: local .env isolation, CloudBase CLI ci-token for CI pipelines, and Console environment variables for production — keeping API keys out of git, frontend bundles, and commit history.
Migrate from WeChat-native Cloud Development to Standalone CloudBase
Progressively replace wx.cloud calls in a WeChat Mini Program with @cloudbase/js-sdk, switching to a standalone CloudBase Environment for multi-platform reuse.
Multi-tenant Isolation with CloudBase Database Security Rules
Using a tenantId + role three-tier model and cross-collection verification via get('database.users.openid'), implement multi-tenant read/write isolation in Database Security Rules, with a Cloud Function fallback for defense-in-depth.
Optimize CloudBase Cloud Database Query Performance
From Slow Query identification to adding Indexes, avoiding Full Collection Scans, using Aggregation Pipelines instead of multiple queries, field projection, and cursor Pagination — each step explained with its underlying mechanism and applicable limits, without fabricated benchmark numbers.
Optimize Cold Start Performance for WeChat Mini Program Cloud Functions
Four actionable techniques to reduce CloudBase Cloud Function cold start latency: move initialization out of the handler, trim dependencies, tune memory, and enable Per-instance Concurrency. Full code included.
Parameterized Sharing and Conversion Funnel in WeChat Mini Program
Use onShareAppMessage / onShareTimeline to embed inviter and other parameters in share links, store incoming data to CloudBase Database on the receiving end, and generate parameterized wxacode posters via Cloud Functions.
Proxy Deepgram Speech-to-Text via CloudBase Cloud Function
Use @deepgram/sdk in a CloudBase Cloud Function to call nova-3, transcribe audio from Cloud Storage with timestamps and speaker diarization, and write results back to the database.
Proxy fal.ai FLUX Image Generation via CloudBase Cloud Function
Call fal.ai's FLUX model from a CloudBase Cloud Function using @fal-ai/client, save the generated image to Cloud Storage, and return a temporary URL to the frontend.
Proxy Overseas LLM APIs (OpenAI / Anthropic) via Cloud Function
Build a thin reverse proxy in a CloudBase Web Cloud Function (HTTP trigger) to handle overseas LLM access, keep API keys out of the frontend, and pass through SSE streaming responses.
Proxy Tavily AI Search via CloudBase Cloud Function
Use @tavily/core in a CloudBase Cloud Function to call the Tavily Search API, wrap real-time web retrieval for LLM agents into an HTTP-triggered function, and let frontends / Mini Programs call it directly without exposing the API key.
Pull Cloud Function Logs with manager-node and Alert Failures to WeCom
Run a monitoring Cloud Function on a cron schedule. Use @cloudbase/manager-node's getFunctionLogsV2 to pull Cloud Function logs from the past 5 minutes, treat RetCode 500 as errors, and send alerts to a WeCom Group Bot with threshold checks and deduplication.
Read and Write CloudBase Database in Next.js Server Components
Use @cloudbase/node-sdk to directly await the database in a Next.js App Router Server Component, write data via Server Action, refresh the cache with revalidatePath, and let Client Components receive results through Server Actions.
Read and Write CloudBase Database in WeChat Mini Program
After login, use the db API from @cloudbase/js-sdk to perform collection CRUD, conditional queries, and real-time watch subscriptions in a WeChat Mini Program frontend, including Permission Mode selection and unsubscribe considerations.
Realtime Notifications with CloudBase Database watch
In a WeChat Mini Program with authentication already integrated, use db.collection().watch() to push order status updates, message alerts, and online presence sync. Covers the initial snapshot, docChanges increments, connection management, and when to call close().
Run Cron Jobs with CloudBase Cloud Function Timer Triggers
Configure a timer trigger in cloudbaserc.json to run daily reports, data cleanup, and cache warming. Covers the 7-field cron format, idempotency for duplicate-run prevention, and failure alerts via WeCom webhook.
Send Transactional Email via Resend in a Cloud Function
Use the Resend Node SDK inside a CloudBase Web Cloud Function (HTTP trigger) to send transactional emails — registration confirmation, password reset, billing alerts, agent notifications — with SPF/DKIM managed automatically by Resend, a custom sender domain, and optional React Email templates.
Send WeChat Mini Program Subscribe Messages via Cloud Function
The Mini Program frontend obtains user authorization via wx.requestSubscribeMessage, the server uses cloud.openapi.subscribeMessage.send to deliver messages, covering differences between one-time and long-term subscriptions and handling of 43101/47003 errors.
Send WeCom Group Bot Messages with a CloudBase Cloud Function
Use a CloudBase Cloud Function to push text, Markdown, images, and other message types to a WeCom Group Bot via Webhook. Add a timer trigger for monitoring alerts.
Streaming Chatbot on CloudBase: Three Implementation Paths
Use the official cloudbase-agent-ui component, hand-written SSE + Cloud Function, or Vercel AI SDK to build a streaming chat interface on CloudBase — pick the path that fits your team, frontend, and complexity.
Upgrade a batch-2 Chatbot to Vercel AI SDK 6
Use @ai-sdk/codemod to auto-migrate 4.x → 6.x, verify streamText / useChat compatibility, and rewrite with ToolLoopAgent + tool approval for a cleaner implementation.