Project Structure
Complete directory layout and file responsibilities for the BabyShopHub codebase.
Project Structure
Key Architectural Rules
lib/main.dart
Entry point only. Initializes Firebase, wraps the app in MultiProvider with ThemeProvider, AuthProvider, and ShopProvider, then launches BabyShopHubApp → SplashScreen.
lib/models/
Pure Dart data classes. No Flutter imports, no Provider imports. Only cloud_firestore for Timestamp conversions in order_model.dart. All models implement:
- Constructor with named required/optional parameters
copyWith()for immutable updatestoMap()for Firestore serializationfromMap()factory for Firestore deserialization
lib/services/
All business logic lives here. Services are ChangeNotifier subclasses (providers) or plain Dart classes (CloudinaryService, GroqService). They own API calls, Firestore writes, and state mutations.
lib/screens/
Screens are stateful or stateless Flutter widgets that consume providers via Provider.of<T>(context) or Consumer<T>. They contain no business logic — all actions are delegated to providers.
lib/widgets/
Reusable building blocks. Stateless where possible. Accept data via constructor parameters, not via direct provider access.