Data and Storage

Keep ownership, schemas, caches, and upload boundaries consistent across deployment modes.

UI layers call domain services for profiles, todos, uploads, and account lifecycle. They do not query a generic database abstraction.

The Supabase adapter maps domain models to Supabase rows, obtains the current user from its own session, relies on RLS, and uploads through Supabase Storage.
The client sends camelCase contract DTOs to /api/app/v1. The host derives the user from the Better Auth session and filters every resource query by ownership. Uploads use presign → direct upload → complete.

Invariants

  • User IDs are opaque strings; business entity IDs follow the API schema.
  • Cross-user reads return 404, preventing resource-existence disclosure.
  • Query caches include backend mode and current user ID and are cleared atomically when sessions change.
  • Presigned URLs remain inside the native networking boundary on desktop clients.
  • Account deletion uses DELETE /api/app/v1/account so owned data, uploads, device tokens, subscription state, and provider cleanup follow one server workflow.

See the selected template's Storage or Data Layer page for provider-specific keys and limits.

On this page