# ntp2706/vac-90 architecture

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

- Interactive diagram: https://gitdiagram.com/ntp2706/vac-90
- Repository: https://github.com/ntp2706/vac-90

## Overview

##### Main Components
- Hardware/IOT Layer:
- 32Page.ino and 8266Scan.ino: These Arduino sketches likely run on microcontrollers deployed in the field (either for reading sensors, scanning for vehicles, or controlling access mechanisms).
- Backend/Server Layer:
- server.js: A Node.js server that probably acts as the interface between the hardware data and the web frontend or potentially communicates with external services.
- Process Module: src/process.py appears to be responsible for processing the data collected from the hardware or received by the server.
- Frontend/Web Layer:
- src/index.html: Likely the primary landing page or dashboard for interacting with the system.
- src/result.html: A page where processed outputs—such as access results or status—are displayed.
- External/Configuration/Integration Components:
- code.gs: A Google Apps Script file that may be used for integration with a Google service (for example, logging access events in Google Sheets or sending alerts).
- xml/vn.conf and xml/vn.xml: Configuration files that might be used to manage settings for the system or define rules/policies for access control.

##### Relationships and Interactions
- The hardware layer (Arduino sketches) collects and transmits sensor or scan data.
- The data flows from the hardware devices to the Node.js server (server.js), which acts as a central mediator.
- The Node.js server may invoke the Python processing script (process.py) to analyze or transform the raw input before passing results onward.
- The processed data is then made available via web pages (index.html for input/interface and result.html for displaying outcomes).
- Additionally, code.gs is likely used for external integration with cloud-based services, ensuring that events or logs are synchronized or extended outside the core system.
- The xml folder holds configuration that might be loaded by various components (such as the Node.js server, Arduino sketches, or even the Python processor) to customize operational parameters.

##### Architectural Patterns & Design Principles
- Layered Architecture: The system is clearly divided into hardware (embedded code), server/processing (Node.js and Python), and presentation layers (HTML pages).
- Modularity: Each component (Arduino sketches, server, data processing, and configuration) is separated, making the system easier to maintain and extend.
- Integration & Interoperability: The inclusion of Google Apps Script (code.gs) and external configuration via XML files points to the design’s ability to integrate with external services and allow flexible configuration management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware/IOT Layer
    subgraph "Hardware/IOT Layer"
        H1["32Page.ino"]:::hardware
        H2["8266Scan.ino"]:::hardware
    end

    %% Backend/Server Layer
    subgraph "Backend/Server Layer"
        S["server.js"]:::backend
    end

    %% Processing Module
    subgraph "Processing Module"
        P["Python Processing (src/process.py)"]:::processing
    end

    %% Frontend/Web Layer
    subgraph "Frontend/Web Layer"
        F1["Dashboard (index.html)"]:::frontend
        F2["Results Display (result.html)"]:::frontend
    end

    %% External Integration/Configuration
    subgraph "External Integration/Configuration"
        G["Google Apps Script (code.gs)"]:::external
        X1["Config File (vn.conf)"]:::config
        X2["Config File (vn.xml)"]:::config
    end

    %% Data Flow Connections
    H1 -->|"VehicleScanData"| S
    H2 -->|"VehicleScanData"| S
    S -->|"Process&Validate"| P
    P -->|"ProcessedData"| F2
    S -->|"WebInterface"| F1
    S -->|"Integration"| G
    S -->|"LoadConfig"| X1
    S -->|"LoadConfig"| X2

    %% Click Events
    click H1 "https://github.com/ntp2706/vac-90/blob/master/32Page.ino"
    click H2 "https://github.com/ntp2706/vac-90/blob/master/8266Scan.ino"
    click S "https://github.com/ntp2706/vac-90/blob/master/server.js"
    click P "https://github.com/ntp2706/vac-90/blob/master/src/process.py"
    click F1 "https://github.com/ntp2706/vac-90/blob/master/src/index.html"
    click F2 "https://github.com/ntp2706/vac-90/blob/master/src/result.html"
    click G "https://github.com/ntp2706/vac-90/blob/master/code.gs"
    click X1 "https://github.com/ntp2706/vac-90/blob/master/xml/vn.conf"
    click X2 "https://github.com/ntp2706/vac-90/blob/master/xml/vn.xml"

    %% Styles
    classDef hardware fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef backend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef processing fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef frontend fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef config fill:#F5DEB3,stroke:#333,stroke-width:2px;
```
