@davoodmehraban89 / LifeMate / commits / 54f007f
Fork 0

LifeMate — Personal, Family & Learning Companion

docs: update phase 2 blueprint for provider-neutral backend

davoodmehraban89 committed Oct 5, 2026 at 07:29 UTC 54f007f7d452a89d5c887c0a564099be4db5e2ac
1 file changed +21 -20
docs/architecture/PHASE_2_BLUEPRINT.md
+21 -20
@@ -1,6 +1,6 @@
1 # LifeMate — Phase 2 Implementation Blueprint
2
3 -## Proposed repository structure
3 +## Repository structure
4 ```text
5 apps/lifemate/ Flutter application (Android + Web/PWA)
6 lib/
@@ -8,39 +8,40 @@ apps/lifemate/ Flutter application (Android + Web/PWA)
8 features/auth/
9 features/profile/
10 features/family/
11 - shared/ reusable UI/domain utilities with strict scope
12 - web/ manifest, icons, bootstrap, custom SW/web integration
11 + shared/
12 + web/ manifest, icons, PWA integration
13 test/
14 -supabase/
15 - migrations/ versioned schema + grants + RLS
16 - functions/ privileged server workflows; no client secrets
17 - tests/ database/RLS allow+deny tests
14 +backend/
15 + migrations/ standard PostgreSQL schema + constraints/policies
16 + tests/ authorization/database tests
17 + README.md API/identity adapter contract
18 docs/ product, UX, architecture, safety, quality, decisions
19 -.github/workflows/ CI after scaffold
19 +.github/workflows/ CI and staging verification
20 ```
21
22 ## Architecture style
23 -Feature-oriented Flutter modules with domain/service boundaries; avoid a giant shared layer. UI may validate and cache, but backend policies are authoritative for permissions. Supabase is accessed through repository/service interfaces so AI/provider logic and complex privileged workflows remain server-side.
23 +Feature-oriented Flutter modules behind application repositories. Flutter never receives privileged database credentials. A server/API boundary owns identity-session validation and relationship-aware authorization. PostgreSQL is the durable relational source of truth. Managed database, identity, email, storage and realtime providers are adapters rather than domain dependencies.
24
25 ## Environments
26 -At minimum: **local**, **staging**, **production**. Staging and production use separate Supabase projects/secrets/data. Environment-specific public configuration is injected at build/deploy; secrets/service-role/provider keys exist only in server secret stores. `.env` with real credentials is never committed.
26 +At minimum: **local**, **staging**, **production**. Staging and production use separate database credentials/data. Environment-specific public API configuration is injected at build/deploy; privileged credentials exist only in server/CI secret stores. Real `.env` files are never committed.
27
28 -## Phase 2 first vertical slice
29 -1. App shell + localization/RTL + theme.
30 -2. Email/password auth + verification/recovery/change-password.
31 -3. Profile creation.
28 +## Phase 2 vertical slice
29 +1. App shell + Persian RTL + role/profile-aware theme.
30 +2. Email/password auth contract + verification/recovery/change-password UX.
31 +3. Profile creation/editing.
32 4. Family Workspace + invitation + membership.
33 -5. Guardian relationship and baseline permission enforcement.
33 +5. Guardian relationship and baseline server authorization contract.
34 6. Teen/Parent authenticated home shells.
35 -7. CI and staging smoke.
35 +7. CI and isolated PostgreSQL staging smoke.
36
37 -This slice deliberately proves identity and authorization before planner/school data expands the schema.
37 +## Student navigation baseline
38 +MyStudyLife is the primary information-architecture benchmark for the student surface. Direct destinations remain visible for Today, Schedule, Calendar, Tasks, Exams/Grades, Focus and AI; LifeMate Family/Wellbeing extensions are additive rather than hiding these core destinations behind a generic School layer.
39
40 ## PWA integration
40 -Own `manifest.json`, icons/apple-touch-icon, standalone metadata, install guidance and custom service-worker strategy. Push subscription is capability-detected and implemented only after the core auth/family slice is stable.
41 +Own `manifest.json`, branded icons/apple-touch-icon, standalone metadata, install guidance and explicit service-worker strategy. Push is capability-detected and is not required for Phase 2 identity acceptance.
42
43 ## Configuration rule
43 -Public client identifiers are separated from secrets. Any credential that bypasses RLS or accesses AI/email/push provider privileged APIs is server-only.
44 +Any credential that can read another user's private data, administer identity, send privileged email, or bypass authorization is server-only.
45
46 ## Migration rule
46 -Schema/grant/RLS changes travel together in versioned migrations and include database tests. Destructive migrations require explicit approval and rollback/backup consideration.
\ No newline at end of file
47 +Schema, constraints and authorization-relevant database changes travel together in versioned PostgreSQL migrations and tests. Destructive migrations require explicit approval and rollback/backup consideration.