How mightasides0x/firestore_prototype_v1 works
Project Type and Purpose
• This is a cross-platform Flutter application (mobile + desktop + web) using Firebase (Firestore, Auth) as its back-end.
• It follows a “feature-based, clean architecture” pattern: each feature (auth, home, game, matchmaking, topic) has its own presentation (Cubit), domain (entities & repository interface), and data (repository implementation) layers.
Main Components
A. Client App (Flutter)
1. Presentation Layer (Blue)
– Feature UIs (Widgets / Screens)
• Auth Screens: LoginScreen, SignupScreen
• HomeScreen
• GameScreen
• Matchmaking Views
• Topic Views
– State Management
• Cubits (AuthCubit, HomeCubit, MatchmakingCubit, etc.)
2. Domain Layer (Green)
– Entities (Question, Topic, etc.)
– Repository Interfaces (e.g., AuthRepository, QuestionRepository)
3. Data Layer (Orange)
– Repository Implementations
• AuthRepositoryImpl
• QuestionRepositoryImpl
• MatchmakingRepositoryImpl
• TopicRepositoryImpl
– FirebaseOptions initialization (lib/firebase_options.dart)
B. External Services (Red)
– Firebase Auth
– Cloud Firestore
– (Optional) Other Firebase services (e.g., Cloud Functions, Storage)
Relationships and Data Flow
• UI Screen → Cubit (UI triggers events / actions)
• Domain Repo Interface → Data Repo Impl (implementation binding)
• Data Repo Impl → Firebase SDK (Firestore reads/writes, Auth calls)
• Firestore/Auth → App (responses flow back through adapters → Cubit → UI)
Architectural Patterns and Principles
– Layered (Clean) Architecture: separated Presentation / Domain / Data.
– Feature-first modularization: each feature is self-contained.
– BLoC/Cubit for state management.
– Dependency injection of repository interfaces (wired up in main.dart).
Putting It All Together
• Outer Boundary: “Flutter App”
• Inside:
[Presentation Layer – Blue]
AuthScreen → AuthCubit →
[Domain Layer – Green]
AuthRepository →
[Data Layer – Orange]
AuthRepositoryImpl → Firebase Auth
Repeat for Game, Matchmaking, Topic, Home
• External Side:
Firebase Auth, Cloud Firestore