BackendHTTP API
Multi-client implementation notes
Multi-client implementation notes
- Base URL — API origin where
/apiis mounted (Docker, Workers, or local:8780). Web uses Vite proxy in dev; mobile should call the API host directly. - JSON helpers — unwrap
dataon success; throw onerror(see webapps/web/src/shared/api/client.tsas a reference, not the contract). - Do not use JSON unwrap for agent chat stream or upload file GET.
- Multipart field names — trip media:
file; avatar:avatar. - Optimistic / write-echo UI — many mutations return the full trip (or the inserted row). Replace local state / query cache with the response rather than patching fields ad hoc or immediately refetching a list. On Cloudflare, a follow-up list GET can be stale for ~60s (Hyperdrive). See ../../frontend/data-caching.md.
- Polling agent — web polls
GET …/agent/events?after=<seq>~12s; mobile can use the same cursor protocol. - Geo tools are agent-only (no public HTTP geo routes). Clients do not call place search via REST; they use stops/map UX or the agent. See geo.md.
- No product API yet for deleting a stop or expense (human or agent).