Files
fragmemo/README.md
T
2026-07-29 20:08:09 +08:00

92 lines
2.4 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.
# fragmemo - 碎片笔记
轻量级、自托管的笔记 Web 应用。Markdown 快速记录、标签分类、全文搜索、图片上传、私密/公开模式。
## 项目结构
```
fragmemo/
├── memo.fragford.cn/ # React 前端(独立 Git 仓库)
├── memo_server/ # Python 后端(独立 Git 仓库)
├── frag_memo_app/ # 预留:鸿蒙 ArkTS App(独立 Git 仓库)
└── docs/ # 物料文档
```
## 技术栈
| 模块 | 技术 |
|------|------|
| 前端 | React 19 + TypeScript + Vite + Tailwind CSS |
| 后端 | Python 3.11+ + FastAPI + SQLAlchemy async |
| 数据库 | MySQL 8.0 |
| 认证 | JWTaccess_token + refresh_token |
## 本地开发
### 后端
```bash
cd memo_server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # 修改数据库连接配置
uvicorn app.main:app --reload
```
访问 http://localhost:8000/docs 查看 Swagger API 文档
### 前端
```bash
cd memo.fragford.cn
npm install
npm run dev
```
前端开发服务器运行在 http://localhost:3001API 请求自动代理到后端。
## API 接口
所有接口以 `/api/v1/` 开头,认证接口使用 JWT Bearer Token。
### 认证
- `POST /api/v1/auth/register` - 注册
- `POST /api/v1/auth/login` - 登录
- `POST /api/v1/auth/refresh` - 刷新 Token
- `GET /api/v1/auth/me` - 获取当前用户
- `PUT /api/v1/auth/me` - 更新个人信息
- `GET /api/v1/auth/me/stats` - 获取用户统计
### 笔记
- `GET /api/v1/memos` - 笔记列表(支持 cursor/limit/search/tag/visibility
- `POST /api/v1/memos` - 创建笔记
- `GET /api/v1/memos/{id}` - 笔记详情
- `PUT /api/v1/memos/{id}` - 更新笔记
- `DELETE /api/v1/memos/{id}` - 删除笔记
### 标签
- `GET /api/v1/tags` - 标签列表
- `POST /api/v1/tags` - 创建标签
- `PUT /api/v1/tags/{id}` - 更新标签
- `DELETE /api/v1/tags/{id}` - 删除标签
### 文件
- `POST /api/v1/files/upload` - 上传文件
- `GET /api/v1/files/{id}` - 获取文件
## 部署到服务器
### 你需要做的事情(部署时)
1. 在宝塔面板创建 MySQL 数据库 `fragmemo`
2. 在宝塔 → 软件商店 → Python 项目管理器 添加 `memo_server` 项目
3. 在宝塔 → 网站 添加站点(端口自定),配置 Nginx 反向代理
4. 配置 Nginx`/api/*` 转发到 `127.0.0.1:8000``/*` 指向前端 dist/
部署脚本见各子项目的 `deploy.sh`
## License
MIT