# backend_study **Repository Path**: rune_study/backend_study ## Basic Information - **Project Name**: backend_study - **Description**: rust and go study 做一个需要验证动作的分布式服务,重在学习go rust 语法 以及 redis,mysql的部分操作 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-23 - **Last Updated**: 2026-02-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Back-Callback 分布式后端管理系统 一个基于 Rust 微服务和 Go 网关的分布式后端管理系统,提供用户认证、状态管理、验证码服务、RPC 调用和文件传输功能。 ## 项目架构 ``` ┌─────────────────┐ │ Gate Server │ │ (Go) │ │ 端口: 52051 │ └────────┬────────┘ │ ┌──────────────────┼──────────────────┐ │ │ │ ▼ ▼ ▼ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ Web Server│ │ Status │ │ Verify │ │ (Rust) │ │ Server │ │ Server │ │ 端口:52050│ │ 端口:8084 │ │ 端口:8081 │ └────────────┘ └────────────┘ └────────────┘ │ │ ┌──────────────────┼──────────────────┐ │ │ │ ▼ ▼ ▼ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ RPC Server│ │ File Server│ │ MySQL │ │ 端口:3001 │ │ 端口:3004/5 │ │ 端口:3306 │ └────────────┘ └────────────┘ └────────────┘ │ ▼ ┌────────────┐ │ Redis │ │ 端口:6379 │ └────────────┘ ``` ## 技术栈 ### Rust 微服务 - **Web 框架**: Axum - **异步运行时**: Tokio - **数据库**: SQLx + SeaQuery + MySQL - **缓存**: Redis - **认证**: 自定义 JWT (Blake3 签名) + Argon2id 密码加密 ### Go 网关 - **Web 框架**: Fasthttp - **服务发现**: 负载均衡 + 健康检查 ## 服务端口 | 服务 | 端口 | 语言 | 职责 | |------|------|------|------| | Gate Server | 52051 | Go | API 网关、路由转发、负载均衡 | | Web Server | 52050 | Rust | 登录/注册、静态文件服务 | | Status Server | 8084 | Rust | 用户状态、Token 管理、黑名单 | | Verify Server | 8081 | Rust | 验证码生成、校验、邮件发送 | | RPC Server | 3001 | Rust | JSON-RPC 大数计算服务 | | File Server | 3004/3005 | Rust | 文件传输 (HTTP/WebSocket/TCP) | | MySQL | 3306 | - | 持久化存储 | | Redis | 6379 | - | 缓存、会话、验证码存储 | ## 快速启动 ### 前置要求 1. **Rust** (推荐使用 rustup 安装) ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` 2. **Go** (1.21+) ```bash # 访问 https://go.dev/dl/ 下载安装 ``` 3. **MySQL** (5.7+) ```bash # Ubuntu/Debian sudo apt install mysql-server # macOS brew install mysql ``` 4. **Redis** ```bash # Ubuntu/Debian sudo apt install redis-server # macOS brew install redis ``` ### 1. 启动 MySQL ```bash # 启动 MySQL 服务 sudo systemctl start mysql # Linux # 或 brew services start mysql # macOS # 创建数据库 mysql -u root -p < ``` ### 代码格式 ```bash cargo fmt ``` ### 依赖检查 ```bash cargo check ``` ## 许可证 MIT