@QingQ77: A high-performance IM backend written in Rust, using QUIC protocol for real-time messaging, supporting P2P hole punching and group chat broadcasting. https://github.com/nicolastinger/only-talk-rs… Built with Actix-web for RESTful …
Summary
A high-performance instant messaging backend based on Rust + Actix-web + QUIC, supporting P2P hole punching, group chat broadcasting, multiple storage backends, can be deployed as a single process or separately.
View Cached Full Text
Cached at: 06/22/26, 07:40 AM
High-performance IM backend written in Rust, using QUIC protocol for real-time messaging, supporting P2P hole punching and group chat broadcasting. https://github.com/nicolastinger/only-talk-rs… Uses Actix-web for RESTful API and QUIC protocol for real-time message push. Supports P2P NAT hole punching (UDP 9562-9565), with automatic fallback to server relay if hole punching fails. File storage supports local, MinIO, Alibaba Cloud OSS, AWS S3; images are automatically compressed to WebP on upload. Backend uses PostgreSQL + Redis + rbatis ORM, authentication via JWT + Argon2 password hashing. Can run QUIC + HTTP in a single process, or deploy separately, suitable for various scales from small to large. — # nicolastinger/only-talk-rs Source: https://github.com/nicolastinger/only-talk-rs # OnlyTalk RS > High-performance instant messaging server — Rust + Actix-web + QUIC + PostgreSQL + Redis Chinese Version ## Project Overview OnlyTalk RS is a high-performance instant messaging (IM) backend server built with Rust, using Actix-web for RESTful API, QUIC protocol for real-time message transmission, and supporting advanced IM features such as P2P hole punching, NAT traversal, and group chat broadcasting. ## Technology Stack | Component | Technology | Description | |———–|————|———––| | Web Framework | Actix-web 4.9 | HTTP/HTTPS API service | | Protocol | QUIC (quinn 0.10) | Real-time message transport, P2P connections | | Database | PostgreSQL + rbatis 4.6 | ORM data persistence | | Cache | Redis + deadpool-redis | Connection pool, session management | | Object Storage | AWS S3 SDK | Supports MinIO / Alibaba Cloud OSS / AWS S3 | | Authentication | JWT (jsonwebtoken 8.0) | User identity verification | | Logging | tracing + tracing-subscriber | Structured logging, JSON output | | Encryption | rustls 0.21 + rcgen | TLS certificate management | | Rust Edition | 2024 | Latest language features | ## Workspace Structure only-talk-rs/ ├── src/main.rs # Standalone mode entry (starts QUIC + HTTP simultaneously) ├── crates/ │ ├── api/ # API service layer (integrates HTTP + QUIC routes) │ ├── common/ # Common utilities: configuration management, JWT, RSA encryption, QUIC config, tracing │ ├── entity/ # Data models and database operations (rbatis), DDL scripts │ ├── email_service/ # Email service (SMTP via reqwest, includes connection pool) │ ├── http_service/ # HTTP endpoints: user, friend, group, chat, notification, file │ ├── quic_service/ # QUIC service: external connections, internal communication, NAT hole punching, P2P relay │ └── s3_service/ # S3 object storage abstraction layer (multi-provider support) ├── config/ │ ├── app_config.toml # Application configuration (database, Redis, QUIC, file, S3) │ └── ssl/ # TLS certificates (fullchain.pem + privkey.pem) ├── docs/ # Technical documentation ├── .env.example # Environment variable template ├── Cargo.toml # Workspace configuration ├── clippy.toml # Clippy rules └── rustfmt.toml # Code formatting rules ## Quick Start ### Prerequisites - Rust: 1.75+ (Edition 2024) - PostgreSQL: 12+ - Redis: 6+ - TLS certificate: Self-signed or official certificate (place in config/ssl/ directory) ### 1. Clone the project bash git clone cd only-talk-rs ### 2. Configure environment variables bash cp .env.example .env Edit the .env file with actual configuration: env # Database DATABASE_URL=postgres://postgres:[email protected]:5432/postgres # Redis REDIS_URL=redis://:[email protected]:6379/ # S3 object storage (optional) S3_ENDPOINT=http://127.0.0.1:9000 S3_ACCESS_KEY=your-access-key S3_SECRET_KEY=your-secret-key ### 3. Configure the application Edit config/app_config.toml and adjust key settings: toml [server] address = "0.0.0.0:8443" # HTTPS API listening address log_level = "info" # Log level: debug / info / warn / error [quic_server] address = "0.0.0.0:4433" # QUIC external listening port [internal_quic_server] address = "127.0.0.1:4434" # QUIC internal communication port [s3] enabled = false # Enable S3 storage? (false uses local storage) provider = "minio" # minio / aliyun_oss / aws_s3 ### 4. Place TLS certificates Place TLS certificates in the config/ssl/ directory: config/ssl/fullchain.pem # Certificate chain config/ssl/privkey.pem # Private key (supports RSA / EC / PKCS8 formats) For development, you can use rcgen to auto-generate self-signed certificates. ### 5. Initialize the database Execute the DDL scripts in crates/entity/ to create tables. ### 6. Start the server bash # Development mode cargo run # Specify log level RUST_LOG=debug cargo run # Release mode cargo run --release After starting, the following will run simultaneously: - HTTPS API: https://0.0.0.0:8443 - QUIC external service: 0.0.0.0:4433 - QUIC internal service: 127.0.0.1:4434 ## Deployment Modes | Mode | Entry | Ports | Description | |——|—––|—––|———––| | Standalone | src/main.rs | 8443 + 4433 + 4434 | QUIC + HTTP in the same process | | QUIC Gateway | crates/quic_service/src/bin/quic_server.rs | 4433 + 4434 | QUIC connection management only | | API Service | crates/api/src/main.rs | 8443 | HTTP REST API only | ### Standalone (default) bash cargo run --release QUIC and HTTP services start in the same process, suitable for small to medium deployments. ### Separate Deployment Suitable for large-scale cluster deployments where QUIC gateway and API service run independently. ## API Endpoints ### HTTP REST API | Route Prefix | Module | Function | |–––––––|––––|–––––| | /user | user_service | User registration, login, profile management, password reset | | /friend | friend_service | Friend requests, friend list, friend relationship management | | /group | group_service | Group creation, member management, group message history | | /msg | chat_service | Text messages, message queries, message roaming | | /file | file_service | File upload/download, avatar management, S3 pre-signed URLs | | /notify | notify_service | System notifications, push notifications | | /integrated | api/controller | Integrated user service and file upload service | ### QUIC Protocol - External connection: Clients establish a QUIC long connection via port 4433 - Internal communication: Server nodes communicate among themselves via port 4434 - NAT hole punching: UDP ports 9562-9565 for P2P traversal ## Features ### Message Transport - Real-time message push based on QUIC bidirectional streams - Supports text messages, file messages, image previews - Message CRC verification ensures transmission integrity ### P2P Connection - UDP NAT discovery (ports 9562-9565) - P2P hole punching to establish direct channels - Automatic fallback to server relay on hole punching failure ### File Storage - Seamless switch between local storage and S3 object storage - Automatic image compression to WebP format - Chunked upload (supports large files) - Pre-signed URL secure access ### Authentication & Security - JWT Token authentication - Argon2 password hashing - RSA public key encryption for sensitive data transmission - HTTPS (TLS 1.3) API transport encryption - QUIC built-in TLS encryption ### Logging & Monitoring - Structured logging (tracing + JSON output) - TraceId full-link tracing - Automatic log file rotation - Automatic recording of error requests ## Configuration Guide ### app_config.toml toml [database] url = "${DATABASE_URL}" # PostgreSQL connection string [redis] url = "${REDIS_URL}" # Redis connection string [server] address = "0.0.0.0:8443" # HTTPS listening address locales = "zh-CN" # Locale language log_level = "info" # Log level [quic_server] address = "0.0.0.0:4433" # QUIC external address cert_path = "./config/ssl/fullchain.pem" key_path = "./config/ssl/privkey.pem" [file_upload] max_file_size = 20971520 # Maximum file upload size (20MB) [s3] enabled = true # Enable S3? provider = "minio" # Storage provider endpoint = "${S3_ENDPOINT}" access_key = "${S3_ACCESS_KEY}" secret_key = "${S3_SECRET_KEY}" default_bucket = "only-talk-rs" ### File Type Configuration Supports various file types such as images, documents, archives, audio, and video. Each type can configure allowed extensions and MIME types. ## Development Guide ### Code Standards - clippy::unwrap_used is disallowed — use expect("reason") or proper error handling - rustfmt: 4-space indent, Unix line endings, grouped imports (StdExternalCrate) - Error handling: anyhow for application-level errors, thiserror for domain-level errors ### Common Commands bash # Build cargo build --release # Run cargo run --release # Clippy check cargo clippy --workspace # Format code cargo fmt --all # Run tests cargo test --workspace # Run benchmarks cargo bench -p quic_service ### Adding a New API Endpoint 1. Create the corresponding module under crates/http_service/src/http_service/ 2. Create a controller (handles HTTP requests) 3. Create a service (business logic) 4. Register the route in mod.rs ### Adding a New QUIC Message Type 1. Define the message type in crates/quic_service/src/msg_service/ 2. Implement message serialization/deserialization 3. Register with the message dispatcher ## Documentation - Deployment Guide - Cluster Routing Scheme - Group Chat Broadcast Scheme - Entity Core Splitting Scheme ## License LICENSE
Similar Articles
@yiyirats: Still struggling with team communication tools — Slack is ridiculously expensive, WeCom isn't professional enough, and WeChat group chat records are hard to export? RocketChat, an open-source project with 45k+ stars, lets you build your own Slack, keeping 100% of your data in your own hands. Highlights at a glance: → Completely free, self-hosted server…
Introducing RocketChat, an open-source team communication tool that serves as an alternative to Slack, supporting self-hosting, end-to-end encryption, audio/video calls, and more.
@Ryrenz: Hey folks, someone built an open-source messaging app covering six platforms with 7.5K stars on GitHub. Companies often struggle to set up their own chat tools: buying commercial solutions charges per user, which becomes a fixed expense as the team grows; while open-source options often only have web versions, with desktop and mobile either missing or rough.
HuLa is an open-source messaging software that supports full coverage across six platforms, built on Tauri, Vue 3, and TypeScript, aimed at providing a private chat solution for enterprises.
@geekbb: A multi-protocol downloader with a Rust engine and Flutter UI, supporting HTTP/FTP, BT magnet, eD2K, and HLS/DASH streaming media, positioned as a free and open-source IDM alternative. https://github.com/zerx-lab/Flu…
A multi-protocol downloader based on a Rust engine and Flutter UI, supporting HTTP/FTP, BT magnet, eD2K, and HLS/DASH streaming media, positioned as a free and open-source IDM alternative.
@IndieDevHailey: The God-tier Open-source Project Bitchat by Billionaire Jack Dorsey is a Modern Black Tech! Completely Offline, Using Bluetooth to Send and Receive #Bitcoin + Chat!!! - On Planes, Concerts, Subways, Wilderness, Disaster Zones Without Internet... Real-time Communication + Transfer with No Signal at All -…
Jack Dorsey has open-sourced the Bitchat project, a tool that enables offline communication and Bitcoin transfers without internet, using Bluetooth Mesh networking. It supports multi-hop relay, Cashu eCash offline transfers, and double encryption, suitable for scenarios like network outages and surveillance.
Streaming the IETF MoQ sessions with MoQ… kinda
Meetecho 博客文章描述了如何利用 MoQ (Media over QUIC) 协议来流式传输 IETF MoQ 会议,作为传统 WebRTC 方案的补充,实现了自动捕获并传输相同媒体的一种新型方式。