How mitchkoko/moonbase-template works
Project type and purpose
• This is a cross-platform Flutter social media template (“Moonbase”) supporting Android, iOS, Web, Windows, macOS, and Linux.
• It implements authentication (email, Google, Apple via Firebase Auth), a Firestore-backed posts/comments feed, content moderation, user blocking, and subscription monetization via RevenueCat.
• It follows a Clean Architecture / BLoC (Cubit) pattern, with distinct domain, data, and presentation layers.
File structure
• Top-level directories for each target platform (android, ios, web, windows, macos, linux) plus the core Dart code under lib/.
• Under lib/features/... each feature is organized into three sub-folders:
• data: concrete Firebase or RevenueCat implementations
• domain: pure entities and repository interfaces
• presentation: UI Widgets, Cubits, and Pages
• A global lib/themes/, lib/components/, and main.dart for app entry and theming.
• Config files: pubspec.yaml, Firebase initialization in main.dart, and build scripts in each platform folder.
README for additional insights
• Tech stack: Flutter/Dart, Firebase Auth & Firestore, RevenueCat.
• Architectural pattern: Clean Architecture + BLoC with Cubits.
• Usage: follow instructions to set up Firebase, run flutter pub get, then flutter run.
Components
a. Main components
• Frontend (Flutter UI)
• State Management (BLoC/Cubit layer)
• Domain Layer (Entities & Repository Interfaces)
• Data Layer (Firebase Services & RevenueCat Service)
• External Services (Firebase Auth, Firestore, RevenueCat, Google Sign-In, Apple Sign-In)
• Platforms (Android, iOS, Web, Desktop)
b. Relationships and interactions
• UI widgets dispatch events to Cubits.
• Cubits call domain-level repository interfaces.
• Data layer implements those interfaces, talking to Firebase or RevenueCat SDKs.
• External services persist and retrieve data (e.g., Firestore reads/writes posts/comments).
• RevenueCat handles subscription purchases and provides offerings data.
c. Architectural patterns and principles
• Clean Architecture layered separation (Presentation → Domain → Data → External).
• Dependency inversion: presentation depends on domain interfaces; data layer depends on those interfaces.
• BLoC/Cubit for unidirectional data flow.
• Repository pattern to abstract external APIs.
d. Key technologies and libraries
• Flutter framework (Widgets, runApp)
• flutter_bloc / Cubit for state management
• firebase_auth, cloud_firestore for backend
• revenuecat_flutter (or custom service wrapper)
• google_sign_in, sign_in_with_apple