# aras-digital/adx-barcodes architecture

> Architecture diagram of the GitHub repository aras-digital/adx-barcodes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aras-digital/adx-barcodes
- Repository: https://github.com/aras-digital/adx-barcodes

## Overview

##### Project type and purpose
- This is a static, client-side barcode-scanning web application (“Adx Barcodes”) delivered via GitHub Pages.
- It bundles three scanning engines—ZBar (via WebAssembly), Quagga-JS, and ZXing-JS—for demo and test purposes.

##### File structure
- Top-level:
- index.html – a landing page (likely links to demos)
- test.html – a page for manual integration testing
- drgfactory/ – custom demo or integration (HTML only)
- quagga-js/, zxing-js/, zbar-wasm/ – each contains an index.html plus associated JS/WASM or dist artifacts
- zbar-wasm/dist – the compiled WASM binary plus JS wrappers (commonjs & ES modules, inlined variants)
- .github/workflows/static.yml – CI/deployment script (push → GitHub Pages)

##### Key insights from README
- Embeds barcode‐scanners in iframes or directly in page
- Parent ⇄ iframe communication via postMessage
- Hosted at https://aras-digital.github.io/adx-barcodes/

A. Browser Client
- Parent page (index.html/test.html)
- Optional iframe(s) pointing at quagga-js/index.html, zxing-js/index.html, zbar-wasm/index.html
B. Scanning Engines (all client-side)
- Quagga-JS (pure JS)
- ZXing-JS (pure JS module)
- ZBar-WASM (WASM binary + JS glue code)
C. Video Input
- User’s camera via Web APIs (getUserMedia)
D. Data Flow & Messaging
- Camera → Scanner engine → decoded payload → UI or postMessage to parent
E. Deployment Pipeline
- GitHub Actions → GitHub Pages hosting

##### Relationships and interactions
- The Browser Client loads a page; it requests camera access.
- The page loads a specific scanner library (Quagga/ZXing/ZBar).
- Scanner JavaScript/WASM processes video frames, returns decoded barcodes.
- The page displays results or posts messages back to parent (in iframe use-case).
- GitHub Actions CI pushes updated static files to the gh-pages branch.

##### Architectural patterns & design principles
- Modular, pluggable engines: each scanner lives in its own folder with self-contained HTML/JS
- Clear separation: UI (HTML/CSS), scanner logic (JS/WASM), hosting pipeline (CI config)
- Client-only architecture: no server component—fully static site

##### Essential elements
- Clear, unique labels on each node (e.g., “zbar-wasm/dist/zbar.wasm”)
- Deployment path: GitHub Actions → branch → Pages site

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser Client Container
    subgraph "Browser Client"
        direction TB
        Index["index.html"]:::html
        Test["test.html"]:::html
        DRG["drgfactory/index.html"]:::html

        %% Iframe demos
        subgraph "Scanner Demos (iframes)"
            direction TB
            IQ["quagga-js/index.html"]:::html
            IZ["zxing-js/index.html"]:::html
            IZB["zbar-wasm/index.html"]:::html
        end
    end

    %% Video Input and Stream
    VideoInput["getUserMedia Video Input"]:::api
    VideoStream["Video Stream"]:::stream

    %% Scanner Engines
    subgraph "Quagga-JS Engine"
        direction TB
        QuaggaIndex["quagga-js/index.html"]:::html
        QuaggaReadme["quagga-js/readme.md"]:::doc
    end
    subgraph "ZXing-JS Engine"
        direction TB
        ZXingIndex["zxing-js/index.html"]:::html
    end
    subgraph "ZBar-WASM Engine"
        direction TB
        ZbarIndex["zbar-wasm/index.html"]:::html
        subgraph "dist"
            direction TB
            ZWASM["zbar-wasm/dist/zbar.wasm"]:::wasm
            ZIndexJS["zbar-wasm/dist/index.js"]:::js
        end
        subgraph "js"
            direction TB
            ZApp["zbar-wasm/js/app.js"]:::js
            ZScanner["zbar-wasm/js/scanner.js"]:::js
            ZUtils["zbar-wasm/js/utils.js"]:::js
            ZMain["zbar-wasm/js/main.js"]:::js
        end
    end

    %% UI Result
    UIResult["UI Result"]:::html

    %% CI/CD Pipeline
    subgraph "Deployment Pipeline"
        direction TB
        Actions[".github/workflows/static.yml<br/>GitHub Actions CI"]:::ci
        Pages["GitHub Pages Hosting"]:::ci
    end

    %% Connections - Video Flow
    Index --> VideoInput
    Test --> VideoInput
    VideoInput --> VideoStream

    VideoStream --> QuaggaIndex
    VideoStream --> ZXingIndex
    VideoStream --> ZWASM

    %% Decoded data to UI
    QuaggaIndex -->|"decoded data"| UIResult
    ZXingIndex -->|"decoded data"| UIResult
    ZWASM -->|"decoded data"| UIResult

    %% iframe messaging
    IQ -->|"postMessage"| Index
    IZ -->|"postMessage"| Index
    IZB -->|"postMessage"| Index

    %% Deployment flow
    Actions -->|"deploy"| Pages
    Pages -->|"hosts"| Index
    Pages -->|"hosts"| Test
    Pages -->|"hosts"| DRG
    Pages -->|"hosts"| IQ
    Pages -->|"hosts"| IZ
    Pages -->|"hosts"| IZB

    %% Click Events
    click Index "https://github.com/aras-digital/adx-barcodes/blob/master/index.html"
    click Test "https://github.com/aras-digital/adx-barcodes/blob/master/test.html"
    click DRG "https://github.com/aras-digital/adx-barcodes/blob/master/drgfactory/index.html"
    click IQ "https://github.com/aras-digital/adx-barcodes/blob/master/quagga-js/index.html"
    click QuaggaIndex "https://github.com/aras-digital/adx-barcodes/blob/master/quagga-js/index.html"
    click QuaggaReadme "https://github.com/aras-digital/adx-barcodes/blob/master/quagga-js/readme.md"
    click ZXingIndex "https://github.com/aras-digital/adx-barcodes/blob/master/zxing-js/index.html"
    click ZbarIndex "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/index.html"
    click ZWASM "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/dist/zbar.wasm"
    click ZIndexJS "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/dist/index.js"
    click ZApp "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/js/app.js"
    click ZScanner "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/js/scanner.js"
    click ZUtils "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/js/utils.js"
    click ZMain "https://github.com/aras-digital/adx-barcodes/blob/master/zbar-wasm/js/main.js"
    click Actions "https://github.com/aras-digital/adx-barcodes/blob/master/.github/workflows/static.yml"

    %% Styles
    classDef html fill:#E8F1FB,stroke:#0366D6;
    classDef js fill:#E6FFED,stroke:#22863A;
    classDef wasm fill:#FFF5B1,stroke:#D73A49;
    classDef api fill:#F0F0F0,stroke:#6A737D,stroke-dasharray: 5 5;
    classDef stream fill:#F0FFF4,stroke:#34D058;
    classDef ci fill:#FFF0F6,stroke:#D63384;
    classDef doc fill:#FAF0E6,stroke:#A35D3D;
```
