Developer Guide Overview
Architecture overview, tech stack, and navigation for BabyShopHub developers and contributors.
Developer Guide ️
This guide is for developers building, maintaining, and extending BabyShopHub. It covers every layer of the system — from the Flutter client architecture to Firebase configuration, Firestore schemas, service deep-dives, the email relay server, and deployment.
Architecture at a Glance
BabyShopHub follows a serverless, provider-driven architecture:
Quick Navigation
| Topic | Description |
|---|---|
| Local Setup | Install dependencies, configure Firebase, run locally |
| Project Structure | Directory layout and file responsibilities |
| Firebase Configuration | Auth, Firestore, firebase_options setup |
| Firestore Schema | All collections, fields, and subcollections |
| AuthProvider | Authentication state management deep-dive |
| ShopProvider | Cart, wishlist, checkout, stock management |
| Data Models | All Dart model classes with field docs |
| Screens | Every screen — purpose and key widgets |
| Admin Panel | Admin-only features and management tools |
| Email Relay Server | Node.js SMTP server setup and endpoints |
| Cloudinary | Image upload service configuration |
| Groq AI | AI chat integration, models, fallback |
| Theme System | ThemeProvider, presets, SharedPreferences |
| Security Rules | Firestore security rules explained |
| Deployment | Build and deploy to web, Android, iOS |
Core Dependencies
State Management Pattern
BabyShopHub uses Provider (ChangeNotifier) for global state. Three providers are injected at the root MultiProvider:
| Provider | Responsibility |
|---|---|
ThemeProvider | App theme, dark/light mode, color presets |
AuthProvider | User authentication, profile, addresses, notifications |
ShopProvider | Products, cart, wishlist, checkout, promo codes |
All providers extend ChangeNotifier and call notifyListeners() after any state mutation, which triggers reactive UI rebuilds.