# adithyabollu/zotcount architecture

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

- Interactive diagram: https://gitdiagram.com/adithyabollu/zotcount
- Repository: https://github.com/adithyabollu/zotcount

## Overview

##### Project type and purpose
- From the file tree and README, we see two halves:
- A PlatformIO-based embedded firmware project (“PlatformIo-Project/CS147 Final Project”) written in C++ (src/main.cpp, include/, lib/) with tests under test/
- A simple static website (Website/src/index.html, index.js, styles.css)
- Given the name “ZotCount,” this is very likely an IoT/counting device (a microcontroller that counts events) plus a browser-based dashboard to view those counts.

##### File structure
- PlatformIo project
- platformio.ini – board, framework, build settings
- / – public headers and configuration
- lib/ – helper libraries or hardware-abstraction layers
- src/ – application entry (main.cpp)
- test/ – unit/integration tests
- Website
- index.html – markup
- index.js – fetches count data, updates UI
- styles.css – presentation

##### Key insights from the README
- Although extremely brief, the naming convention (“ZotCount”) implies the embedded firmware reads/counts sensor inputs or events; the static site visualizes the live count via network calls.

##### Main components
a. Hardware layer
- Microcontroller board (e.g., ESP32/ESP8266 or Arduino)
- Attached sensors or input circuit (count trigger)
b. Firmware layer
- PlatformIO build system
- Source code modules
– main application loop (src/main.cpp)
– Hardware-Abstraction Library (lib/)
– Public APIs / configuration (include/)
- Test harness (test/)
c. Network/API layer
- HTTP/REST server running on the microcontroller
- JSON payloads (“{ count: 123 }”)
d. Front-end layer
- Static web assets (HTML, JS, CSS)
- Browser as the client
e. (Optional) Hosting/Deployment
- GitHub Pages or local file server for the Website directory

##### Relationships and data flow
- The microcontroller firmware polls the sensor → maintains an internal counter
- It exposes an HTTP endpoint (e.g., GET /count) on its network interface
- The browser loads index.html → index.js periodically or via WebSocket polls the microcontroller’s endpoint → receives JSON → updates the UI

##### Architectural patterns and design principles
- Edge computing: device does counting and serves data directly
- Client-server: browser (client) ↔ microcontroller (server)
- Layered separation in firmware: hardware abstraction (lib/) → business logic (src/) → public API (include/)
- Single-page application (SPA) style front-end for real-time UI updates

##### Final checklist
– Include any third-party dependencies (Framework: Arduino/ESP-IDF under platformio.ini)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Hardware Layer"
        Sensor["Sensor / Input Circuit"]:::hardware
        MCU["Microcontroller Board"]:::hardware
    end

    Sensor --> MCU

    subgraph "Firmware Layer"
        subgraph "PlatformIO Build System"
            PI["platformio.ini"]:::build
        end
        subgraph "Source Code Modules"
            Lib["lib/ - HAL & Helper Modules"]:::code
            Include["include/ - Public APIs & Config"]:::code
            Main["src/main.cpp\n(Main Loop & HTTP Server)"]:::code
        end
        Test["test/ - Test Harness"]:::test
    end

    MCU --> PI
    MCU --> Lib
    MCU --> Include
    MCU --> Main
    MCU --> Test

    subgraph "Network / API Boundary"
        MCU -- "HTTP GET /count → JSON {count}" --> Browser
        Browser -- "Poll every 1s" --> MCU
    end

    subgraph "Front-end Layer"
        subgraph "Website Assets"
            HTML["index.html"]:::frontend
            JS["index.js"]:::frontend
            CSS["styles.css"]:::frontend
        end
        Browser["Browser Client"]:::frontend
    end

    HTML --> Browser
    JS --> Browser
    CSS --> Browser

    click PI "https://github.com/adithyabollu/zotcount/blob/main/PlatformIo-Project/CS147 Final Project/platformio.ini"
    click Main "https://github.com/adithyabollu/zotcount/blob/main/PlatformIo-Project/CS147 Final Project/src/main.cpp"
    click Lib "https://github.com/adithyabollu/zotcount/tree/main/PlatformIo-Project/CS147 Final Project/lib/"
    click Include "https://github.com/adithyabollu/zotcount/tree/main/PlatformIo-Project/CS147 Final Project/include/"
    click Test "https://github.com/adithyabollu/zotcount/tree/main/PlatformIo-Project/CS147 Final Project/test/"
    click HTML "https://github.com/adithyabollu/zotcount/blob/main/Website/src/index.html"
    click JS "https://github.com/adithyabollu/zotcount/blob/main/Website/src/index.js"
    click CSS "https://github.com/adithyabollu/zotcount/blob/main/Website/src/styles.css"

    classDef hardware fill:#CCE5FF,stroke:#0066CC;
    classDef build fill:#FFE0B2,stroke:#FF9800;
    classDef code fill:#E1F5FE,stroke:#03A9F4;
    classDef test fill:#F8BBD0,stroke:#E91E63;
    classDef frontend fill:#E8F5E9,stroke:#4CAF50;
    classDef network fill:none,stroke:#FF0000,stroke-dasharray: 5 5;
```
