Skip to content

Mobile Data Layer

All schema definitions, Supabase types, and domain types come from @life-manager/db:

import { AppSchema } from "@life-manager/db/schema";
import { Tables } from "@life-manager/db/supabase";
import { Profile, ProfileUpdate } from "@life-manager/db/types/profile.types";

See the Data Flow page for the full schema reference and domain type listing.

Same file pattern as the web app:

db/collections/[entity]/
[entity]-collection.ts # TanStack DB createCollection
[entity]-schema.ts # Zod validation schema
[entity]-mutations.ts # CRUD operations
use-[entity]-query.ts # React hook for live queries
use-[entity]-mutations.ts # React hook for mutations

Currently implemented: profile/ collection only. Add more collections as features are built.

ComponentDetails
SchemaShared from @life-manager/db/schema (platform-agnostic)
Connectorsrc/db/powersync/Connector.ts (mobile-specific, uses @supabase/ssr)
DB instancesrc/db/powersync/db.ts (uses @powersync/op-sqlite for native SQLite)
  • Client: src/db/supabase.ts
  • Types regenerated via bun run generate-types from root