Project Structure

Complete directory layout and file responsibilities for the BabyShopHub codebase.

Project Structure

babyshophub/
├── .firebaserc                  # Firebase project alias binding
├── firebase.json                # Firebase hosting/emulator config
├── firestore.rules              # Firestore security rules
├── pubspec.yaml                 # Flutter dependencies & assets
├── pubspec.lock                 # Locked dependency versions
├── analysis_options.yaml        # Dart linter configuration
├── run.bat                      # Windows dev helper script

├── assets/                      # Static assets bundled with app
│   └── app_icon.png             # App launcher icon

├── server/                      # Node.js SMTP email relay
│   ├── index.js                 # Express server + Nodemailer
│   ├── package.json
│   └── node_modules/

├── lib/                         # Flutter application source
│   ├── main.dart                # Entry point; MultiProvider setup
│   ├── firebase_options.dart    # Auto-generated Firebase config
│   │
│   ├── theme/
│   │   └── theme_provider.dart  # ThemeProvider (dark/light/custom)
│   │
│   ├── models/                  # Pure Dart data classes
│   │   ├── cart.dart            # CartItem model
│   │   ├── product.dart         # Product + Review models + seed data
│   │   ├── order_model.dart     # OrderModel + snapshots + history
│   │   └── user.dart            # UserProfile + UserAddress + UserNotification
│   │
│   ├── services/                # Business logic & external API clients
│   │   ├── auth_provider.dart   # AuthProvider (Firebase Auth + TOTP + SMTP)
│   │   ├── shop_provider.dart   # ShopProvider (cart, wishlist, checkout)
│   │   ├── cloudinary_service.dart  # Image upload to Cloudinary
│   │   └── groq_service.dart    # Groq LLM API client with fallback
│   │
│   ├── widgets/                 # Reusable UI components
│   │   ├── product_card.dart    # Product grid card widget
│   │   ├── animated_loader.dart # Loading spinner animation
│   │   └── skeleton_loader.dart # Shimmer skeleton placeholders
│   │
│   └── screens/                 # Full-screen views (pages)
│       ├── splash_screen.dart       # Initial loading screen
│       ├── onboarding_screen.dart   # First-time user onboarding
│       ├── home_screen.dart         # Main product catalog
│       ├── product_details_screen.dart
│       ├── cart_screen.dart
│       ├── checkout_screen.dart
│       ├── order_history_screen.dart
│       ├── order_tracking_screen.dart
│       ├── wishlist_screen.dart
│       ├── profile_screen.dart
│       ├── saved_addresses_screen.dart
│       ├── chat_assistant_screen.dart
│       ├── admin_panel.dart         # Admin-only management panel
│       └── auth/
│           ├── welcome_screen.dart
│           ├── login_screen.dart
│           ├── register_screen.dart
│           ├── otp_screen.dart
│           └── forgot_password_screen.dart

├── android/                     # Android platform project
├── ios/                         # iOS platform project
├── web/                         # Web platform files (index.html, manifest)
├── linux/ macos/ windows/       # Desktop platform projects

└── docs/                        # Documentation
    ├── user/                    # Legacy HTML user docs
    ├── developer/               # Legacy HTML developer docs
    └── fumadocs/                # ← This Fumadocs Next.js site

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 updates
  • toMap() for Firestore serialization
  • fromMap() 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.

On this page