tangweijie 137126c335 feat: 添加安全配置、API文档和错误码体系
- 添加JWT/加密/速率限制安全配置
- 为所有API添加OpenAPI文档注解
- 建立统一的6位错误码体系
- 实现账务原子更新(乐观锁重试机制)
- 添加Swagger UI和请求ID中间件

Ref: #安全配置 #API文档 #错误处理
2026-01-06 10:28:35 +08:00

71 lines
1.6 KiB
TOML

[package]
name = "rustjr"
version = "0.1.0"
edition = "2021"
authors = ["Bank Account Management System"]
description = "银行账户管理系统 - 支持实体账户、虚拟子账户、复式记账的资金管理平台"
[dependencies]
# Web 框架
axum = { version = "0.7", features = ["macros"] }
tokio = { version = "1", features = ["full"] }
tower = "0.4"
tower-http = { version = "0.5", features = ["cors", "trace"] }
# 数据库
sea-orm = { version = "0.12", features = ["sqlx-mysql", "runtime-tokio-rustls", "macros"] }
sqlx = { version = "0.7", features = ["mysql", "runtime-tokio-rustls", "chrono", "bigdecimal"] }
# 序列化
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# 日志
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
# 配置
config = "0.14"
dotenvy = "0.15"
# 错误处理
thiserror = "1"
anyhow = "1"
# 时间处理
chrono = { version = "0.4", features = ["serde"] }
# 数值精度
rust_decimal = { version = "1", features = ["serde", "db-tokio-postgres"] }
rust_decimal_macros = "1"
# 工具
uuid = { version = "1", features = ["v4", "serde"] }
async-trait = "0.1"
once_cell = "1"
# API 文档
utoipa = { version = "4", features = ["axum_extras", "chrono"] }
utoipa-swagger-ui = { version = "6", features = ["axum"] }
# ==================== 安全依赖 ====================
# JWT 认证
jsonwebtoken = "9"
bcrypt = "0.15"
# API 安全
sha2 = "0.10"
# 加密
aes-gcm = { version = "0.10", features = ["std"] }
rand = "0.8"
base64 = "0.21"
[dev-dependencies]
tokio-test = "0.4"
reqwest = { version = "0.11", features = ["json"] }
[[bin]]
name = "rustjr"
path = "src/main.rs"