2026-09-23·by 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.pythird_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
about this entry

One of sijie's wiki entries. The AI on this site is grounded in the same corpus and answers in sijie's voice, with citations back to entries like this one — answering costs sijie money, so it waits behind a code: enter an access code →