# ryantiger658/pipybaby architecture

> Architecture diagram of the GitHub repository ryantiger658/pipybaby, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ryantiger658/pipybaby
- Repository: https://github.com/ryantiger658/pipybaby

## Overview

##### Main Components

a. Hardware Layer:
- Raspberry Pi
- Pi Camera Module

b. Application Layer:
- Flask Web Server (implied by the project structure)
- Camera Controller (camera_pi.py)
- Main Application Logic (PiPyBaby.py)

c. Frontend Layer:
- Web Interface (templates/)
- Static Assets (static/)

d. Client Layer:
- Web Browsers
- Mobile Devices

**[Client Devices]**
- ↕
**[Web Interface Layer]**
- ↕
**[Application Layer]**
- ↕
**[Hardware Layer]**

##### Specific Component Details

For each major section, include these details:

a. Client Layer:
- Web browsers
- Mobile devices
- HTTP/WebSocket connections

b. Web Interface Layer:
- HTML templates (fullScreenVideo.html, index.html)
- Static assets (CSS/JS)
- Template inheritance from template.html

c. Application Layer:
- Flask application (PiPyBaby.py)
- Camera controller (camera_pi.py)
- Environment configuration (env.py)

d. Hardware Layer:
- Raspberry Pi
- Pi Camera Module
- Video stream flow

##### Important Flows to Highlight

- Video stream path from camera to client
- Web request handling
- Template rendering process
- Static asset serving

##### Additional Elements

- CI/CD integration (shown by presence of .travis.yml, .gitlab-ci.yml, .circleci/config.yml)
- Security considerations
- Monitoring points

##### Technical Details to Note

- WebSocket connections for real-time video streaming
- How the camera feed integrates with the web interface
- Where configuration happens (env.py)
- Where static assets are served from

- Real-time nature of the video streaming
- Web accessibility of the monitor
- Security considerations for baby monitoring
- Hardware-software integration points

Remember to:
- Use consistent notation
- Version information
- Document any assumptions

This system design should clearly show how a Raspberry Pi with a camera module can serve as a web-accessible baby monitor, with emphasis on the real-time video streaming capabilities and the web interface for monitoring.

## Diagram (Mermaid)

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'fontSize': '16px'}}}%%
flowchart TB
    subgraph Legend
        direction TB
        H1[Hardware Component]:::hardware
        S1[Software Component]:::software
        F1[Frontend Component]:::frontend
        C1[Client Component]:::client
        H1 --- S1 --> F1 --> C1
        style Legend fill:none,stroke-dasharray: 5 5
    end

    subgraph Client["Client Layer"]
        direction TB
        Browser[Web Browser]:::client
        Mobile[Mobile Device]:::client
    end

    subgraph Frontend["Frontend Layer"]
        direction TB
        Templates[Templates]:::frontend
        StaticAssets[Static Assets]:::frontend
        VideoInterface[Video Interface]:::frontend
    end

    subgraph Application["Application Layer"]
        direction TB
        WebServer[PiPyBaby Server]:::software
        CameraController[Camera Controller]:::software
        Config[Configuration]:::software
    end

    subgraph Hardware["Hardware Layer"]
        direction TB
        RaspberryPi[Raspberry Pi]:::hardware
        Camera[Pi Camera Module]:::hardware
        Network[Network Interface]:::hardware
    end

    Browser --> Templates
    Mobile --> Templates
    Browser --> StaticAssets
    Mobile --> StaticAssets
    Browser --> VideoInterface
    Mobile --> VideoInterface

    Templates --> WebServer
    StaticAssets --> WebServer
    VideoInterface --> WebServer
    WebServer --> CameraController
    CameraController --> Config
    
    CameraController --> Camera
    Camera --> RaspberryPi
    Network --> RaspberryPi

    %% Click events for component mapping
    click WebServer "https://github.com/ryantiger658/pipyBaby/blob/master/PiPyBaby.py"
    click CameraController "https://github.com/ryantiger658/pipyBaby/blob/master/camera_pi.py"
    click Config "https://github.com/ryantiger658/pipyBaby/blob/master/env.py"
    click Templates "https://github.com/ryantiger658/pipyBaby/tree/master/templates"
    click VideoInterface "https://github.com/ryantiger658/pipyBaby/blob/master/templates/fullScreenVideo.html"
    click StaticAssets "https://github.com/ryantiger658/pipyBaby/tree/master/static"

    %% Styling
    classDef hardware fill:#808080,stroke:#000,stroke-width:2px
    classDef software fill:#3498db,stroke:#000,stroke-width:2px
    classDef frontend fill:#2ecc71,stroke:#000,stroke-width:2px
    classDef client fill:#e67e22,stroke:#000,stroke-width:2px
```
