How codingwithtea/cwt_starter_template works
Project Type and Purpose
• This is a full‐stack, cross‐platform Flutter starter template (“cwt_starter_template”) that targets Android, iOS and Web.
• It uses GetX for state management and routing, Firebase for backend services (Authentication, Firestore, Storage) and Cloud Functions for server‐side logic (e.g., notifications).
High‐Level Components
a. Frontend (Flutter App)
• Platforms: Android (android/…), iOS (ios/…), Web (web/…)
• Entry point: lib/main.dart → GetMaterialApp
• Presentation Layer:
• UI Screens (lib/features/…/screens)
• GetX Controllers (lib/features/…/controllers, lib/personalization/controllers)
• Routes (lib/routes/*.dart)
• Shared Widgets & Themes: lib/common/widgets, lib/utils/theme, lib/utils/constants
b. Domain & Data Layer (lib/data)
• Abstract Repositories (base_repository.dart)
• Concrete Repositories: Authentication, User, Notification (lib/data/repository/…)
• Services & Models: NotificationService, notification_model.dart
c. Utilities
• HTTP Client (lib/utils/http/http_client.dart)
• Local Storage (lib/utils/local_storage/storage_utility.dart)
• Cloud Helpers & Formatters (lib/utils/helpers, lib/utils/formatters)
• Exception Handling & Logging (lib/utils/exceptions, lib/utils/logging)
d. Backend (Firebase)
• Firebase SDK config: firebase_options.dart, firebase.json, .firebaserc
• Cloud Functions: functions/index.js, functions/notifications/*.js
e. External Services
• Firebase Auth, Firestore, Cloud Storage, Cloud Functions
Relationships & Data Flow
1. User interacts with UI Screens → triggers GetX Controller methods.
2. Controller calls Repository abstract interface → concrete repository implementation.
3. Repository delegates calls to:
• Firebase SDK (Auth, Firestore)
• HTTP Client or Cloud Functions endpoints (via callable functions or REST)
• Local Storage Utility (caching, tokens)
4. Firebase triggers Cloud Functions (e.g., on data writes) → functions send push notifications.
5. Repository receives data, transforms via Models → Controller updates Observables → UI updates.
Architectural Patterns & Principles
• Layered architecture: Presentation (UI/Controllers), Domain (Repositories, Models), Infrastructure (Firebase, HTTP, Local Storage).
• Dependency Injection and Lazy Loading via GetX Bindings (lib/bindings/…).
• Feature‐based modularization: each feature has its own controllers, models, screens.
• Clear separation of concerns: UI vs. state vs. data access.