# superwofy/cicportal architecture

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

- Interactive diagram: https://gitdiagram.com/superwofy/cicportal
- Repository: https://github.com/superwofy/cicportal

## Overview

- Client Side / End Devices:
– BMW CIC Unit: The primary interface hardware that initiates provisioning, displays live news/weather, and delivers the user interface.
– Combox: The companion module handling provisioning fallback via XML files and running console-level commands.
– Bluetooth tethering connection: The wireless link that connects, for example, the infotainment unit to a mobile phone (or to the proxy server).

- Server Side:
– Web Server: A Debian-based web server running Lighttpd with PHP (PHP-FPM) that hosts the portal pages under the “Server root” directory. This component also includes assets (CSS, JavaScript, fonts, images), PHP scripts (e.g., for news, weather, search), and cache directories for dynamic and static content.
– Squid Proxy Server: Configured to work on port 8080, this acts as a basic authentication proxy. It handles caching for static assets (images, CSS, js) and provides an additional security layer to prevent open access on port 80.
– Provisioning Infrastructure: XML files (such as HIBackEnd_1.xml, dpas_003.xml) and related provisioning scripts and instructions that let the Combox/CIC update configurations and communicate with the server.

- External and Integrated Services:
– Additional Tools: Mention the existence of utility scripts (like those for image processing and file conversion) which support the creation of slideshow assets.

##### Relationships and interactions between these components
– Illustrate that the provisioning XML files flow from the USB drive (uploaded via FTP/SSH to the CIC) into the system, then get used by the provisioning tools (Tool32) and ultimately influence the behavior of the portal.
– Represent the local caching components within the server (the “cache” directories under Server root) and the role they play in speeding up asset delivery.

##### Architectural patterns/design principles
– Separation of concerns: Distinguish between the presentation layer (frontend assets served in HTML/CSS/JavaScript), the application logic (PHP scripts that process dynamic data and routing for various features), and the provisioning/configuration modules (XML files and associated binary components for the CIC/Combox).
– Modular structure: Based on the file tree, components are neatly separated into directories (Server root for web assets, Combox for hardware-specific logic, Documentation for manuals, etc.), emphasizing modularity.
– Proxy and caching: The integration of the Squid proxy highlights an architectural decision to secure and cache content, and this is an essential part of the data flow.

##### Relevant technologies/frameworks
– Server: Debian, Lighttpd, PHP 8.2 (with extensions like PHP-XML, PHP-curl, PHP-GD, and PHP-mbstring).
– Proxy: Squid Proxy Server (configured with basic authentication, caching settings, etc.).
– Client-side: Basic HTML, CSS, and JavaScript (with libraries like SimplePie in PHP to parse RSS feeds for news).
– Provisioning: Use of XML for configuration and provisioning, along with binary components for CIC/Combox operations.

##### Final advice
– Include annotations if necessary to explain parameters such as “DPAS_INDEX” and “CONFIG_INDEX” used in provisioning, and to note sensitive configuration aspects like the Squid authentication and the method by which the Combox logs in.
– Keep the visual design uncluttered while ensuring that every major element (provisioning, server modules, external interactions, client hardware) is represented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side Components
    subgraph "Client Side"
        CIC["BMW CIC Unit"]:::hardware
        Combox["Combox Module"]:::hardware
        Tether["Bluetooth Tethering"]:::hardware
    end

    %% Proxy Layer
    subgraph "Proxy Layer"
        Squid["Squid Proxy Server (Port 8080)"]:::proxy
    end

    %% Server Side Components
    subgraph "Server Side"
        WS["Web Server (Lighttpd/PHP)"]:::software
        Assets["Assets (Server root/assets)"]:::software
        Cache["Cache (Server root/cache)"]:::software
        Provision["Provisioning Script (provision.php)"]:::software
    end

    %% Provisioning Infrastructure
    subgraph "Provisioning Infrastructure"
        HI["Provisioning XML (HIBackEnd_1.xml)"]:::software
        DPAS["Provisioning XML (dpas_003.xml)"]:::software
    end

    %% External / Third-party Services
    subgraph "External/Third-party Services"
        APIs["External News/Weather APIs"]:::external
        SimplePie["SimplePie Library"]:::software
    end

    %% Data Flow Connections
    CIC -->|"request"| Squid
    Combox -->|"provisioningData"| Squid
    Tether -->|"tetheringLink"| Squid
    Squid -->|"routesTraffic"| WS
    WS -->|"servesAssets"| Assets
    WS -->|"servesCache"| Cache
    HI -->|"feedsProvisioning"| Provision
    DPAS -->|"feedsProvisioning"| Provision
    Provision -->|"updatesCombox"| Combox
    WS -->|"callsAPIs"| APIs
    WS -->|"utilizes"| SimplePie

    %% Click Events
    click CIC "https://github.com/superwofy/cicportal/blob/main/CIC/html object strings - from firmware.txt"
    click Combox "https://github.com/superwofy/cicportal/tree/main/Combox"
    click HI "https://github.com/superwofy/cicportal/blob/main/Combox/xml/HIBackEnd_1.xml"
    click DPAS "https://github.com/superwofy/cicportal/blob/main/Combox/xml/dpas_003.xml"
    click Provision "https://github.com/superwofy/cicportal/blob/main/Server root/provision.php"
    click WS "https://github.com/superwofy/cicportal/tree/main/Server root"
    click Assets "https://github.com/superwofy/cicportal/tree/main/Server root/assets"
    click Cache "https://github.com/superwofy/cicportal/tree/main/Server root/cache"
    click SimplePie "https://github.com/superwofy/cicportal/blob/main/Server root/assets/php/library/SimplePie.php"

    %% Styles
    classDef hardware fill:#a8e6cf,stroke:#05668d,stroke-width:2px;
    classDef software fill:#ffd3b6,stroke:#ff6f69,stroke-width:2px;
    classDef external fill:#ffaaa5,stroke:#ff5964,stroke-width:2px;
    classDef proxy fill:#fff5ba,stroke:#f6c45d,stroke-width:2px;
```
