You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FastAPI REST API for Weibo content aggregation. Collects producer (Weibo user) profiles and serves their image content.
26
+
27
+
### Key Patterns
28
+
29
+
-**DB abstraction**: `src/db/base.py` defines `DBClientBase` with metaclass auto-registration. Providers (`mysql_provider.py`, `tidb_http_provider.py`) register via `_type` class attribute. Selected at runtime by `settings.db_client_type`.
30
+
-**Models submodule**: `src/models/` is a **git submodule** (separate repo). ORM models live there. Commit model changes in the submodule first, then update the ref in this repo.
31
+
-**Admin auth**: All admin endpoints under `/admin` prefix use Bearer Token via `HTTPBearer` + `hmac.compare_digest`. Token value from `settings.token`.
32
+
-**WeiboHeaders**: Thread-safe singleton in `config.py` (`wb_headers`). Loaded from DB on startup, persisted on update. DB writes happen outside the lock.
33
+
-**Config**: Pydantic `BaseSettings` in `config.py`, loaded from `.env`. Sensitive fields (`token`, `db_url`) have `exclude=True`.
34
+
35
+
### Deployment
36
+
37
+
-**Vercel**: Serverless Python, configured in `vercel.json`. CI deploys two projects in parallel (`.github/workflows/main.yml`).
38
+
-**Docker**: Released to `ghcr.io` on git tags (`.github/workflows/release.yml`).
39
+
40
+
### Constants
41
+
42
+
Weibo API URLs and `WB_HEADERS_KEY` are centralized in `config.py`.
0 commit comments