# marta-dot/raspberry_mirror architecture

> Architecture diagram of the GitHub repository marta-dot/raspberry_mirror, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marta-dot/raspberry_mirror
- Repository: https://github.com/marta-dot/raspberry_mirror

## Overview

This repository implements a Raspberry Pi temperature/humidity monitor with an Angular dashboard. The backend samples a sensor, stores readings in SQLite, serves temperature/humidity data over HTTP, and periodically sends changing colors to a Bluetooth light. The dashboard bootstraps a shell containing a clock, photo slideshow, and sensor display. The sampled backend and component sources establish the shown runtime links; other frontend templates and the database schema are not inspected, so the graph avoids inferring additional behavior.

Main entry points: [`backend/app.py`](https://github.com/marta-dot/raspberry_mirror/blob/main/backend/app.py) (Flask API and sampler), [`frontend/src/app/app.component.ts`](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.component.ts) (Dashboard shell), [`frontend/src/main.ts`](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/main.ts) (Angular bootstrap), [`frontend/src/app/app.config.ts`](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.config.ts) (App configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Sensor backend"]
  node_backend_service["Flask API and sampler<br/>[app.py]"]
  node_readings_db[("SQLite readings")]
end

subgraph group_frontend["Dashboard"]
  node_bootstrap["Angular bootstrap<br/>[main.ts]"]
  node_app_config["App configuration<br/>[app.config.ts]"]
  node_routes["Router routes<br/>[app.routes.ts]"]
  node_app_shell["Dashboard shell<br/>[app.component.ts]"]
  node_temp_service["Temperature client"]
end

subgraph group_display["Dashboard features"]
  node_clock["Clock<br/>[clock.component.ts]"]
  node_gallery["Photo slideshow"]
  node_temp_display["Sensor display"]
end

subgraph group_hardware["Hardware adapters"]
  node_gpio_mock["GPIO fallback<br/>[fake_GPIO.py]"]
  node_dht_mock["DHT fallback"]
end

node_visitor(("Dashboard visitor"))
node_bluetooth_light["Bluetooth light"]

node_visitor -->|"views dashboard"| node_app_shell
node_bootstrap -->|"uses config"| node_app_config
node_bootstrap -->|"bootstraps"| node_app_shell
node_app_config -->|"provides routes"| node_routes
node_app_shell -->|"imports"| node_clock
node_app_shell -->|"imports"| node_gallery
node_app_shell -->|"imports"| node_temp_display
node_temp_display -->|"calls"| node_temp_service
node_temp_service -->|"requests temperature"| node_backend_service
node_backend_service -->|"writes and reads"| node_readings_db
node_backend_service -->|"imports fallback"| node_gpio_mock
node_backend_service -->|"imports fallback"| node_dht_mock
node_backend_service -->|"sends color"| node_bluetooth_light

click node_backend_service "https://github.com/marta-dot/raspberry_mirror/blob/main/backend/app.py"
click node_gpio_mock "https://github.com/marta-dot/raspberry_mirror/blob/main/backend/fake_GPIO.py"
click node_dht_mock "https://github.com/marta-dot/raspberry_mirror/blob/main/backend/fake_adafruit_dht.py"
click node_bootstrap "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/main.ts"
click node_app_config "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.config.ts"
click node_routes "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.routes.ts"
click node_app_shell "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.component.ts"
click node_clock "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/clock/clock.component.ts"
click node_gallery "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/gallery/gallery.component.ts"
click node_temp_display "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/temp-hum/temp-hum.component.ts"
click node_temp_service "https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/temp-hum/temp-hum.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_backend_service,node_readings_db toneBlue
class node_bootstrap,node_app_config,node_routes,node_app_shell,node_temp_service toneAmber
class node_clock,node_gallery,node_temp_display toneMint
class node_gpio_mock,node_dht_mock toneRose
class node_visitor,node_bluetooth_light toneIndigo
```

## Components

### Sensor backend

- [Flask API and sampler](https://github.com/marta-dot/raspberry_mirror/blob/main/backend/app.py): `backend/app.py`
- **SQLite readings**

### Dashboard

- [Angular bootstrap](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/main.ts): `frontend/src/main.ts`
- [App configuration](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.config.ts): `frontend/src/app/app.config.ts`
- [Router routes](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.routes.ts): `frontend/src/app/app.routes.ts`
- [Dashboard shell](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/app.component.ts): `frontend/src/app/app.component.ts`
- [Temperature client](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/temp-hum/temp-hum.service.ts): `frontend/src/app/temp-hum/temp-hum.service.ts`

### Dashboard features

- [Clock](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/clock/clock.component.ts): `frontend/src/app/clock/clock.component.ts`
- [Photo slideshow](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/gallery/gallery.component.ts): `frontend/src/app/gallery/gallery.component.ts`
- [Sensor display](https://github.com/marta-dot/raspberry_mirror/blob/main/frontend/src/app/temp-hum/temp-hum.component.ts): `frontend/src/app/temp-hum/temp-hum.component.ts`

### Hardware adapters

- [GPIO fallback](https://github.com/marta-dot/raspberry_mirror/blob/main/backend/fake_GPIO.py): `backend/fake_GPIO.py`
- [DHT fallback](https://github.com/marta-dot/raspberry_mirror/blob/main/backend/fake_adafruit_dht.py): `backend/fake_adafruit_dht.py`

### Other components

- **Dashboard visitor**
- **Bluetooth light**

## Connections

- Dashboard visitor → Dashboard shell: views dashboard
- Angular bootstrap → App configuration: uses config (evidence: `frontend/src/main.ts`)
- Angular bootstrap → Dashboard shell: bootstraps (evidence: `frontend/src/main.ts`)
- App configuration → Router routes: provides routes (evidence: `frontend/src/app/app.config.ts`)
- Dashboard shell → Clock: imports (evidence: `frontend/src/app/app.component.ts`)
- Dashboard shell → Photo slideshow: imports (evidence: `frontend/src/app/app.component.ts`)
- Dashboard shell → Sensor display: imports (evidence: `frontend/src/app/app.component.ts`)
- Sensor display → Temperature client: calls (evidence: `frontend/src/app/temp-hum/temp-hum.component.ts`)
- Temperature client → Flask API and sampler: requests temperature (evidence: `frontend/src/app/temp-hum/temp-hum.service.ts`)
- Flask API and sampler → SQLite readings: writes and reads (evidence: `backend/app.py`)
- Flask API and sampler → GPIO fallback: imports fallback (evidence: `backend/app.py`)
- Flask API and sampler → DHT fallback: imports fallback (evidence: `backend/app.py`)
- Flask API and sampler → Bluetooth light: sends color (evidence: `backend/app.py`)
