# fmomoreira/integracao-litnet2-actuar architecture

> Architecture diagram of the GitHub repository fmomoreira/integracao-litnet2-actuar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fmomoreira/integracao-litnet2-actuar
- Repository: https://github.com/fmomoreira/integracao-litnet2-actuar

## Overview

##### Project type and purpose
- This is a desktop application built with Electron and Node.js, serving as an MVP for integrating with LiteNet2 turnstiles over TCP/IP.
- It provides a UI for user management (registration, biometrics), real-time event logging, and access control commands to the device.

##### File structure
- Top-level files only:
- index.html – the Renderer (UI) page
- main_tcp.js – Node.js module for TCP/IP communication
- package.json/lock – dependency and build configuration
- README/MS‐docs – documentation
- No separate “src” or “lib” folders, so both UI and business logic co-exist in the root.
- Electron’s Main Process is implied by package.json “main” entry (likely main_tcp.js or a small bootstrap script not shown).

##### Key insights from README
- Electron renderer (HTML/CSS/JS) implements modern UI.
- main_tcp.js encapsulates all TCP/IP messaging to the LiteNet2 device, using a simple packet format.
- Local persistence is required (“Persistência local de dados”)—likely via JSON or a lightweight embedded DB.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Electron Renderer Process"
        UI["UI (index.html)"]:::ui
        UM["User Management Screen"]:::ui
        Bio["Biometry Screen"]:::ui
        Log["Event Log Screen"]:::ui
        Settings["Connection Settings Screen"]:::ui
    end

    subgraph "Electron Main Process"
        Main["Main Process"]:::backend
        TCP["TCP Module (main_tcp.js)"]:::backend
        DB[(Local Storage)]:::db
        Config["Project Config (package.json)"]:::config
    end

    Device["LiteNet2 Turnstile Device"]:::external

    UI -->|"user actions"| Main
    Main -->|"forward commands"| TCP
    TCP -->|"TCP/IP packets"| Device
    Device -->|"events & responses"| TCP
    TCP -->|"deliver status and events"| Main
    Main -->|"push UI updates"| UI
    Main -->|"write data"| DB

    click UI "https://github.com/fmomoreira/integracao-litnet2-actuar/blob/main/index.html"
    click Main "https://github.com/fmomoreira/integracao-litnet2-actuar/blob/main/main_tcp.js"
    click TCP "https://github.com/fmomoreira/integracao-litnet2-actuar/blob/main/main_tcp.js"
    click Config "https://github.com/fmomoreira/integracao-litnet2-actuar/blob/main/package.json"

    classDef ui fill:#add8e6,stroke:#000,stroke-width:1px
    classDef backend fill:#98fb98,stroke:#000,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef db fill:#ffe4b5,stroke:#000,stroke-width:1px
    classDef config fill:#fafad2,stroke:#000,stroke-width:1px
```
