How maxonflutter/grocery-shopping-app-with-flutter-dart-frog works
Project type and purpose
• Full-stack mobile application
• Flutter front-end using BLoC for state management
• Dart Frog back-end providing RESTful endpoints
• Purpose: Grocery Shopping App (browse products/categories, manage cart, view orders)
File structure
• Front-end (root)
• lib/
– blocs/ (home, category, cart)
– screens/ (intro, login, home, cart, category, search, order)
– repositories/ (cart, category, product)
– services/api_client.dart
– navigation/app_router.dart
– widgets/ (UI components)
• assets/ (videos, images)
• android/, ios/ (platform projects)
• Back-end (api/)
• routes/ (categories, products, users, cart endpoints)
• packages/
– models (shared data models)
– cart_repository, category_repository, product_repository (domain logic)
• README.md, pubspec.yaml (Dart Frog setup)
• Config files: pubspec.yaml, analysis_options.yaml, .gitignore, platform-specific build files
Main components
• Front-end
• UI Screens (Flutter widgets)
• BLoC Layer (cart_bloc, category_bloc, home_bloc)
• Repository Layer (wrapping HTTP calls)
• ApiClient (HTTP client + JSON serialization)
• Navigation (app_router)
• Back-end
• HTTP Server (Dart Frog router & middleware)
• Route Handlers (controllers for each path)
• Domain Packages (repositories & models)
• External / Future
• Database (placeholder for future integration)
• Cloud Hosting (GCP deployment)
Relationships and data flow
• UI fires events → BLoC handles events → calls Repository → ApiClient sends HTTP request
• Dart Frog server receives request → Router routes to handler → handler invokes domain repository → constructs response using models → sends JSON back
• ApiClient parses JSON → Repository returns domain objects → BLoC emits new state → UI updates
• Future: domain repositories connect to an external database instead of in-memory or stub data
Architectural patterns and design principles
• Front-end: BLoC (unidirectional data flow, separation of concerns)
• Back-end: Modular monolith with Clean-style separation
• RESTful API design (resources under /categories, /products, /users/:id/cart)
• Shared model package ensures type safety across front-end and back-end