# thanhchuc207/baby-watch-iot architecture

> Architecture diagram of the GitHub repository thanhchuc207/baby-watch-iot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thanhchuc207/baby-watch-iot
- Repository: https://github.com/thanhchuc207/baby-watch-iot

## Overview

##### Main System Components

a) Client Layer (Mobile Application)
- UI Modules (auth, home, media, videos, user profile)
- State Management (Bloc/Cubit pattern)
- Core Services
- Shared Components

b) Backend Services Layer
- Firebase Services (indicated by firebase.json)
- Authentication Service
- Storage Service (for video/audio)
- Notification Service

c) IoT Device Layer
- Baby Monitor Hardware
- Video/Audio Streaming
- Sensor Data Collection

##### Component Relationships

a) Mobile App Internal Structure:
- Module organization:
- Auth Module → User Management
- Home Module → Main Dashboard
- Media Module → Media Management
- Video Module → Video Streaming
- Profile Module → User Settings

- IoT Device → Backend Services (video/audio streams)
- Backend Services → Mobile App (notifications, data)
- Mobile App → Backend Services (user commands, settings)

##### Architectural Patterns

Patterns with appropriate symbols:

a) BLoC Pattern Implementation:
- State management flow
- Event/State propagation
- Repository pattern integration

b) Service Layer:
- API Services
- Repository Layer
- Local Storage

##### Technical Details

Create sections showing:

a) Client-Side Features:
- Internationalization (i18n)
- Theme Management
- Local Storage
- Video Player Controls
- Push Notifications

b) Authentication Flow:
- Sign In/Sign Up
- Profile Management
- Session Management

##### Additional Elements

Supporting components:
- Version information
- Security layers
- Error handling flow
- Caching mechanisms

##### Specific Implementation Notes

Specialized features:
- Video streaming architecture
- Real-time notification system
- Calendar integration
- Audio monitoring system
- Storage management

- Component interaction
- Data flow
- Security boundaries
- Scalability points
- Integration points with IoT devices

Remember to include a clear indication of:
- System boundaries
- External service dependencies
- User interaction flows
- Error handling paths
- Monitoring and logging points

This will provide a comprehensive view of the IoT Baby Watch system while maintaining clarity and usefulness for development and maintenance purposes.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        UI[Mobile Application UI]
        
        subgraph Modules
            direction TB
            Auth["Authentication Module"]:::module
            Home["Home Dashboard"]:::module
            Media["Media Management"]:::module
            Video["Video Streaming"]:::module
            Profile["User Profile"]:::module
            Theme["Theme Management"]:::module
            Main["Main Container"]:::module
        end
        
        subgraph Core
            direction TB
            Router["Routing System"]:::core
            I18n["Internationalization"]:::core
            NotifService["Notification Service"]:::core
            DI["Dependency Injection"]:::core
            Assets["Assets Management"]:::core
        end
        
        subgraph Data
            direction TB
            API["API Services"]:::data
            LocalStore["Local Storage"]:::data
            Models["Data Models"]:::data
            AuthRepo["Authentication Repository"]:::data
            Constants["API Constants"]:::data
        end
        
        subgraph Common
            direction TB
            StateManagement["State Management (BLoC)"]:::common
            Shared["Shared Components"]:::common
        end
    end
    
    subgraph Backend
        direction TB
        Firebase["Firebase Services"]:::backend
        AuthService["Authentication Service"]:::backend
        StorageService["Storage Service"]:::backend
        NotificationBackend["Notification Backend"]:::backend
    end
    
    subgraph IoT
        direction TB
        Monitor["Baby Monitor Hardware"]:::iot
        Stream["Video/Audio Streaming"]:::iot
        Sensors["Sensor Data Collection"]:::iot
    end
    
    %% Connections
    Monitor --> Stream
    Stream --> StorageService
    Sensors --> NotificationBackend
    
    Firebase --> UI
    AuthService --> Auth
    StorageService --> Media
    NotificationBackend --> NotifService
    
    %% Click Events
    click Auth "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/module/auth"
    click Home "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/module/home"
    click Media "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/module/media"
    click Video "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/module/videos"
    click Profile "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/module/user/profile"
    click Firebase "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/firebase_options.dart"
    click API "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/data/remote/api"
    click LocalStore "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/data/local/storage.dart"
    click AuthRepo "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/data/repository/auth_repository.dart"
    click NotifService "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/core/app/notification_service.dart"
    click Router "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/core/app/app_router.dart"
    click I18n "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/core/language"
    click Theme "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/module/switch_theme"
    click Shared "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/shared/widgets"
    click Models "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/data/model"
    click StateManagement "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/common/bloc"
    click Constants "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/common/constants/api_constants.dart"
    click DI "https://github.com/thanhchuc207/Baby-Watch-IoT/tree/main/lib/core/locators/di"
    click Main "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/module/main_containter/main_screen.dart"
    click Assets "https://github.com/thanhchuc207/Baby-Watch-IoT/blob/main/lib/generated/assets.gen.dart"

    %% Styling
    classDef module fill:#2196F3,stroke:#1976D2,color:white
    classDef core fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef data fill:#4CAF50,stroke:#388E3C,color:white
    classDef common fill:#FF9800,stroke:#F57C00,color:white
    classDef backend fill:#607D8B,stroke:#455A64,color:white
    classDef iot fill:#E91E63,stroke:#C2185B,color:white
```
