@davoodmehraban89 / LifeMate / commits / 73f54f8
Fork 0

LifeMate — Personal, Family & Learning Companion

docs: remove duplicate ADR number

davoodmehraban89 committed Oct 5, 2026 at 07:57 UTC 73f54f8e59aa8f2cc659b1e5843fde99e3d38b22
1 file changed -41
docs/decisions/0004-provider-neutral-postgresql-backend.md deleted
-41
@@ -1,41 +0,0 @@
1 -# ADR-0004 — Provider-neutral PostgreSQL Backend
2 -
3 -- **Status:** Accepted
4 -- **Date:** 2026-10-05
5 -- **Supersedes:** any Phase 2 assumption that Supabase is a mandatory backend platform
6 -
7 -## Context
8 -Phase 2 originally treated Supabase as the likely combined database/auth/backend provider. Creation of an isolated LifeMate staging project was blocked by account-level project limits. More importantly, tying identity, authorization, storage, realtime and database behavior to one BaaS creates unnecessary platform coupling for a long-lived family product.
9 -
10 -## Decision
11 -LifeMate will use PostgreSQL as its durable relational source of truth while exposing infrastructure through explicit application ports/adapters.
12 -
13 -The managed PostgreSQL host is replaceable. Neon is the preferred current target when available, but no domain entity, authorization rule, migration or client contract may require Neon-specific semantics.
14 -
15 -Required ports:
16 -- `IdentityProvider`: registration, email verification, login/session, password recovery/change.
17 -- `LifeMateApi`: authenticated application boundary; clients do not receive privileged database credentials.
18 -- `TransactionalEmail`: verification, password recovery and family invitation messages.
19 -- `ObjectStorage`: future profile/media assets.
20 -- `RealtimeTransport`: optional event delivery; business correctness cannot depend on it.
21 -
22 -PostgreSQL owns profiles, family workspaces, memberships, guardian relationships, invitations and authorization-relevant state. Authorization is enforced server-side. Database constraints and, where operationally suitable, RLS are defense-in-depth rather than the only authorization boundary.
23 -
24 -## Consequences
25 -### Positive
26 -- Staging/production can move between managed PostgreSQL providers.
27 -- Auth can change without rewriting family/profile domain tables.
28 -- Flutter clients stay independent of database vendor SDKs.
29 -- Testing authorization through API/service contracts becomes straightforward.
30 -- LifeMate is no longer blocked by Supabase project quotas.
31 -
32 -### Cost
33 -- We own a small backend/API layer instead of relying entirely on generated BaaS APIs.
34 -- Email verification/recovery and session handling need an explicit identity adapter.
35 -- Realtime/storage require separate adapters if/when introduced.
36 -
37 -## Guardrails
38 -- Never place database owner/service credentials in Flutter/Web clients.
39 -- Never use client-side role checks as the security boundary.
40 -- Never let Family Owner/Admin imply automatic access to private teen content.
41 -- Migrations remain standard PostgreSQL SQL wherever practical.