How zuhak5/homepilot works
Purpose and Entry Points
HomePilot is an Android-focused Flutter app for home-asset tracking and recurring maintenance. Supabase is authoritative; Drift/SQLite is an authenticated cache and offline mutation queue. Flutter starts at lib/main.dart, with splash handling in lib/homepilot_animated_splash_screen.dart. Android hosts Flutter through android/app/src/main/kotlin/com/homepilot/app/MainActivity.kt.
App Composition and Domain
Core domain contracts, models, selectors, and feature models establish the application’s data vocabulary and repository boundaries. UI foundations provide theme and shared composition; localization supports English and Arabic.
• lib/src/core/domain/contracts.dart
• lib/src/core/domain/models.dart
• lib/src/core/data/repositories.dart
• lib/src/ui/app_theme.dart
• lib/l10n/app_en.arb
Authentication and Account Boundary
Production access is gated by Google sign-in and Supabase Auth; unsupported local/guest flows are excluded. Authentication state determines whether the app shell is reachable, and account cleanup handles user-local data lifecycle.
• lib/src/features/auth/presentation/authentication_gate.dart
• lib/src/features/auth/data/native_google_sign_in.dart
• lib/src/features/auth/data/supabase_auth_repository.dart
• lib/src/features/auth/data/local_account_data_cleaner.dart
Local Persistence, Offline Work, and Sync
Drift provides local snapshots plus queued mutations. The sync coordinator orchestrates session/connectivity recovery, outgoing changes, remote refreshes, conflict preservation, and background/foreground scheduling. Supabase Realtime triggers cache invalidation across devices rather than treating local data as canonical.
• lib/src/core/database/app_database.dart
• lib/src/core/sync/sync_coordinator.dart
• lib/src/core/sync/supabase_sync_gateway.dart
• lib/src/core/sync/local_sync_store.dart
• lib/src/core/sync/background_sync_scheduler.dart
Supabase Cloud Platform
Supabase supplies Auth, Postgres with RLS, Realtime, private Storage, and server-side RPC/schema behavior. Versioned migrations define cloud schema evolution, synchronization protocol, maintenance completion, account deletion, notifications, and points monetization. Edge Functions isolate privileged account deletion and AdMob server-side-verification processing.
• supabase/migrations/20260628000100_create_homepilot_cloud_schema.sql
• supabase/migrations/20260629150852_enable_realtime_sync.sql
• supabase/migrations/20260728042000_enable_maintenance_completion_rpc.sql
• supabase/functions/delete-account/index.ts
• supabase/functions/admob-ssv-handler/index.ts
Device Services and Monetization
Services translate domain changes into local notifications/reminder reconciliation, permissions, feedback, backup/diagnostic export, weather, and health scoring. Monetization is represented as a feature and backed by Supabase points/reward schema plus native Android ad presentation.
• lib/src/core/services/reminder_schedule_reconciler.dart
• lib/src/core/services/notification_service.dart
• lib/src/features/monetization/monetization.dart
• android/app/src/main/kotlin/com/homepilot/app/HomePilotNativeAdFactory.kt
• supabase/migrations/20260801124625_create_points_rpc_and_reward_claims.sql
Configuration, Observability, and Delivery
Runtime configuration injects public Supabase, Google OAuth, and Sentry settings by environment; secure storage protects Supabase session material. Sentry is privacy-restricted through explicit bootstrap, event scrubbing, and tracing boundaries. GitHub Actions is the only supported signed production-build path; a separate static download site publishes releases.
• lib/src/core/config/app_config.dart
• lib/src/core/supabase/supabase_bootstrap.dart
• lib/src/core/observability/sentry_bootstrap.dart
• lib/src/core/observability/sentry_event_scrubber.dart
• .github/workflows/build-production-android.yml
• download-site/index.html
Main entry points: main.dart Flutter entry · 20260628000100_create_homepilot_cloud_schema.sql Supabase cloud · sync_coordinator.dart Sync coordinator · authentication_gate.dart Authentication gate
Components 20
Flutter App
- Flutter entry
lib/main.dart - Animated splash
lib/homepilot_animated_splash_screen.dart - Domain contracts · Models and repository contracts define the app vocabulary.
lib/src/core/domain/contracts.dart - UI foundation
lib/src/ui/app_theme.dart - Authentication gate · Controls access to the authenticated app shell.
lib/src/features/auth/presentation/authentication_gate.dart - Google + Supabase Auth
lib/src/features/auth/data/supabase_auth_repository.dart - Local account cleanup
lib/src/features/auth/data/local_account_data_cleaner.dart - Device services · Reconciles notifications and provides device-facing utilities.
lib/src/core/services/reminder_schedule_reconciler.dart - Monetization feature
lib/src/features/monetization/monetization.dart
Local Data & Sync
- Drift cache + queue · Authenticated snapshots and offline mutations.
lib/src/core/database/app_database.dart - Sync coordinator · Recovers sessions/connectivity and coordinates push, refresh, and conflicts.
lib/src/core/sync/sync_coordinator.dart - Supabase sync gateway
lib/src/core/sync/supabase_sync_gateway.dart - Background sync scheduler
lib/src/core/sync/background_sync_scheduler.dart
Supabase Platform
- Supabase bootstrap · Initializes configured Supabase client and secure session handling.
lib/src/core/supabase/supabase_bootstrap.dart - Supabase cloud · Authoritative data platform with RLS and RPCs.
supabase/migrations/20260628000100_create_homepilot_cloud_schema.sql - Privileged Edge Functions · Handles account deletion and AdMob server-side verification.
supabase/functions/delete-account/index.ts
Android & Device
- Android host + ads · Hosts Flutter and presents native ads.
android/app/src/main/kotlin/com/homepilot/app/MainActivity.kt
Delivery
- Sentry bootstrap
lib/src/core/observability/sentry_bootstrap.dart - Signed Android build · Only supported production build path.
.github/workflows/build-production-android.yml - Release download site
download-site/index.html
Connections 22
- Android host + ads → Flutter entry: hosts
- Flutter entry → Animated splash: starts with
- Flutter entry → Authentication gate: routes through
- Flutter entry → UI foundation: uses
- Flutter entry → Supabase bootstrap: initializes
- Authentication gate → Google + Supabase Auth: authenticates via
- Google + Supabase Auth → Supabase cloud: uses Auth
- Authentication gate → Local account cleanup: cleans local account data
- Domain contracts → Drift cache + queue: defines local data boundary
- Domain contracts → Sync coordinator: defines sync contracts
- Sync coordinator → Drift cache + queue: reads snapshots and queue
- Sync coordinator → Supabase sync gateway: pushes and refreshes
- Background sync scheduler → Sync coordinator: schedules
- Supabase sync gateway → Supabase cloud: syncs and subscribes to Realtime
- Supabase bootstrap → Supabase cloud: configures client
- Device services → Drift cache + queue: reconciles reminders from
- Monetization feature → Supabase cloud: uses points and reward RPCs
- Monetization feature → Android host + ads: uses native ad presentation
- Supabase cloud → Privileged Edge Functions: invokes privileged operations
- Flutter entry → Sentry bootstrap: reports through
- Signed Android build → Android host + ads: builds signed app
- Signed Android build → Release download site: publishes releases to