How htsuruo/nippo works
Main Components
• Clients: Represent all the Flutter client applications (i.e., Android, iOS, macOS, and Web) as separate nodes or grouped under “Flutter Client.”
• Flutter Business Logic and Presentation: Within the Flutter app, include layers such as:
– UI/Widgets (organized under lib/common and lib/features)
– Navigation and Routing (lib/core/router)
– State Management / Providers (auth_provider, post_provider, user_provider)
– Domain-specific modules (posts, user, setting, sign-in)
• Firebase Backend:
– Authentication: Managed via Google Sign-In.
– Firestore Database: For storing day reports (日報) and user information.
– Cloud Functions: Contains server-side scripts (in firebase/functions) for business logic, extended functionalities, and admin operations.
– Firebase App Check & Security: Security rules in Firestore (firestore.rules) and API key restrictions.
– Firebase Hosting: Serves web content (from firebase/public).
• External Tools:
– FlutterFire CLI: Used for Firebase configuration.
– Other CI/CD integrations such as GitHub workflows (e.g., flutter.yml) and testing setups (e.g., rules tests under firebase/functions/src/test).
Relationships and Data Flow
• Interactions between the Flutter Business Logic components and the Firebase services (e.g., state changes trigger authentication calls, post submission calls Cloud Functions, and read/write to Firestore).
• Firebase App Check and Security Rules to the Cloud API endpoints to indicate that requests are validated and secured.
• Integration with Cloud Functions where specific triggers (like post creation or deletion) invoke server-side scripts.
Architectural Patterns & Principles
• Separation of Concerns: Clearly demarcate the client-side presentation (UI and state management) from business logic and backend services.
• Modular Design: Note that the lib folder is divided into features (post, user, sign-in, setting) which allows logical separation and potentially easier scalability.
• Security by Design: Emphasize that API requests are secured both at the client (via App Check) and at the database level (via detailed security rules).
Relevant Technologies, Frameworks, and Tools
• Flutter: The primary UI framework used for building the client apps.
• Firebase: Provides Authentication, Cloud Firestore, Cloud Functions, and App Check.
• GitHub Actions: For continuous integration/deployment (automated tests and builds).
• Flutterfire CLI: For Firebase integration and setup.
• The use of generated code (like .g.dart files) indicates code generation for models and providers.
Elements
– From Flutter client to Authentication (for login/sign-in).
– From Flutter client to Cloud Firestore (for retrieving and updating day reports).
– From Flutter client to Cloud Functions if any server-side processing is needed.
• Annotations or labels that indicate key functionalities (for example, “Google Sign-In,” “App Check Verification,” etc.).
Final Steps
• Sketch out the high-level flow first, ensuring every component is included.
• Keep the design both comprehensive (abstracted high-level view) and detailed enough so that other team members can quickly understand the overall architecture.