How steven4383/better works
Purpose and Entry Points
“better” is a cross-platform Flutter habit, wellness, and social-challenge application. The Flutter runtime starts at lib/main.dart; platform hosts bootstrap it through android/app/src/main/kotlin/com/example/better/MainActivity.kt and ios/Runner/AppDelegate.swift. It targets Android, iOS, web, desktop Linux/macOS/Windows.
Application Composition and Navigation
The app is organized as GetX-style presentation, controller, and binding layers. Bindings construct and scope dependencies for app areas, while screens render authentication, onboarding, home, exploration, profile, and settings experiences. Core wiring is in lib/Binding/app_binding.dart, lib/Binding/auth_binding.dart, and lib/Binding/home_binding.dart; major user-facing routes/screens include lib/Pages/home_screen.dart, lib/Pages/onboarding_screen.dart, and lib/Pages/profile_screen.dart.
Authentication and User Lifecycle
Authentication is a primary control boundary: unauthenticated users move through login/recovery and onboarding/interest selection; authenticated users receive the main app experience. lib/controller/auth_controller.dart coordinates this state, using Firebase Authentication through lib/services/firebase_auth_service.dart. User identity, profile, interests, and preferences are represented by lib/model/user_model.dart, lib/model/interest_model.dart, and lib/model/user_preferences_model.dart.
Habit and Progress Domain
Habit creation, logs, daily completion, consistency, and momentum are the central product data flow. UI initiates changes from lib/Pages/habit_creation_dialog.dart and home surfaces; lib/controller/home_controller.dart manages display/state; models define persisted domain records in lib/model/habit_model.dart and lib/model/habit_log_model.dart. Progress-oriented UI components such as lib/Pages/habit_progress_card.dart and lib/widgets/consistency.dart consume this state.
Community, Discovery, and Challenges
Exploration and “for you” flows expose posts, challenges, and recommended/discoverable content. lib/controller/explore_controller.dart governs this area, surfaced by lib/Pages/exploration_screen_tabbed.dart and lib/Pages/for_you_screen.dart. Its principal entities are lib/model/post_model.dart and lib/model/challenge_model.dart, separating community content from personal habit data.
Firebase Persistence, Security, and Notifications
Firebase is the material backend boundary: Firebase Auth handles identity; Firestore stores application records via lib/services/firestore_service.dart; generated project configuration is lib/firebase_options.dart. Firestore authorization is enforced server-side in firestore.rules, with collection intent documented in FIRESTORE_COLLECTIONS_GUIDE.md. Push delivery and device-token lifecycle are handled by lib/services/fcm_service.dart and lib/services/enhanced_notification_service.dart; Android Firebase credentials are present at android/app/google-services.json.
Device and Platform Integration
The client integrates local/device capabilities for scheduled notifications and activity measurement through lib/services/notification_service.dart and lib/services/step_counter_service.dart. Native build/runtime configuration lives under android/app/build.gradle.kts, ios/Runner/Info.plist, and Flutter package dependencies are declared in pubspec.yaml. These adapters isolate platform services from controllers and UI.
Main entry points: home_controller.dart Home controller · auth_controller.dart Auth controller · firestore_service.dart Firestore service · app_binding.dart GetX bindings
Components 20
Flutter app
- Flutter entry
lib/main.dart - GetX bindings · Scopes controllers and services by app area.
lib/Binding/app_binding.dart - Auth binding
lib/Binding/auth_binding.dart - Home binding
lib/Binding/home_binding.dart - Auth controller · Controls login, recovery, onboarding, and authenticated access.
lib/controller/auth_controller.dart - Home controller · Manages habit display, completion, and progress state.
lib/controller/home_controller.dart - Explore controller
lib/controller/explore_controller.dart - App screens · Home, onboarding, and profile user experiences.
lib/Pages/home_screen.dart - Habit creation
lib/Pages/habit_creation_dialog.dart - Explore screens · Discovery and personalized content surfaces.
lib/Pages/exploration_screen_tabbed.dart - User models · Identity, interests, and preferences.
lib/model/user_model.dart - Habit models · Habit definitions and completion logs.
lib/model/habit_model.dart - Community models · Posts and challenges.
lib/model/post_model.dart
Firebase backend
- Firebase Auth service
lib/services/firebase_auth_service.dart - Firestore service
lib/services/firestore_service.dart - Firestore rules
firestore.rules
Platform integration
- Notification services · Manages FCM tokens, push delivery, and scheduled notifications.
lib/services/fcm_service.dart - Step counter service
lib/services/step_counter_service.dart - Android host
android/app/src/main/kotlin/com/example/better/MainActivity.kt - iOS host
ios/Runner/AppDelegate.swift
Connections 22
- Android host → Flutter entry: boots
- iOS host → Flutter entry: boots
- Flutter entry → GetX bindings: initializes
- GetX bindings → Auth binding: includes
- GetX bindings → Home binding: includes
- Auth binding → Auth controller: provides
- Home binding → Home controller: provides
- GetX bindings → Explore controller: provides
- App screens → Auth controller: drives auth flow
- App screens → Home controller: renders state
- Habit creation → Home controller: creates habits
- Explore screens → Explore controller: renders state
- Auth controller → Firebase Auth service: authenticates via
- Auth controller → User models: manages
- Home controller → Habit models: manages
- Explore controller → Community models: manages
- Auth controller → Firestore service: persists profile
- Home controller → Firestore service: persists habits and logs
- Explore controller → Firestore service: loads content
- Firestore rules → Firestore service: authorizes
- Notification services → Firestore service: stores device tokens
- Home controller → Step counter service: reads activity