# retschga/fwmonitor architecture

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

- Interactive diagram: https://gitdiagram.com/retschga/fwmonitor
- Repository: https://github.com/retschga/fwmonitor

## Overview

FWmonitor is a fire-service alarm information and coordination system. Its main workflow receives alarm data from file, email, or FE2; parses and stores the incident; then presents it on alarm screens and distributes updates through the web app and Telegram. The README also documents standby displays, calendars, availability, maps, hydrants, statistics, printing, and presentation sharing. API and UI internals are only partly sampled; documented capabilities are shown without inferring unverified internal calls.

Main entry points: [`src/services/alarm.ts`](https://github.com/retschga/fwmonitor/blob/master/src/services/alarm.ts) (Alarm service), [`src/services/alarmParser.ts`](https://github.com/retschga/fwmonitor/blob/master/src/services/alarmParser.ts) (Alarm parser), [`src/routes/screen/screen.ts`](https://github.com/retschga/fwmonitor/blob/master/src/routes/screen/screen.ts) (Alarm display), [`src/telegram/bot.ts`](https://github.com/retschga/fwmonitor/blob/master/src/telegram/bot.ts) (Telegram bot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Alarm intake"]
  node_alarm_inputs["Alarm inputs<br/>[alarmInputFile.ts]"]
  node_email_input["Email input<br/>[alarmInputEmail.ts]"]
  node_fe2_input["FE2 input<br/>[alarmInputFe2.ts]"]
  node_parser["Alarm parser<br/>[alarmParser.ts]"]
end

subgraph group_core["Incident services"]
  node_alarm_service["Alarm service<br/>[alarm.ts]"]
  node_alarm_store[("Alarm records<br/>[alarm.ts]")]
end

subgraph group_clients["Displays and clients"]
  node_alarm_display["Alarm display<br/>[screen.ts]"]
  node_web_app["Installable web app<br/>[mobile.ts]"]
  node_telegram["Telegram bot<br/>[bot.ts]"]
end

subgraph group_coordination["Coordination features"]
  node_user_service["User service<br/>[user.ts]"]
  node_calendar["Calendar<br/>[calendar.ts]"]
  node_diashow["Standby slideshow<br/>[diashow.ts]"]
  node_mapping["Mapping and geocoding<br/>[geocode.ts]"]
  node_printing["Printing<br/>[printing.ts]"]
  node_statistics["Incident statistics<br/>[statistic.ts]"]
  node_presentation["Presentation sharing<br/>[praesentation.ts]"]
  node_hydrants["Hydrant information<br/>[hydrant.ts]"]
end

subgraph group_platform["Application platform"]
  node_database[("SQLite database<br/>[connection.ts]")]
  node_websocket["Live updates<br/>[websocket.ts]"]
  node_api["Web API<br/>[routerApi.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
end

node_dispatcher(("Fire-service staff"))

node_alarm_inputs -.->|"passes alarms"| node_parser
node_email_input -.->|"passes alarms"| node_parser
node_fe2_input -.->|"passes alarms"| node_parser
node_parser -->|"submits parsed data"| node_alarm_service
node_alarm_service -->|"reads and writes"| node_alarm_store
node_alarm_store -->|"queries"| node_database
node_dispatcher -->|"views incidents"| node_alarm_display
node_dispatcher -->|"uses"| node_web_app
node_dispatcher -->|"uses"| node_telegram
node_alarm_service -.->|"provides alarm view"| node_alarm_display
node_alarm_service -.->|"notifies"| node_telegram
node_alarm_service -.->|"publishes updates"| node_websocket
node_web_app -.->|"uses API"| node_api
node_api -->|"secures routes"| node_auth
node_telegram -->|"uses user services"| node_user_service
node_dispatcher -->|"manages calendar"| node_calendar
node_dispatcher -->|"views standby"| node_diashow
node_alarm_display -->|"shows incident map"| node_mapping
node_dispatcher -->|"prints map and alarm"| node_printing
node_dispatcher -->|"views statistics"| node_statistics
node_dispatcher -->|"shares presentations"| node_presentation
node_dispatcher -->|"records hydrants"| node_hydrants

click node_alarm_inputs "https://github.com/retschga/fwmonitor/blob/master/src/services/alarmInputFile.ts"
click node_email_input "https://github.com/retschga/fwmonitor/blob/master/src/services/alarmInputEmail.ts"
click node_fe2_input "https://github.com/retschga/fwmonitor/blob/master/src/services/alarmInputFe2.ts"
click node_parser "https://github.com/retschga/fwmonitor/blob/master/src/services/alarmParser.ts"
click node_alarm_service "https://github.com/retschga/fwmonitor/blob/master/src/services/alarm.ts"
click node_alarm_store "https://github.com/retschga/fwmonitor/blob/master/src/models/alarm.ts"
click node_database "https://github.com/retschga/fwmonitor/blob/master/src/database/connection.ts"
click node_alarm_display "https://github.com/retschga/fwmonitor/blob/master/src/routes/screen/screen.ts"
click node_web_app "https://github.com/retschga/fwmonitor/blob/master/src/routes/mobile/mobile.ts"
click node_telegram "https://github.com/retschga/fwmonitor/blob/master/src/telegram/bot.ts"
click node_websocket "https://github.com/retschga/fwmonitor/blob/master/src/websocket.ts"
click node_api "https://github.com/retschga/fwmonitor/blob/master/src/routes/routerApi.ts"
click node_auth "https://github.com/retschga/fwmonitor/blob/master/src/middleware/auth.ts"
click node_user_service "https://github.com/retschga/fwmonitor/blob/master/src/services/user.ts"
click node_calendar "https://github.com/retschga/fwmonitor/blob/master/src/services/calendar.ts"
click node_diashow "https://github.com/retschga/fwmonitor/blob/master/src/services/diashow.ts"
click node_mapping "https://github.com/retschga/fwmonitor/blob/master/src/services/geocode.ts"
click node_printing "https://github.com/retschga/fwmonitor/blob/master/src/services/printing.ts"
click node_statistics "https://github.com/retschga/fwmonitor/blob/master/src/services/statistic.ts"
click node_presentation "https://github.com/retschga/fwmonitor/blob/master/src/services/praesentation.ts"
click node_hydrants "https://github.com/retschga/fwmonitor/blob/master/src/services/hydrant.ts"

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_alarm_inputs,node_email_input,node_fe2_input,node_parser toneBlue
class node_alarm_service,node_alarm_store toneAmber
class node_alarm_display,node_web_app,node_telegram toneMint
class node_user_service,node_calendar,node_diashow,node_mapping,node_printing,node_statistics,node_presentation,node_hydrants toneRose
class node_database,node_websocket,node_api,node_auth,node_dispatcher toneIndigo
```

## Components

### Alarm intake

- [Alarm inputs](https://github.com/retschga/fwmonitor/blob/master/src/services/alarmInputFile.ts): `src/services/alarmInputFile.ts`
- [Email input](https://github.com/retschga/fwmonitor/blob/master/src/services/alarmInputEmail.ts): `src/services/alarmInputEmail.ts`
- [FE2 input](https://github.com/retschga/fwmonitor/blob/master/src/services/alarmInputFe2.ts): `src/services/alarmInputFe2.ts`
- [Alarm parser](https://github.com/retschga/fwmonitor/blob/master/src/services/alarmParser.ts): `src/services/alarmParser.ts`

### Incident services

- [Alarm service](https://github.com/retschga/fwmonitor/blob/master/src/services/alarm.ts): `src/services/alarm.ts`
- [Alarm records](https://github.com/retschga/fwmonitor/blob/master/src/models/alarm.ts): `src/models/alarm.ts`

### Displays and clients

- [Alarm display](https://github.com/retschga/fwmonitor/blob/master/src/routes/screen/screen.ts): `src/routes/screen/screen.ts`
- [Installable web app](https://github.com/retschga/fwmonitor/blob/master/src/routes/mobile/mobile.ts): `src/routes/mobile/mobile.ts`
- [Telegram bot](https://github.com/retschga/fwmonitor/blob/master/src/telegram/bot.ts): `src/telegram/bot.ts`

### Coordination features

- [User service](https://github.com/retschga/fwmonitor/blob/master/src/services/user.ts): `src/services/user.ts`
- [Calendar](https://github.com/retschga/fwmonitor/blob/master/src/services/calendar.ts): `src/services/calendar.ts`
- [Standby slideshow](https://github.com/retschga/fwmonitor/blob/master/src/services/diashow.ts): `src/services/diashow.ts`
- [Mapping and geocoding](https://github.com/retschga/fwmonitor/blob/master/src/services/geocode.ts): `src/services/geocode.ts`
- [Printing](https://github.com/retschga/fwmonitor/blob/master/src/services/printing.ts): `src/services/printing.ts`
- [Incident statistics](https://github.com/retschga/fwmonitor/blob/master/src/services/statistic.ts): `src/services/statistic.ts`
- [Presentation sharing](https://github.com/retschga/fwmonitor/blob/master/src/services/praesentation.ts): `src/services/praesentation.ts`
- [Hydrant information](https://github.com/retschga/fwmonitor/blob/master/src/services/hydrant.ts): `src/services/hydrant.ts`

### Application platform

- [SQLite database](https://github.com/retschga/fwmonitor/blob/master/src/database/connection.ts): `src/database/connection.ts`
- [Live updates](https://github.com/retschga/fwmonitor/blob/master/src/websocket.ts): `src/websocket.ts`
- [Web API](https://github.com/retschga/fwmonitor/blob/master/src/routes/routerApi.ts): `src/routes/routerApi.ts`
- [Authentication](https://github.com/retschga/fwmonitor/blob/master/src/middleware/auth.ts): `src/middleware/auth.ts`

### Other components

- **Fire-service staff**

## Connections

- Alarm inputs → Alarm parser: passes alarms
- Email input → Alarm parser: passes alarms
- FE2 input → Alarm parser: passes alarms
- Alarm parser → Alarm service: submits parsed data (evidence: `src/services/alarmParser.ts`)
- Alarm service → Alarm records: reads and writes (evidence: `src/services/alarm.ts`)
- Alarm records → SQLite database: queries (evidence: `src/models/alarm.ts`)
- Fire-service staff → Alarm display: views incidents (evidence: `README.md`)
- Fire-service staff → Installable web app: uses (evidence: `README.md`)
- Fire-service staff → Telegram bot: uses (evidence: `README.md`)
- Alarm service → Alarm display: provides alarm view
- Alarm service → Telegram bot: notifies
- Alarm service → Live updates: publishes updates
- Installable web app → Web API: uses API
- Web API → Authentication: secures routes (evidence: `src/routes/routerApi.ts`)
- Telegram bot → User service: uses user services (evidence: `src/telegram/bot.ts`)
- Fire-service staff → Calendar: manages calendar (evidence: `README.md`)
- Fire-service staff → Standby slideshow: views standby (evidence: `README.md`)
- Alarm display → Mapping and geocoding: shows incident map (evidence: `README.md`)
- Fire-service staff → Printing: prints map and alarm (evidence: `README.md`)
- Fire-service staff → Incident statistics: views statistics (evidence: `README.md`)
- Fire-service staff → Presentation sharing: shares presentations (evidence: `README.md`)
- Fire-service staff → Hydrant information: records hydrants (evidence: `README.md`)
