Skip to main content

A Step-by-Step Guide to Building a 6-Platform Anonymous Social App with AI in 2 Days

CloudBase TeamCloudBase Team
8 min read

๐Ÿ’ก Project Introductionโ€‹

Recently, I completed an interesting hands-on project and would like to share the development process and key takeaways with everyone.

Project Overview:

  • โฐ Development time: Core features completed in 2 days
  • ๐Ÿ“ฑ Supported platforms: Runs on 6 platforms (iOS, Android, Web, WeChat/Douyin/Alipay Mini Programs)
  • ๐ŸŽฏ Core features: Phone-verification login + random matching + real-time chat
  • ๐Ÿ”ฅ Tech stack: AI IDE + CloudBase AI ToolKit + uni-app

Project name: SoulChat[1] - An anonymous chat application based on random matching

๐ŸŽฌ Demoโ€‹

Real-time multi-platform matching + chat demo:

๐Ÿ“ฑ Cross-platform matching on Mini Programsโ€‹

A step-by-step guide to building a 6-platform anonymous social app with AI in 2 days!

A step-by-step guide to building a 6-platform anonymous social app with AI in 2 days!

Alipay Mini Program โ†”๏ธ Douyin Mini Program real-time matching chat

๐ŸŒ Cross-platform communication on Webโ€‹

A step-by-step guide to building a 6-platform anonymous social app with AI in 2 days!

A step-by-step guide to building a 6-platform anonymous social app with AI in 2 days!

H5 โ†”๏ธ WeChat Mini Program seamless conversation

๐Ÿ“ฒ Native App interoperabilityโ€‹

A step-by-step guide to building a 6-platform anonymous social app with AI in 2 days!

A step-by-step guide to building a 6-platform anonymous social app with AI in 2 days!

Android โ†”๏ธ iOS cross-platform chat

One codebase, six platforms!โœจ


๐Ÿ› ๏ธ Technical Architectureโ€‹

Technical architecture diagram

๐ŸŽฏ Tech Stack Selectionโ€‹

The tech stack used in the SoulChat project:

Technical componentRole in the projectReason for choice
CloudBaseBackend cloud serviceProvides cloud database, cloud functions, real-time database and other services
CloudBase-uniapp template[2]Cross-platform frontend dev templateCompiles to 6 platforms, reducing duplicate development
CloudBase-AI-ToolKit[3]Development aid toolBuilt-in cloud development best-practice rules, automatically creates database collections and deploys cloud functions
CloudBase-AI-ToolKit

Architecture highlights:

  • ๐Ÿ”„ All-in-one cloud: Frontend and backend share one unified CloudBase platform
  • โšก Real-time communication: Message sync built on the CloudBase real-time database
  • ๐Ÿš€ Automated deployment: AI assists with resource creation and code deployment

๐Ÿš€ Hands-on Development Guideโ€‹

Step 1: Environment Preparationโ€‹

1๏ธโƒฃ Download the project template

Type this directly into the Cursor dialog:

Download a UniApp cross-platform app + cloud development setup into the current directory

This automatically downloads the official uni-app template provided by CloudBase AI ToolKit. The template ships with CloudBase best-practice rules and CloudBase MCP configuration.

2๏ธโƒฃ CloudBase environment setup

Before development starts, we first need to sign in to the cloud development environment.

Enter "login to cloud development" in the AI dialog. On your first login, the browser will pop up the authorization page for the cloud development platform.

Login to cloud development

Login screen

After authorization, the available cloud development environments are shown, and we simply select the one we need.

Environment selection

๐Ÿ’ก Tip: A range of AI IDEs are supported, including Cursor, CodeBuddy, and others

3๏ธโƒฃ Multi-platform domain configuration

Refer to the multi-platform secure domain configuration doc[4] to configure secure domains for each platform.


Step 2: Requirements Analysis and Designโ€‹

An AI-assisted, structured development workflow:

Comparison diagram

๐Ÿ“‹ Three phases of the development workflow:

Step 1: Clarify Requirementsโ€‹

Turn the initial idea into concrete feature requirements:

Based on the current CloudBase-UniApp template, develop an anonymous chat social app called SoulChat. Feature requirements:

  1. Provide phone-number + verification-code login
  2. When the user taps the match button, the system begins looking for other online users who are also matching
  3. After a successful match, the user can have real-time text chat with the other party, with instant send/receive on both sides
  4. The chat ends when either party leaves the room

The AI automatically generates detailed user stories and acceptance criteria:

Requirement generation

Step 2: System Designโ€‹

Based on the requirements doc, the AI helps with:

  • ๐Ÿ—๏ธ Overall technical architecture design
  • ๐Ÿ—„๏ธ Database schema planning
  • ๐Ÿ”Œ API definition and design
  • โ˜๏ธ Cloud function module division

For example, in a real-time chat system the AI generates the room management functions and the design of the chat message tables, and so on.

Room management functionChat message table

โš ๏ธ Note: During development I noticed that when the AI iteratively generates code, it can sometimes drift away from the original design doc. In that case, ask it explicitly to correct itself and strictly follow the system design.

