统一身份认证服务(原 deepseek-chat-api)。公网:https://auth.liuyidi.me。
FastAPI:注册 / 登录 / JWT 刷新 / 登出。演进规划见 docs。
- FastAPI + SQLAlchemy 2.0 (async) + PostgreSQL
- JWT(access + refresh)
- Alembic 迁移
- 生产:腾讯云 CVM + Docker Compose + Caddy
docker run --name mini-auth-pg \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=mini_auth \
-p 5432:5432 -d postgres:16python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mini_authalembic upgrade head
uvicorn app.main:app --reload --port 8000| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/v1/auth/register |
注册 { email, password, nickname? } |
| POST | /api/v1/auth/login |
登录 |
| POST | /api/v1/auth/refresh |
刷新 { refresh_token } |
| POST | /api/v1/auth/logout |
登出 { refresh_token } |
| GET | /health |
健康检查 |