New WeChat-Style IM Instant Messaging System Setup Guide: UniApp Frontend with JAVA Backend High-Concurrency Group Chat Source Code Deployment

Last year I did a custom development project for an overseas client who needed an instant messaging system. I hit quite a few roadblocks along the way. Today I am organizing the entire process to share with anyone looking for IM system source code. This system uses UniApp for the frontend and JAVA for the backend. The overall architecture is reasonably clean, and the deployment difficulty is moderate.

1. Core System Features and Technical Architecture

What impressed me most about this new WeChat-style IM system is the high UI fidelity. The frontend is built with UniApp, meaning one codebase runs on H5, mini-programs, and mobile apps, which saves a lot of effort. The backend is JAVA with full source code, supporting high-concurrency scenarios.

  1. Single Chat: Text, images, voice messages, stickers, file transfer, with real-time read/unread status sync
  2. Group Chat: Supports groups of up to 2000 members, group announcements, admins, muting, kicking, and @mentions
  3. Friend System: Add/remove friends, blacklist, friend notes, and group management
  4. Message Management: Message recall, pinning, search, and cloud-based chat history storage
  5. Admin Panel: User management, group management, sensitive word filtering, message auditing, and data statistics

The backend stack is primarily Spring Boot + MySQL + Redis + WebSocket. WebSocket handles real-time message push, Redis manages session caching and unread message counts, and MySQL stores user relationships and chat records.

2. Server Environment and Pre-Deployment Checklist

Before deploying this system, make sure you have the following environment ready. The first time I deployed it, I got the JDK version wrong and the service failed to start, which took me two hours to troubleshoot.

  • Server specs: At least 2 cores and 4GB RAM, recommend 4 cores and 8GB+ for high concurrency
  • OS: CentOS 7.6+ or Ubuntu 20.04+
  • JDK 1.8+ (must verify version compatibility)
  • MySQL 5.7+ (recommend 8.0 for better performance)
  • Redis 5.0+ (for session caching and message queues)
  • Nginx 1.18+ (reverse proxy and static assets)
  • SSL certificate (HTTPS is mandatory, WebSocket wss requires it)

Domain registration issues should be resolved early, especially for IM systems. If targeting overseas users, use an overseas server with CloudFlare. The database initialization script is in the /sql directory of the source code. Use utf8mb4 charset when importing, otherwise emojis will be garbled.

3. Source Code Deployment and Common Pitfalls

Deployment breaks into three parts: backend service, frontend compilation, and admin panel. Each step has pitfalls. Here are the ones that stuck with me.

3.1 Backend Service Fails to Start

The most common cause is forgetting to update the database connection info in the config file. The source code defaults to localhost. If your database is on a separate server, change the spring.datasource.url in application.yml. Also, if Redis has no password, leave the password field empty or remove it entirely, filling in null will actually cause an error.

3.2 WebSocket Connection Fails

This issue is caused by Nginx configuration in 90% of cases. WebSocket requires upgrade headers in Nginx:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Without these two lines, the frontend will keep reporting connection timeouts. Also check firewall ports: the default WebSocket port is 8088, make sure it is open.

3.3 High Message Sending Delay

If delays spike under load, it is likely due to insufficient Redis configuration. The default Redis connection pool has only 8 connections, which will block under high concurrency. I recommend changing it to 50-100, adjusting based on server memory. The MySQL connection pool should also be increased accordingly.

4. Admin Panel and Extension Features

The admin panel is built with VUE and is fairly comprehensive. The modules I use most are user management (view online status, ban accounts), group management (view group list, dissolve groups), and message auditing (sensitive word interception records).

For extensions, this system can integrate third-party push services (Jiguang, Firebase) and SMS verification. When I did the custom dev, I added voice calling using WebRTC. The integration difficulty is moderate, but latency control needs optimization.

Important Notice: IM systems should use end-to-end encryption (E2EE) for messages, and at minimum TLS 1.3 for transport layer. User privacy data must comply with GDPR or local regulations. Do not store chat content in plain text in backend logs.

5. FAQ

Q1: How many concurrent users can this system handle?

The official claim is 100,000 long connections per node. In practice, a 4-core 8GB server handled 50,000 online users with normal message sending and receiving. For higher concurrency, use multi-node deployment with Redis Cluster for message routing.

Q2: How long are message records kept?

Cloud storage is permanent by default, but I recommend implementing your own message archiving strategy. The chat record table grows very fast. Our client solution stores hot data from the last 3 months in MySQL, and archives historical data to MongoDB.

Q3: Can the UniApp frontend be compiled into a mobile app?

Yes, it supports both Android and iOS builds. Note that iOS App Store requires applying for push certificates, and Android needs to configure push channels for each manufacturer (Huawei, Xiaomi, OPPO, VIVO).

Q4: Does the source code support secondary development?

Yes, the JAVA backend has a clean structure with Controller-Service-DAO separation. The UniApp frontend is also well componentized, so changing UI styles is just a matter of adjusting CSS variables.

Q5: How much server bandwidth is needed?

Text-only messages consume very little bandwidth, 1Mbps can handle thousands of users. If sending lots of images and videos, use a CDN or object storage (OSS), and start with at least 10Mbps bandwidth.


Source Reference

This content is based on the demo system at yanshigw.top/18475.html, reorganized and rewritten for reference purposes.

#WeChatIMSystem #InstantMessagingSourceCode #SocialGroupChat #UniAppChat #HighConcurrencyCommunication