Step 3: Task Planningโ€‹

Generate a detailed development task list with dependencies:

Task list


Step 3: Frontend UI Developmentโ€‹

๐Ÿ“ฑ Page feature implementation

Rapidly generate page code with AI assistance:

Based on the requirements doc and the base architecture design, generate the frontend page code for the SoulChat app. The pages should include the following feature modules:

  1. Home page: shows the app intro and the phone-number + verification-code login feature.
  2. Matching page: shows currently online users, match progress, and the start-matching button.
  3. Chat room page: displays chat messages, input box, send button, and message states (sending, sent, failed).
  4. UI style: a clean, clear design style.

Please ensure modular, maintainable components, and design the pages to work across multiple platforms with an optimized responsive layout.

Page implementation result:

Chat page

The interface uses a modern design style with a smooth, natural interaction experience.


Step 4: Backend Service Developmentโ€‹

๐Ÿ—„๏ธ Database Schema Designโ€‹

Based on business needs, four core data collections were designed:

Collection namePurposeMain fields
usersBasic user infouid, nickname, status, etc.
match_queueMatch queue managementuserInfo, status, createTime, etc.
chat_roomsChat room inforoomId, participants, status, etc.
messagesMessage record storageroomId, senderId, content, etc.
Database creation

โš ๏ธ Configuration point: Proper read/write permissions need to be set for the database collections so that the real-time listener feature works correctly.

โ˜๏ธ Cloud Function Implementationโ€‹

Core business modules:

  • userMatch - Handles the user matching logic
  • messageManager - Manages message send and receive

Cloud function deployment

With AI tooling, writing and deploying cloud functions is quick:

Deployment successful


๐Ÿ’ช Core Highlightsโ€‹

๐Ÿ”ฅ Real-time Communication Architectureโ€‹

```js
// Use the CloudBase real-time database to watch for other users waiting to be matched
const waitingUsers = await db.collection('match_queue')
.where({
uid: _.neq(uid),
status: 'waiting',
createTime: _.gte(new Date(Date.now() - 30000)) // Queue records within the last 30 seconds
})
.orderBy('createTime', 'asc')
.limit(1)
.get()
### ๐ŸŒ uni-app Adaptation Approach

```js
```js
import cloudbase from '@cloudbase/js-sdk'
import adapter from '@cloudbase/adapter-uni-app'

// Use the UniApp adapter
cloudbase.useAdapters(adapter,{uni: uni});

// Unified CloudBase initialization
const app = cloudbase.init({
env: 'your-env-id'
})
### ๐Ÿ’ฌ Message Listener Handling

```js
```js
try {
const db = app.database()

messageWatcher = db.collection('messages')
.where({
roomId: roomId
})
.orderBy('sendTime', 'asc')
.watch({
onChange: (snapshot: any) => {
//processing logic
}
}
},
onError: (error) => {
console.error('Message listener failed:', error)
}
})
} catch (error) {
console.error('Failed to start message listener:', error)
}
* * *

## ๐Ÿ“Š Results Showcase

### โšก Development Efficiency Comparison

Metric| Traditional development| AI-assisted development
---|---|---
**Development time**| 1-2 weeks| 2 days
**Code quality**| Hand-written| AI-generated + optimized
**Deployment efficiency**| Manual configuration| One-click deployment

### ๐Ÿ† Product Highlights

* **Anonymous social:** Phone-verification login, auto-matching a chat partner
* **Cross-platform interoperability:** Web, Mini Programs, and native apps communicate without barriers
* **Real-time experience:** Messages sync instantly, no refresh needed

* * *

## ๐ŸŽ‰ Summary and Outlook

### ๐Ÿ’ก Core Takeaways

Through this **SoulChat** project, I deeply experienced the power of **CloudBase + AI**:

1. **๐ŸŽฏ Automated requirements analysis** - Fuzzy ideas instantly become clear requirements
2. **๐Ÿ—๏ธ Intelligent architecture design** - Automatically generates best-practice solutions
3. **โšก Visualized development process** - Task breakdown and progress tracking
4. **โ˜๏ธ Integrated deployment and operations** - Cloud resources configured automatically

### ๐Ÿ’ฌ A Final Word

**AI is not here to replace developers, but to let us focus on creativity and business logic!**

Hand the repetitive work to tools, and keep the creative work for humans. That is the right way for developers to work in the AI era!

* * *

_Finally, thanks for watching โ€” see you next time!_ ๐Ÿ‘‹

References[1]

SoulChat: _https://github.com/yulinlin2020/soulchat_

[2]

CloudBase-uniapp template: _https://github.com/TencentCloudBase/awesome-cloudbase-examples_

[3]

CloudBase-AI-ToolKit: _https://github.com/TencentCloudBase/CloudBase-AI-ToolKit_

[4]

Multi-platform secure domain configuration doc: _https://github.com/TencentCloudBase/awesome-cloudbase-examples/blob/master/universal/cloudbase-uniapp-template/README.md_

Build your next app on CloudBase

An all-in-one backend covering database, cloud functions, static hosting, and AI capabilities.