Files
English/sync_server/README.md
T

41 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 芽说英语 (SpeakSprout) - 自建跨平台多端同步服务
轻量、高性能、本地优先的跨平台(Android / iOS / macOS)学习进度与艾宾浩斯复习同步服务。
## 🌟 核心特性
- **极简架构**:基于 Python 3.11 + FastAPI + aiosqlite,单容器内存占用 < 30MB。
- **无损合并 (CRDT/LWW)**:课程通关自动取并集,艾宾浩斯复习阶段取更高 Checkpoint,绝不发生进度回退。
- **离线优先 (Offline-First)**:弱网/断网下客户端完全正常学习,恢复网络后自动增量合并同步。
- **安全认证**bcrypt 密码加盐哈希 + JWT 鉴权。
## 🚀 快速启动
### 方案 1Docker Compose 一键启动(推荐)
```bash
# 1. 复制目录到您的服务器
cd sync_server
# 2. 一键启动
docker compose up -d --build
# 3. 检查服务健康状态
curl http://127.0.0.1:8080/api/v1/health
```
### 方案 2:直接 Python 运行
```bash
pip install -r requirements.txt
python main.py
```
## 🧪 自动化测试
```bash
python test_server.py
```
## 📡 API 快速参考
- `POST /api/v1/auth/register` : 注册新账号
- `POST /api/v1/auth/login` : 登录账号获取 Token
- `GET /api/v1/sync/pull` : 增量拉取云端学习进度
- `POST /api/v1/sync/push` : 增量推送本地最新进度