# technologiestiftung/kiezbox-pwa architecture

> Architecture diagram of the GitHub repository technologiestiftung/kiezbox-pwa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/technologiestiftung/kiezbox-pwa
- Repository: https://github.com/technologiestiftung/kiezbox-pwa

## Overview

Kiezbox is a SvelteKit emergency-response PWA for BananaPi devices. The user-facing flow brings together emergency or demo calling, precaution guidance, and a map of local points of interest; the call screen coordinates SIP-call controls and call state, while the map displays configured layers and feature details. The README also describes offline operation and SIP-based calls. The graph follows the sampled page and component wiring; several supporting state modules and offline behavior are included at subsystem level because their implementation was not excerpted.

Main entry points: [`src/routes/+page.svelte`](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/routes/%2Bpage.svelte) (Home page), [`src/components/EmergencyCall/EmergencyCall.svelte`](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/EmergencyCall.svelte) (Call coordinator), [`src/components/Map/Map.svelte`](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/Map.svelte) (POI map), [`src/components/PrecautionGuide/PrecautionGuide.svelte`](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/PrecautionGuide.svelte) (Precaution guide)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_page["Home page<br/>[+page.svelte]"]
  node_header["Header<br/>[Header.svelte]"]
  node_footer["Footer<br/>[Footer.svelte]"]
end

subgraph group_calling["Emergency calling"]
  node_emergency["Call coordinator"]
  node_dialer["Dialer<br/>[Dialer.svelte]"]
  node_callscreen["Call controls<br/>[CallScreen.svelte]"]
  node_callinfo["Call guidance"]
  node_demoinfo["Demo guidance"]
  node_speech["Speech bubble"]
  node_callstate["SIP call service"]
  node_callutils["Call utilities<br/>[callUtils.ts]"]
end

subgraph group_localinfo["Local information"]
  node_guide["Precaution guide"]
  node_guidecontent["Guide tabs<br/>[TabView.svelte]"]
  node_infobox["Guide content<br/>[InfoBox.svelte]"]
  node_precautions["Guide data builder<br/>[precautionUtils.ts]"]
  node_map["POI map<br/>[Map.svelte]"]
  node_legend["Map legend<br/>[Legend.svelte]"]
  node_popup["POI details<br/>[PopupCard.svelte]"]
  node_mapconfig["Map layers and sources<br/>[layers.ts]"]
  node_mapstyle["Base map style"]
  node_mapstate["Map and POI state<br/>[state.svelte.ts]"]
end

subgraph group_platform["PWA platform"]
  node_network["Network service"]
  node_worker["Offline service worker<br/>[service-worker.ts]"]
  node_layout["App layout<br/>[+layout.svelte]"]
end

node_user(("Resident"))
node_sip["SIP service"]
node_offline["Offline browser"]

node_user -->|"opens"| node_page
node_page -->|"renders"| node_header
node_page -->|"renders"| node_emergency
node_page -->|"renders"| node_guide
node_page -->|"renders"| node_map
node_page -->|"renders"| node_footer
node_page -->|"initializes"| node_network
node_guide -->|"builds tabs"| node_precautions
node_guide -->|"renders"| node_guidecontent
node_guidecontent -->|"renders"| node_infobox
node_map -->|"loads layers"| node_mapconfig
node_map -->|"loads style"| node_mapstyle
node_map -->|"renders"| node_legend
node_map -->|"renders"| node_popup
node_map -->|"sets feature state"| node_mapstate
node_popup -->|"reads popup state"| node_mapstate
node_popup -->|"reads layer config"| node_mapconfig
node_emergency -->|"renders"| node_dialer
node_emergency -->|"renders"| node_callscreen
node_emergency -->|"renders emergency info"| node_callinfo
node_emergency -->|"renders demo info"| node_demoinfo
node_demoinfo -->|"renders"| node_speech
node_emergency -->|"controls calls"| node_callstate
node_emergency -->|"reads network status"| node_network
node_callstate -.->|"places SIP calls"| node_sip
node_layout -->|"checks for updates"| node_worker
node_offline -.->|"supports offline use"| node_page

