# ab623/goeero architecture

> Architecture diagram of the GitHub repository ab623/goeero, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ab623/goeero
- Repository: https://github.com/ab623/goeero

## Overview

##### Main Components
- Client Layer (CLI Application)
- Library Layer (Eero Package)
- External Service Layer (Eero API Service)

##### Component Details

a. Client Layer (Top):
- Main command interfaces: auth, account, devices, networks, and session
- Session file storage component (eero_session.txt)

b. Library Layer (Middle):
- eero.go (core functionality)
- types.go (data structures)
- This should be shown as the intermediary between the CLI and External Service

c. External Service Layer (Bottom):
- Eero API Service
- Authentication endpoints (Phone/OTP flow)
- Data endpoints (account, devices, networks)

##### Flow Representations

- CLI → Library (Method calls)
- Library → External Service (API calls)
- External Service → Library (Response data)
- Library → CLI (Processed data)
- CLI → File System (Session storage)

- User Input → CLI → Library → Eero API
- ↓
- Session Storage

- CLI Request → Library → Eero API
- ↓
- JSON Output

##### Important Elements

- Session token flow and storage
- JSON as the primary data format for responses
- Authentication flow as a two-step process
- Main public methods from the library
- Error handling paths

##### Technical Details to Note

- Go as the implementation language
- Module dependency structure
- File system interaction points
- HTTP/REST communication with the Eero API

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        CLI["CLI Application"]:::cli
        CMD_AUTH["Auth Command"]:::cli
        CMD_ACC["Account Command"]:::cli
        CMD_DEV["Devices Command"]:::cli
        CMD_NET["Networks Command"]:::cli
        CMD_SES["Session Command"]:::cli
        SESS_FILE["Session Storage<br/>(eero_session.txt)"]:::storage
    end

    subgraph Library
        EERO["Core Library"]:::lib
        TYPES["Data Types"]:::lib
    end

    subgraph "External Service"
        API["Eero API Service"]:::external
        AUTH_EP["Authentication<br/>Endpoints"]:::external
        DATA_EP["Data<br/>Endpoints"]:::external
    end

    subgraph "Infrastructure"
        CICD["CI/CD Pipeline"]:::infra
        CONFIG["Project Config"]:::infra
    end

    %% CLI Layer Connections
    CLI --> CMD_AUTH
    CLI --> CMD_ACC
    CLI --> CMD_DEV
    CLI --> CMD_NET
    CLI --> CMD_SES
    CMD_AUTH --> SESS_FILE
    CMD_SES --> SESS_FILE

    %% Library Connections
    CMD_AUTH --> EERO
    CMD_ACC --> EERO
    CMD_DEV --> EERO
    CMD_NET --> EERO
    CMD_SES --> EERO
    EERO --> TYPES

    %% External Service Connections
    EERO --> AUTH_EP
    EERO --> DATA_EP
    AUTH_EP --> API
    DATA_EP --> API

    %% Style Definitions
    classDef cli fill:#3498db,stroke:#2980b9,color:white
    classDef lib fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef infra fill:#e74c3c,stroke:#c0392b,color:white

    %% Click Events
    click CLI "https://github.com/ab623/goeero/blob/main/cli/eeroclient/main.go"
    click EERO "https://github.com/ab623/goeero/blob/main/eero/eero.go"
    click TYPES "https://github.com/ab623/goeero/blob/main/eero/types.go"
    click CICD "https://github.com/ab623/goeero/blob/main/.github/workflows/release.yml"
    click CONFIG "https://github.com/ab623/goeero/blob/main/go.mod"

    %% Legend
    subgraph Legend
        L1["CLI Components"]:::cli
        L2["Library Components"]:::lib
        L3["External Services"]:::external
        L4["Storage"]:::storage
        L5["Infrastructure"]:::infra
    end
```
