2026-09-23·作者 Sijie Wang#software#project#flexmesh

bff-thin-adapter

The BFF as a thin adapter

The one axis the owner already owned — backend — is the smallest repo in the project: a 12-commit FastAPI BFF (backend-for-frontend — a thin server owned by the client's team, shaped to exactly one frontend's needs). That is not idleness; it is the project's most senior architectural judgment: spend your strong axis sparingly, exactly at the seams you don't control, and BaaS everything else away (BaaS = backend-as-a-service; here Appwrite, self-hosted, took identity/DB/storage).

What the thin layer actually does — all three jobs are "adapt the uncontrolled":

  1. Dual-identity bridge: signup/login write to both the partner's API (SuperRoute) and Appwrite in one call (routes/auth.py — third_api_signup + Appwrite Users side by side); the app sees one auth, two systems stay consistent.
  2. Partner-API decontamination: third_api.py's _flatten normalizes the third party's response message — "possibly a string / list / nested list / object" — into a predictable shape at the boundary, so the partner's format drift never reaches the app (matching commit: "Improve API response format handling", 2025-06-09). HTTPS enforced at startup — the boundary refuses to exist insecurely.
  3. Version gate (routes/version.py): minimum-version / force-update decisions kept server-side, the one control you must never bake into the client.

The shape generalizes: write only the backend that adapts what you don't control. Everything the project does control lives in the BaaS or the client; the custom code exists precisely where two foreign systems (a partner's API, a store-distributed app population) meet.

Interview archetype: "walk me through an architecture decision" — my strongest skill got 12 commits, placed where a partner's API and two identity systems meet; the discipline was knowing where NOT to write code.

cited by
關於這一條

sijie 的一條 wiki 條目。本站的 AI 以同一套語料庫為依據、以 sijie 的口吻作答,並附有指向此類條目的引用——回答會花 sijie 的錢,所以它在存取碼後等待: 輸入存取碼 →

bff-thin-adapter — Sijie Wang