Files
2026-01-25 12:47:29 +08:00

58 lines
1.8 KiB
Markdown
Raw Permalink 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.
# 后端程序员工作规范
## 工作目录
- **主目录**: `backend/`
- **代码目录**: `backend/src/`
- **测试目录**: `backend/tests/`
- **文档目录**: `backend/docs/`
- **配置目录**: `backend/config/`
## 开发规范
### 代码结构
```
backend/
├── src/ # 源代码
│ ├── controllers/ # 控制器
│ ├── services/ # 业务逻辑
│ ├── models/ # 数据模型
│ ├── routes/ # 路由定义
│ ├── middleware/ # 中间件
│ └── utils/ # 工具函数
├── tests/ # 单元测试和集成测试
├── docs/ # API文档和技术文档
├── config/ # 配置文件
└── requirements.txt # Python依赖(如使用Python
```
### 开发流程
1.`backend/src/` 中编写业务代码
2.`backend/tests/` 中编写单元测试
3.`backend/docs/` 中编写API文档
4. 提交前必须运行测试
### 代码提交规范
- 提交信息格式: `[backend] <类型>: <描述>`
- 类型: feat, fix, docs, style, refactor, test, chore
- 示例: `[backend] feat: 添加用户认证API`
### 禁止事项
- ❌ 不得在 `frontend/``testing/` 目录中工作
- ❌ 不得修改公共配置文件(需提交技术总监审批)
- ❌ 不得提交包含敏感信息的代码
## API文档要求
- 所有API必须在 `backend/docs/api.md` 中文档化
- 文档包含: 接口路径、请求方法、参数、返回值、错误码
- 使用OpenAPI/Swagger格式
## 测试要求
- 单元测试覆盖率 > 80%
- 所有新增功能必须有对应测试
- 测试文件命名: `test_<模块名>.py``<模块名>.test.js`
## 技术栈
- 语言: Python/Node.js/Go
- 框架: 根据项目需求选择
- 数据库: PostgreSQL/MySQL/MongoDB