click node_page "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/routes/%2Bpage.svelte"
click node_header "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Header.svelte"
click node_footer "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Footer.svelte"
click node_guide "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/PrecautionGuide.svelte"
click node_guidecontent "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/TabView.svelte"
click node_infobox "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/InfoBox.svelte"
click node_precautions "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/utils/precautionUtils.ts"
click node_map "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/Map.svelte"
click node_legend "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/Legend.svelte"
click node_popup "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/PopupCard.svelte"
click node_mapconfig "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/config/layers.ts"
click node_mapstyle "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/config/layer-style-positron.ts"
click node_emergency "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/EmergencyCall.svelte"
click node_dialer "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/Dialer.svelte"
click node_callscreen "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/CallScreen.svelte"
click node_callinfo "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/EmergencyCallInfo.svelte"
click node_demoinfo "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/DemoCallInfo.svelte"
click node_speech "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/SpeechBubble.svelte"
click node_callstate "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/state/callState.svelte.ts"
click node_callutils "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/utils/callUtils.ts"
click node_network "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/state/networkState.svelte.ts"
click node_mapstate "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/state/state.svelte.ts"
click node_worker "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/service-worker.ts"
click node_layout "https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/routes/%2Blayout.svelte"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page,node_header,node_footer,node_offline toneBlue
class node_emergency,node_dialer,node_callscreen,node_callinfo,node_demoinfo,node_speech,node_callstate,node_callutils toneAmber
class node_guide,node_guidecontent,node_infobox,node_precautions,node_map,node_legend,node_popup,node_mapconfig,node_mapstyle,node_mapstate toneMint
class node_network,node_worker,node_layout toneRose
class node_user,node_sip toneIndigo
```

## Components

### App experience

- [Home page](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/routes/%2Bpage.svelte): `src/routes/+page.svelte`
- [Header](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Header.svelte): `src/components/Header.svelte`
- [Footer](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Footer.svelte): `src/components/Footer.svelte`

### Emergency calling

- [Call coordinator](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/EmergencyCall.svelte): `src/components/EmergencyCall/EmergencyCall.svelte`
- [Dialer](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/Dialer.svelte): `src/components/EmergencyCall/Dialer.svelte`
- [Call controls](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/CallScreen.svelte): `src/components/EmergencyCall/CallScreen.svelte`
- [Call guidance](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/EmergencyCallInfo.svelte): `src/components/EmergencyCall/EmergencyCallInfo.svelte`
- [Demo guidance](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/DemoCallInfo.svelte): `src/components/EmergencyCall/DemoCallInfo.svelte`
- [Speech bubble](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/EmergencyCall/SpeechBubble.svelte): `src/components/EmergencyCall/SpeechBubble.svelte`
- [SIP call service](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/state/callState.svelte.ts): `src/lib/state/callState.svelte.ts`
- [Call utilities](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/utils/callUtils.ts): `src/lib/utils/callUtils.ts`

### Local information

- [Precaution guide](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/PrecautionGuide.svelte): `src/components/PrecautionGuide/PrecautionGuide.svelte`
- [Guide tabs](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/TabView.svelte): `src/components/PrecautionGuide/TabView.svelte`
- [Guide content](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/PrecautionGuide/InfoBox.svelte): `src/components/PrecautionGuide/InfoBox.svelte`
- [Guide data builder](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/utils/precautionUtils.ts): `src/lib/utils/precautionUtils.ts`
- [POI map](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/Map.svelte): `src/components/Map/Map.svelte`
- [Map legend](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/Legend.svelte): `src/components/Map/Legend.svelte`
- [POI details](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/components/Map/PopupCard.svelte): `src/components/Map/PopupCard.svelte`
- [Map layers and sources](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/config/layers.ts): `src/lib/config/layers.ts`
- [Base map style](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/config/layer-style-positron.ts): `src/lib/config/layer-style-positron.ts`
- [Map and POI state](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/state/state.svelte.ts): `src/lib/state/state.svelte.ts`

### PWA platform

- [Network service](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/lib/state/networkState.svelte.ts): `src/lib/state/networkState.svelte.ts`
- [Offline service worker](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/service-worker.ts): `src/service-worker.ts`
- [App layout](https://github.com/technologiestiftung/kiezbox-pwa/blob/main/src/routes/%2Blayout.svelte): `src/routes/+layout.svelte`

### Other components

- **Resident**
- **SIP service**
- **Offline browser**

## Connections

- Resident → Home page: opens (evidence: `src/routes/+page.svelte`)
- Home page → Header: renders (evidence: `src/routes/+page.svelte`)
- Home page → Call coordinator: renders (evidence: `src/routes/+page.svelte`)
- Home page → Precaution guide: renders (evidence: `src/routes/+page.svelte`)
- Home page → POI map: renders (evidence: `src/routes/+page.svelte`)
- Home page → Footer: renders (evidence: `src/routes/+page.svelte`)
- Home page → Network service: initializes (evidence: `src/routes/+page.svelte`)
- Precaution guide → Guide data builder: builds tabs (evidence: `src/components/PrecautionGuide/PrecautionGuide.svelte`)
- Precaution guide → Guide tabs: renders (evidence: `src/components/PrecautionGuide/PrecautionGuide.svelte`)
- Guide tabs → Guide content: renders (evidence: `src/components/PrecautionGuide/TabView.svelte`)
- POI map → Map layers and sources: loads layers (evidence: `src/components/Map/Map.svelte`)
- POI map → Base map style: loads style (evidence: `src/components/Map/Map.svelte`)
- POI map → Map legend: renders (evidence: `src/components/Map/Map.svelte`)
- POI map → POI details: renders (evidence: `src/components/Map/Map.svelte`)
- POI map → Map and POI state: sets feature state (evidence: `src/components/Map/Map.svelte`)
- POI details → Map and POI state: reads popup state (evidence: `src/components/Map/PopupCard.svelte`)
- POI details → Map layers and sources: reads layer config (evidence: `src/components/Map/PopupCard.svelte`)
- Call coordinator → Dialer: renders (evidence: `src/components/EmergencyCall/EmergencyCall.svelte`)
- Call coordinator → Call controls: renders (evidence: `src/components/EmergencyCall/EmergencyCall.svelte`)
- Call coordinator → Call guidance: renders emergency info (evidence: `src/components/EmergencyCall/EmergencyCall.svelte`)
- Call coordinator → Demo guidance: renders demo info (evidence: `src/components/EmergencyCall/EmergencyCall.svelte`)
- Demo guidance → Speech bubble: renders (evidence: `src/components/EmergencyCall/DemoCallInfo.svelte`)
- Call coordinator → SIP call service: controls calls (evidence: `src/components/EmergencyCall/EmergencyCall.svelte`)
- Call coordinator → Network service: reads network status (evidence: `src/components/EmergencyCall/EmergencyCall.svelte`)
- SIP call service → SIP service: places SIP calls (evidence: `README.md`)
- App layout → Offline service worker: checks for updates (evidence: `src/routes/+layout.svelte`)
- Offline browser → Home page: supports offline use (evidence: `README.md`)
