How bizz84/starter_architecture_flutter_firebase works
Main Components
• Presentation Layer: Include modules for each major feature such as Authentication, Jobs, Entries, and Onboarding. Under each, note the corresponding screens/widgets (for example, Custom Sign In Screen, Jobs Screen, Entries Screen, etc.) and the “common_widgets” module.
• Application/State Management Layer: Indicate the presence of Riverpod providers, controllers/notifiers, and services (for example, entriesService, authProviders, and onboarding controllers). Highlight the autogenerated files (using Riverpod Generator) that integrate with business logic.
• Domain Layer: Note the models and business logic – such as AppUser, Job, Entry, and Job-related domain models – which encapsulate the state and rules of the application.
• Data Layer: Illustrate data repositories that manage communication with Firebase and Firestore (e.g., firebase_auth_repository, entries_repository, jobs_repository, onboarding_repository). These are the components responsible for data fetching, storage, and synchronization.
• External Services: Clearly show Firebase services including Firebase Auth (with support from Firebase UI Auth), Cloud Firestore, and Firebase UI for Firestore. Connect these to the Data Layer, indicating that they’re external resources with APIs that the repositories call.
Component Interactions
• The Flutter Client (UI Layer) invokes Riverpod providers and controllers when events occur (user interactions on Authentication, Jobs, Entries, or Onboarding screens).
• The Providers and application controllers then initiate calls to the repositories in the Data Layer.
• The Data Layer manages interactions with external Firebase services (Firebase Auth, Cloud Firestore) ensuring that data is read, written, and kept in sync across devices.
• The Routing component (utilizing GoRouter) directs navigation between different feature screens, while providing support for nested navigation flows.
• Additional utilities (like localization, common widgets, and shared preferences providers) serve ancillary roles, enhancing responsiveness and user experience.
Architectural Patterns
• Feature-first Modularization: Every feature (authentication, jobs, entries, onboarding) is structured with its own domain, application, and presentation submodules.
• Layered Architecture: Clearly separates UI (presentation), business logic (application/service/controllers), and data handling (repositories with Firebase integration).
• Dependency Injection and State Management are provided by Riverpod, where providers are injected into widgets and other controllers.
Relevant Technologies
• Flutter and its widget library as the base UI framework.
• Riverpod (and its generator/lint) for state management and dependency injection.
• GoRouter for navigation.
• Firebase Auth and Cloud Firestore (along with Firebase UI helpers) as backend services.
• Additional libraries like RxDart for reactive programming, Intl for formatting, and Equatable for model simplification are also part of the ecosystem.
Essential Architectural Elements
• Integration scripts/configurations for Android, iOS, macOS, and Web to indicate that the client is multi-platform—with a note that the Firebase configuration (google-services.json, GoogleService-Info.plist) connects these clients to the backend.
• Repository pattern used to hide the complexities of Firebase interactions behind well-defined interfaces.
Happy diagramming!