# tangnguyendeveloper/smart_aeroponics architecture

> Architecture diagram of the GitHub repository tangnguyendeveloper/smart_aeroponics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tangnguyendeveloper/smart_aeroponics
- Repository: https://github.com/tangnguyendeveloper/smart_aeroponics

## Overview

##### Main components
- Aeroponics Controller Device: This directory contains the firmware for the aeroponics control unit written in C++ with PlatformIO (platformio.ini, src/main.cpp, and utilities files). It is the embedded device that reads sensors and likely controls actuators.
- LoRaGateway: This is a Go-based project providing the gateway functionality. It handles data communications over LoRa, with utility functions for handling LoRa protocol interactions, encryption/HMAC (hmac_shake256.go), and MQTT message handling. It is containerized (Dockerfile, docker-compose.yaml) for easier deployment.
- Daskboard: Contains JSON files (likely configurations or snapshots) for the control dashboard. This likely represents the client-side or admin interfaces used for monitoring and controlling the aeroponics system.
- TIGStack: Contains installation guides and docker-compose files, suggesting this part is used for deploying and managing the entire backend stack (it might include databases, brokers, web servers, etc.). This component integrates the gateway, dashboard, and possibly other services.

##### Relationships and interactions
- The Aeroponics Controller Device collects sensor data and controls the actual aeroponics hardware.
- This device communicates (via LoRa) with the LoRaGateway, which acts as a bridge between the field device and the network.
- The LoRaGateway processes messages, potentially wraps them with MQTT for distribution, and forwards data to the dashboard backend or cloud services.
- The dashboard (Daskboard) consumes and visualizes the data for monitoring and control.
- The TIGStack, deployed via Docker, likely orchestrates the overall system including the API or web application layers, databases, and brokers needed to support the communication and visualization infrastructure.

##### Architectural patterns & design principles
- Separation of concerns: Each module (device firmware, gateway service, dashboard, and backend stack) has its own clearly defined responsibilities.
- Microservices / containerization: With LoRaGateway and TIGStack components dockerized, the deployment is decoupled and scalable.
- IoT architecture: Emphasis on sensor data collection, wireless communication (LoRa), message brokering (MQTT), and user interface for system control.
- Modularity and layered design: Embedded firmware on devices, network gateway services, and a backend orchestration stack.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Physical Devices"
        ACD["Aeroponics Controller Device\n(PlatformIO/C++)"]:::hardware
    end

    subgraph "Communication Layer"
        LG["LoRa Gateway\n(Go, Docker)"]:::service
    end

    subgraph "Backend/Orchestration"
        TS["TIGStack\n(Docker-Compose)"]:::orchestration
        DB["Dashboard\n(JSON Config)"]:::frontend
    end

    ACD -->|"LoRa"| LG
    LG -->|"MQTT"| TS
    TS -->|"DataFlow"| DB

    click ACD "https://github.com/tangnguyendeveloper/smart_aeroponics/tree/main/Aeroponics_Controller_Device"
    click LG "https://github.com/tangnguyendeveloper/smart_aeroponics/tree/main/LoRaGateway"
    click DB "https://github.com/tangnguyendeveloper/smart_aeroponics/tree/main/Daskboard"
    click TS "https://github.com/tangnguyendeveloper/smart_aeroponics/tree/main/TIGStack"

    classDef hardware fill:#a3d5ff,stroke:#1a73e8,stroke-width:2px;
    classDef service fill:#c2f0c2,stroke:#34a853,stroke-width:2px;
    classDef orchestration fill:#ffe7a3,stroke:#fbbc04,stroke-width:2px;
    classDef frontend fill:#f8bbd0,stroke:#db3a34,stroke-width:2px;
```
