LifeMate — Personal, Family & Learning Companion

phase-1/foundation-completion
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
md 1.75 KB

ADR-0005 — Backend/Auth Baseline: Supabase

  • Status: Accepted for Phase 2 baseline
  • Date: 2026-10-05

Decision

Use Supabase as the initial backend platform: PostgreSQL + Supabase Auth + Row Level Security, with Edge Functions/server-side code for privileged workflows, AI orchestration and secrets.

Why

LifeMate needs relational family/guardian/resource relationships, granular authorization and email/password recovery. Supabase Auth integrates JWT identity with PostgreSQL RLS, allowing authorization to remain consistent across Android and Web/PWA clients.

Security contract

  • Enable RLS on every exposed application table.
  • Explicitly set grants and separate policies by operation; do not assume RLS alone removes broad grants.
  • Test allow and deny paths for authorization policies.
  • Publishable client key may exist in clients; service-role/secret keys never do.
  • Privileged AI/provider calls, invitation administration and sensitive safety workflows execute server-side.
  • Views/functions must be reviewed for RLS/security-definer behavior before exposure.

Auth baseline

Email/password with email verification, non-enumerating forgot-password response, time-limited recovery flow, authenticated password change and controlled redirect URLs. Custom SMTP/provider selection is an operational Phase 2 task, not a reason to build custom authentication.

Alternatives considered

Custom API/Postgres would provide full control but adds auth/security/operations work before core product value. Firebase simplifies some mobile flows but the relational authorization model is a less direct fit for family/guardian/resource policy. Supabase remains replaceable behind domain/service boundaries if later scale or compliance requirements justify migration.