zelo

module
v0.0.0-...-b25a406 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: MIT

README

Zelo Backend

Zelo 是一个即时通讯后端项目,包含用户、好友、群聊、消息、WebTransport 实时聊天、会议,以及 AI 助手与 MCP 工具服务。

这个仓库是后端仓库。前端位于同级 sibling 仓库,不在本仓库内。

当前能力

  • 用户、好友、群组、消息、会话列表
  • WebTransport 实时聊天
  • 媒体上传与 RustFS 对象存储
  • 视频会议、录制、会议总结
  • AI 助手(支持部分文本附件)
  • MCP 工具服务

技术栈

  • Go
  • Hertz
  • Kitex RPC
  • Redis
  • MySQL
  • Asynq
  • Canal
  • WebTransport / QUIC
  • RustFS
  • MCP

仓库结构

zelo/
├── cmd/           # 各服务启动入口
├── config/        # 配置、SQL、TLS、脚本
├── docker/        # 本地依赖与服务编排
├── docs/          # 设计文档与开发手册
├── idl/           # Thrift IDL
├── internal/      # 业务实现
├── kitex_gen/     # Kitex 生成代码
└── pkg/           # 公共包

主要服务入口:

  • cmd/api/main.go
  • cmd/user/main.go
  • cmd/message/main.go
  • cmd/group/main.go
  • cmd/friend/main.go
  • cmd/chat/main.go
  • cmd/meeting/main.go
  • cmd/helper/main.go
  • cmd/mcp/main.go

快速开始

1. 安装依赖
go install github.com/cloudwego/hertz/cmd/hz@latest
go install github.com/cloudwego/kitex/tool/cmd/kitex@latest

还需要安装 thrift 编译器。

2. 启动基础设施
make env-up

这会启动 MySQL、Redis、etcd、RustFS、nginx 等本地依赖。

3. 初始化配置
cp config/config.example.yaml config/config.yaml

然后按你的本地环境修改 config/config.yaml

注意:

  • 真实运行配置是 config/config.yaml
  • config/config.example.yaml 只是模板,不是部署中的真实配置
4. 生成开发证书

聊天服务基于 WebTransport,开发环境需要 TLS 证书,示例:

mkdir -p config/tls
openssl req -x509 \
  -newkey ec -pkeyopt ec_paramgen_curve:P-256 \
  -keyout config/tls/key.pem \
  -out config/tls/cert.pem \
  -days 13 -nodes \
  -subj "/CN=localhost" \
  -addext "subjectAltName=IP:127.0.0.1,DNS:localhost"
5. 启动服务

可以分别启动:

go run cmd/api/main.go
go run cmd/user/main.go
go run cmd/message/main.go
go run cmd/group/main.go
go run cmd/friend/main.go
go run cmd/chat/main.go
go run cmd/meeting/main.go
go run cmd/mcp/main.go
go run cmd/helper/main.go

也可以使用镜像构建和 compose:

make svc-build
make svc-up

常用命令

# 启动依赖
make env-up

# 停止依赖
make env-down

# 初始化数据库
make db-init

# 重置数据库
make db-reset

# 更新 API 网关代码
make api-update

# 更新指定服务的 Kitex 代码
make kitex-update-message
make kitex-update-group
make kitex-update-friend

文档

License

MIT

Directories

Path Synopsis
cmd
api command
chat command
friend command
group command
helper command
mcp command
meeting command
message command
user command
scripts command
设置 RustFS/S3 bucket 公开读策略 在 docker-compose 中通过 golang:alpine 镜像运行
设置 RustFS/S3 bucket 公开读策略 在 docker-compose 中通过 golang:alpine 镜像运行
internal
helper/intent
Package intent provides two-level intent classification for the helper consumer:
Package intent provides two-level intent classification for the helper consumer:
helper/memory
Package memory manages the per-user context window for multi-turn AI conversations.
Package memory manages the per-user context window for multi-turn AI conversations.
helper/skills
Package skills embeds the SKILL.md files and exposes BodyOf to retrieve the Markdown body (everything after the YAML frontmatter) by skill name.
Package skills embeds the SKILL.md files and exposes BodyOf to retrieve the Markdown body (everything after the YAML frontmatter) by skill name.
mcp
Package mcp provides the MCP (Model Context Protocol) tool server for the helper module.
Package mcp provides the MCP (Model Context Protocol) tool server for the helper module.
kitex_gen
friend/friendservice
Code generated by Kitex v0.15.2.
Code generated by Kitex v0.15.2.
group/groupservice
Code generated by Kitex v0.15.2.
Code generated by Kitex v0.15.2.
helper/helperservice
Code generated by Kitex v0.15.2.
Code generated by Kitex v0.15.2.
meeting/meetingservice
Code generated by Kitex v0.15.2.
Code generated by Kitex v0.15.2.
message/messageservice
Code generated by Kitex v0.15.2.
Code generated by Kitex v0.15.2.
user/userservice
Code generated by Kitex v0.15.2.
Code generated by Kitex v0.15.2.
pkg
asr
llm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL