How chika0221/sweep works
Project Type & Purpose
• Full-stack, cross-platform mobile app (Flutter) with serverless backend (Firebase) and an IoT device (SwapBox).
High-Level File Structure Analysis
• Top-level “android”, “ios”, “web”, “linux”, “macos”, “windows” folders: Flutter build targets.
• “lib/”: Dart source—UI pages, state‐management, data models, scripts.
• “functions/”: Firebase Cloud Functions (Node.js) for server‐side logic (notifications, scheduled tasks).
• “pubspec.yaml”/“flutter_launcher_icons.yaml”: project config & resource definitions.
Architecture Insights from README
• Clients: Mobile app “Sweep” & separate PC-web “Sweep-Host” (external repo).
• Backend: Firebase for Auth, Firestore, Storage, Cloud Messaging.
• IoT: SwapBox prototypes (M5Stack + HX711 sensor + QR scanner) push data to Firebase.
Main Components & Their Relationships
1. Mobile Client (Flutter)
– UI Layers (lib/pages, lib/widgets)
– State Providers (lib/states) subscribing to Firestore & FCM
– Local scripts (lib/scripts) invoking Cloud Functions via HTTPS
2. Firebase Services
– Authentication (Google/Apple OAuth)
– Firestore (collections: posts, users, achievements, trashboxes)
– Storage (images uploaded with posts)
– Cloud Functions (functions/index.js):
• Data‐validation, point logic, notifications, scheduled updates
– FCM (push notifications)
3. IoT Device (SwapBox)
– Hardware: M5Stack + HX711 + QR scanner
– Firmware pushes:
• Sensor data (weight) + QR scan → Firestore via Firebase REST/SDK
4. External Services
– Google Maps API (map tiles, geocoding)
– Apple/Google OAuth endpoints
5. (Optional) PC-Web Host App
– Reads Firestore data, presents analytics/heatmap (external repo)
Architectural Patterns & Design Principles
• Client–Server (thin client, serverless backend)
• Pub/Sub (Firestore triggers → Cloud Functions → FCM)
• MVVM-style state management in Flutter (Providers/Notifiers)
• Microservices‐style (each Cloud Function is a discrete endpoint)
• Cross-platform code reuse