beaver-im/beaver-server
About
海狸 IM (Beaver)|全平台、功能齐全、易二开,一站式私有化即时通讯 & 实时音视频方案
Design & MediaMeasured star growth
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +4
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README_EN.md
OriginalBeaver IM
Beaver IM core server built on Go-Zero microservices, backing the Flutter mobile app and Electron desktop app with a complete core IM closed loop (REST / WebSocket / gRPC). beaver-server-package/ and beaver-desktop-package/ are independent, optional value-added services and capability packs—core IM works normally even without them.
Current version: 3.0.4 (see VERSION at the repository root).
For development and AI collaboration, read the Chinese engineering handbook first.
.api/.protofiles are the source of truth for contracts; goctl generates the wiring. For older docs and examples, the current source code and handbook take precedence.
Key Features
- Authentication: Phone, email, verification code, QR code, and OAuth login;
gateway_apiverifies external JWTs and signs an ES256 assertion, services verify it with a public JWKS; S2S machine tickets, device management, and remote logout. - Messaging: 1:1 and group chats, conversations and message history, read receipts, forwarding, WebSocket delivery, and RocketMQ async pipelines.
- Social: Friend requests and profiles, group creation and moderation, block list; circles and moments live in the optional
beaver-server-socialrepo. - Files & Emoji: Uploads/downloads, emoji packs and favorites, backed by MinIO / Qiniu object storage.
- Calls: LiveKit-backed signaling and rooms in the optional
beaver-server-callrepo. - Notifications & Push: System notifications, interaction reminders, inbox and read state; a standalone
push_apigateway with realtime / offline channels mapped to MQ topics. - Sync:
datasyncincremental multi-device sync for friends, groups, messages, emoji, notifications, circles, and bots. - Organization: Departments, employees, workbench, feedback / reports, client telemetry, and release management in
platform. - AI & Knowledge: Digital partners / bots, knowledge sources and skills (
SKILL.md), and agent conversation sync (beaver-server-ai+ open platform). - Online Documents: HTTP API and Yjs WebSocket in one
office_apiprocess (optionalbeaver-server-online). - Operations: Server log collection via Vector and client log ingestion into OpenSearch (
beaver-server-observability). - Admin: User / organization / release admin endpoints in
admin_api(optionalbeaver-server-backend).
Technology Stack
| Area | Technology | Notes |
|---|---|---|
| Language / framework | Go 1.26.8, go-zero 1.7.4 | goctl is a separate tool; its version is not pinned in the repo (see handbook 1.1) |
| Communication | gRPC, HTTP S2S, WebSocket, RocketMQ | RPC inside this repo; HTTP machine tickets across repos and for push |
| Storage / search | MySQL 8.0, Redis 6.0, ETCD 3.5, OpenSearch | Split databases, cache, service discovery, log search |
| Deployment | Docker Compose, build scripts | deploy/<domain>/ and docker/ |
| Other | JWT (ES256 / JWKS), LiveKit, MinIO / Qiniu | Auth, calls, object storage |
Architecture
Clients (Flutter / Electron) reach the backend through gateway_api :20800. The gateway verifies external Beaver / Open / Admin tickets, signs an ES256 assertion, injects trusted identity headers, and forwards by path. Services verify the assertion with JWKS; cross-service and cross-repo calls use S2S machine tickets and machine / _public views. WebSocket carries long-lived connections; RocketMQ carries async messages and push delivery. The admin console reaches admin_api through the gateway.
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Flutter app │ │ Electron app │ │ Admin console│
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
└─────────────────┼─────────────────┘
│
┌──────────▼──────────┐
│ gateway_api :20800 │
└──────────▼──────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
account / relation message / ws asset / notification
platform / datasync push :20500 (RPC inside this repo only)
│ │ │
└─────────────────────┼─────────────────────┘
│
┌────────────────┴────────────────┐
│ MySQL · Redis · ETCD · OpenSearch │
└─────────────────────────────────┘
Cross-repo ──► social / call / open / office / agent / backend / observability (HTTP machine views)
Service Ports
server.md is the single port table; actual listeners are in each service's etc/*.yaml. The main repo has 9 business domains plus the standalone push service. Subrepos run single processes; old moment / circle / call_rpc / open_rpc / doc_rpc ports are no longer in use.
| Service | API | RPC | Repo | Notes |
|---|---|---|---|---|
| gateway_api | 20800 | - | beaver-server | Client API gateway: ticket verification and forwarding |
| account | 20100 | 30100 | beaver-server | Users + auth (merged) |
| relation | 20200 | 30200 | beaver-server | Friends + groups (merged) |
| message | 20300 | 30300 | beaver-server | Chat (renamed from chat) |
| ws | 20400 | - | beaver-server | WebSocket connections |
| push | 20500 | - | beaver-server | Standalone push gateway (S2S) |
| asset | 20600 | 30600 | beaver-server | Files + emoji (merged) |
| notification | 21000 | 31000 | beaver-server | Notifications |
| platform | 21600 | 31100 | beaver-server | Org / feedback / telemetry / updates |
| datasync | 21700 | - | beaver-server | Incremental sync |
| call | 21800 | - | beaver-server-call | Calls (LiveKit, optional) |
| open | 21900 | - | beaver-server-open | Open platform: API / portal / WS / MQ (optional) |
| social | 22100 | - | beaver-server-social | Circles and moments (optional) |
| agent | 22300 | - | beaver-server-ai | AI / digital partners (Python, agent_api, optional) |
| office | 22400 | - | beaver-server-online | Online docs (HTTP + Yjs WS, optional) |
| observability | 22800 | - | beaver-server-observability | Logging & observability (OpenSearch + Vector, optional) |
| admin_api | 40000 | - | beaver-server-backend | Admin APIs (JWT / CORS, optional) |
Project Structure
beaver-server/
├── app/ # 9 domains: account relation message asset
│ │ # notification platform datasync ws gateway (+ push)
│ ├── account/ # account_api + account_rpc + account_models
│ ├── relation/ # relation_api + relation_rpc + relation_models
│ ├── message/ # message_api + message_rpc + message_models
│ ├── asset/ # asset_api + asset_rpc + asset_models
│ ├── notification/ # notification_api + notification_rpc + notification_models
│ ├── platform/ # platform_api + platform_rpc + platform_models
│ ├── datasync/ # datasync_api + datasync_models (no RPC)
│ ├── ws/ # ws_api (no RPC)
│ ├── push/ # push_api (no RPC, no tables)
│ └── gateway/ # gateway_api (custom proxy, no .api)
├── common/ # Shared constants, identity, response, middleware
├── core/ # MySQL / Redis / MQ / etcd / OpenSearch / push clients
├── commonconfig/ # Shared config structs
├── middleware/ # JWT and HTTP middleware
├── remote/ # Outbound clients for other repos, grouped by peer
├── types/ # Outbound request / response DTOs
├── openevent/ # Public event publishing
├── utils/ # Logging, JWT, S2S, password, email helpers
├── template/ # Repo-specific goctl templates
├── database/ # DB seed data (not SQL migrations)
├── deploy/ # Compose and config per domain
├── build/ # Build / release / local start scripts
├── docs/ # Engineering handbook (Chinese, 13 chapters)
├── main.go # DB init tool only: go run main.go -db
└── server.md # Service port reference
Quick Start
See the backend docs and deployment guide, plus the local handbook chapter 7 Configuration & Deployment.
Initialize the local database (MySQL connection must be configured first; main.go is a DB init tool, not a service entry point):
go run main.go -db
Build and orchestration scripts live in build/ and deploy/<domain>/. VERSION is used by the build scripts for image tags.
Documentation & Resources
- Engineering handbook (Chinese: architecture, contracts, boundaries, identity, data, deployment, decisions)
- Full documentation
- Changelog · Update notes
- Video tutorials
- Android demo APK
- QQ Group: 1013328597
Related Projects
All repositories live under the GitHub beaver-im organization. The core repository forms a complete, self-contained IM closed loop on its own; beaver-server-package/ and beaver-desktop-package/ are independent, optional value-added services / capability packs (local container folders, not repositories themselves)—core IM works normally even without them.
| Group | Project | Repository | Description |
|---|---|---|---|
| Core Server | beaver-server | GitHub | Core backend monorepo (self-contained closed loop, this repo) |
| Core Clients | beaver-flutter | GitHub | Mobile app (Flutter, recommended) |
| beaver-desktop | GitHub | Desktop app core (Electron) | |
| Portals / SDK / Docs | beaver-web-manager | GitHub | Admin web console |
| beaver-web-oauth | GitHub | OAuth login portal | |
| beaver-web-open | GitHub | Open platform web portal | |
| beaver-sdk | GitHub | JS SDK & OpenClaw adapter | |
| beaver-docs | GitHub | Official documentation site | |
| Optional Server Add-ons | beaver-server-ai | GitHub | AI agent (Python, optional) |
(beaver-server-package) |
beaver-server-backend | GitHub | Admin APIs (admin_api, optional) |
| beaver-server-call | GitHub | Calls (LiveKit, optional) | |
| beaver-server-observability | GitHub | Logging & observability (optional) | |
| beaver-server-online | GitHub | Online docs (office_api, optional) |
|
| beaver-server-open | GitHub | Open platform / bots (optional) | |
| beaver-server-social | GitHub | Circles and moments (social_api, optional) |
|
| Optional Desktop Packs | beaver-desktop-ai | GitHub | External desktop AI capability pack (optional) |
(beaver-desktop-package) |
beaver-desktop-online | GitHub | External desktop online-docs pack (optional) |
Feature Showcase
Authentication & Security
Messaging & Communication
Social Features
Moments & Groups
User Management
System Features
Contributing
Issues and pull requests are welcome. See CONTRIBUTING.md.
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-change) - Commit your changes (
git commit -m 'Describe your change') - Push to the branch (
git push origin feature/my-change) - Open a Pull Request
License & Legal Disclaimer
This project is licensed under the MIT License — see LICENSE.
Summary:
- Closed-source self-use and re-open-sourcing derivatives are free if you keep the root
LICENSEand show About attribution when deployed (Based on Beaver IM + repo link) - Closed-source delivery to third parties, removing About, or running a paid IM SaaS requires a commercial license (written contract)
- Do not delete or alter
LICENSE, whether paid or free
Full disclaimer & attribution: LEGAL.md
Commercial product lines & pricing: Copyright & Commercial Licensing
Contact: [email protected]
Star History
Sponsor
Explore related projects
Loading…