# hpaprika/concilia-pe architecture

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

- Interactive diagram: https://gitdiagram.com/hpaprika/concilia-pe
- Repository: https://github.com/hpaprika/concilia-pe

## Overview

##### Project Type and Purpose
- ConciliaPe is a static, single-page Progressive Web App (PWA) for recording and reconciling airport baggage data by flight.
- It’s built with vanilla HTML, CSS, and JavaScript, with no backend server—entirely client-side, optimized for mobile and desktop.

##### File Structure Analysis
- Top level:
- index.html — main entry point and UI shell
- manifest.json — PWA metadata
- sw.js & src/js/register-sw.js — service worker for offline/caching
- src/css/main.css — presentation layer (mobile-first, responsive)
- src/js/app.js — application logic (form handling, baggage calculation, localStorage persistence, message generation)
- No server or API directories—signals a purely frontend architecture with client storage (localStorage).

##### README Insights
- UI/UX patterns: modal help dialog, reset button, message ready-for-WhatsApp feature.

##### Main Components
a. Browser (client runtime)
b. UI Layer
- index.html (semantic structure)
c. Application Logic
- app.js (captures user input, computes totals, generates WhatsApp message)
d. Persistence Layer
- localStorage (stores form data, with custom TTL logic)
e. PWA Support
- Service Worker (sw.js + register-sw.js) for:
- Offline support & fetch interception
f. External Interfaces
- WhatsApp Web / Share API (message share/clipboard)

##### Relationships & Data Flows
- On page load:
- Browser requests index.html → sw.js intercepts (return from cache or network)
- register-sw.js registers the SW
- manifest.json read by browser for installability
- User interaction:
- UI → app.js reads/writes localStorage → updates DOM
- Form submit → app.js generates text payload → Share API or click-to-copy → WhatsApp
- Offline behavior:
- Service Worker caches static assets on install → serves responses when offline
- Data persistence:
- app.js writes JSON to localStorage with timestamp → on reload, rehydrate form if <24h old

##### Architectural Patterns & Principles
- Separation of concerns: presentation (CSS), structure (HTML), logic (JS)
- Offline-first PWA pattern (cache-then-network strategy)
- Mobile-first, responsive design with custom properties and breakpoints
- Single-page static architecture—no server components

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Network Layer
    subgraph "Network"
        NET["Network"]:::network
    end

    %% Browser Runtime Boundary
    subgraph "Browser Runtime"
        BROWSER["Browser"]:::browser

        subgraph "UI Layer"
            HTML["index.html"]:::static
            CSS["main.css"]:::static
        end

        JS["app.js"]:::static
        SWREG["register-sw.js"]:::pwa
        SW["sw.js"]:::pwa
        MANIFEST["manifest.json"]:::pwa
        STORAGE["localStorage"]:::storage
    end

    %% External Services
    subgraph "External Services"
        WHATSAPP["WhatsApp Web / Share API"]:::external
    end

    %% Asset Fetch Flow
    BROWSER -->|"fetch asset"| SW
    SW -->|"serve cached or network asset"| HTML
    SW -->|"serve cached or network asset"| CSS
    SW -->|"serve cached or network asset"| JS
    SW -->|"serve cached or network asset"| MANIFEST
    SW -->|"serve cached or network asset"| ICONS

    %% Manifest and SW Registration
    BROWSER -->|"read PWA manifest"| MANIFEST
    BROWSER -->|"register service worker"| SWREG
    SWREG -->|"registers"| SW

    %% UI and App Logic Interactions
    HTML -->|"user interaction"| JS
    CSS -->|"styles UI"| HTML
    JS -->|"read/write data"| STORAGE
    STORAGE -->|"hydrate form if <24h"| JS
    JS -->|"update DOM"| HTML
    JS -->|"invoke Share API"| WHATSAPP

    %% Component Click Events
    click HTML "https://github.com/hpaprika/concilia-pe/blob/main/index.html"
    click CSS "https://github.com/hpaprika/concilia-pe/blob/main/src/css/main.css"
    click JS "https://github.com/hpaprika/concilia-pe/blob/main/src/js/app.js"
    click SWREG "https://github.com/hpaprika/concilia-pe/blob/main/src/js/register-sw.js"
    click SW "https://github.com/hpaprika/concilia-pe/blob/main/sw.js"
    click MANIFEST "https://github.com/hpaprika/concilia-pe/blob/main/manifest.json"
    click ICONS "https://github.com/hpaprika/concilia-pe/tree/main/assets/icons"

    %% Styles
    classDef static fill:#ADD8E6,stroke:#0000FF,stroke-width:1px
    classDef pwa fill:#FFA500,stroke:#FF8C00,stroke-width:1px
    classDef storage fill:#90EE90,stroke:#008000,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#800080,stroke-width:1px
    classDef network fill:#F0F0F0,stroke:#A9A9A9,stroke-width:1px
    classDef browser fill:#FFFFFF,stroke:#000000,stroke-width:1px
```
