How coder-jon014/solidmeal_app works
Project type and purpose
• SolidMeal is a cross-platform mobile (Android, iOS, Web) Flutter application built with FlutterFlow.
• Purpose: help users with health conditions find personalized recipes using a client-side KNN algorithm plus external Spoonacular API data, storing user data in Firebase.
High-level file-structure observations
• Top-level “android”/“ios”/“web” folders host platform-specific boilerplate.
• “lib/” is the meat of the app:
• “lib/main.dart” and “lib/index.dart” launch the app
• “lib/flutter_flow/” contains UI scaffolding, theming, navigation, utilities
• “lib/components/”, “lib/custom_code/” and page folders (e.g., “startup_pages/”, “home/”, “recipe_pages/”) implement widgets + MVVM-style models (*_widget.dart + *_model.dart).
• “lib/auth/” handles authentication via Firebase Auth, JWT, Google, Apple, email, anonymous, etc.
• “lib/backend/” contains two subsections:
– “api_requests/” houses an ApiManager that calls the Spoonacular Recipe API
– “firebase/” + “firebase_storage/” + “schema/” define Firestore/Storage config and auto-generated record classes.
• “lib/custom_code/widgets/knn_recipe_comparison.dart” runs the KNN algorithm on recipe data.
Architectural patterns & tech stack (from README + code)
• Layered (presentation → view-model → service → data) resembling MVVM/Clean Architecture
• Flutter & FlutterFlow for UI
• State/models per page (generated by FlutterFlow)
• Service layer: AuthManager, ApiManager, FirebaseManager
• Data layer: Firestore collections + Firebase Storage
• External API: Spoonacular via RapidAPI (requires API_KEY in .env)
• Custom algorithm: KNN in Dart for recipe similarities
• NotificationService.swift for iOS push-notification image handling
• Flutter Widgets (screens & components)
• FlutterFlow navigation & theming
B. View-Model Layer (light blue)
• *_model.dart files hold state & trigger service calls
• AuthService (Firebase Auth via AuthManager)
• ApiService (Spoonacular API via ApiManager)
• FirebaseService (Firestore & Storage via Backend classes)
• KNN engine (custom_code widget)
• Firestore (users, recipes, notes, preferences collections)
• Firebase Storage (images, PDFs, other assets)
• Spoonacular Recipe & Nutrition API (RapidAPI)
• Android (Gradle, MainActivity.kt)
• iOS (AppDelegate.swift, NotificationService.swift)
1. User interacts with Flutter UI → calls ViewModel
2. ViewModel invokes Service Layer (AuthService / ApiService / FirebaseService)
3. Service Layer:
• AuthService ↔ Firebase Auth
• ApiService ↔ Spoonacular API
• FirebaseService ↔ Firestore & Storage
• KNN engine reads recipe data & user profile → returns recommendations
4. Data returns up the chain → ViewModel updates UI
Key architectural patterns & design principles
• Separation of concerns: UI vs. state vs. services vs. data
• Repository-style services encapsulate external dependencies
• Generated models ensure type safety for Firestore schema
• Dependency inversion: widgets depend on abstract managers, not direct API calls
• Single source of truth in ViewModels