# gesellix/bose-soundtouch architecture

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

- Interactive diagram: https://gitdiagram.com/gesellix/bose-soundtouch
- Repository: https://github.com/gesellix/bose-soundtouch

## Overview

AfterTouch is a local SoundTouch cloud replacement, accompanied by LAN control tools and a Go client library. The main workflow is an owner using the web UI to configure or manage speakers; the service exposes management APIs, performs setup and cloud-service emulation, and supports speaker control and discovery. The README documents capabilities beyond the sampled excerpts, including migration, redirects, backups, and standalone player operation. Edges for unsampled service internals are limited to documented relationships; dashed edges indicate connections not verified in the excerpts.

Main entry points: [`cmd/soundtouch-service/main.go`](https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-service/main.go) (Service Daemon), [`pkg/service/soundtouchweb/static/js/api.js`](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/api.js) (UI API Client), [`pkg/service/soundtouchweb/static/js/app.js`](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/app.js) (Web UI), [`pkg/service/handlers`](https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/handlers) (HTTP Handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["AfterTouch Service"]
  node_service_app["Service Daemon<br/>[main.go]"]
  node_http_handlers["HTTP Handlers"]
  node_setup["Device Setup"]
  node_datastore[("Local Data Store")]
end

subgraph group_web["Web Player"]
  node_webapp["Embedded Web App<br/>[handler.go]"]
  node_web_ui["Web UI<br/>[app.js]"]
  node_web_api["UI API Client<br/>[api.js]"]
  node_controls["Playback Controls<br/>[Controls.js]"]
  node_presets["Preset Browsing<br/>[Presets.js]"]
  node_catalog["Catalog Picker<br/>[CatalogPicker.js]"]
  node_library["Music Library<br/>[Library.js]"]
  node_preset_picker["Preset Picker<br/>[PresetPicker.js]"]
  node_settings["Device Settings<br/>[Settings.js]"]
  node_sources["Source Selection<br/>[Sources.js]"]
  node_stereo["Stereo Pairing<br/>[StereoPair.js]"]
  node_tunein["TuneIn Browser<br/>[TuneInBrowser.js]"]
  node_zones["Multiroom Zones<br/>[Zone.js]"]
  node_content_location["Content Location"]
  node_device_presentation["Device Presentation"]
  node_discrete_command["Command Readback<br/>[discreteCommand.js]"]
  node_settings_presentation["Settings Presentation"]
  node_source_icons["Source Icons<br/>[sourceIcons.js]"]
end

subgraph group_device["Device Access"]
  node_discovery["Device Discovery"]
  node_client["SoundTouch Client<br/>[client.go]"]
  node_speaker(("SoundTouch Speakers"))
end

subgraph group_integrations["Service Integrations"]
  node_service_providers["Music Providers<br/>[service.go]"]
  node_spotify["Spotify Provider<br/>[service.go]"]
  node_tts["Speech Service<br/>[service.go]"]
  node_stereo_coordinator["Stereo Coordinator<br/>[coordinator.go]"]
end

subgraph group_tools["Companion Tools"]
  node_cli["Command Line<br/>[main.go]"]
  node_backup["Account Backup<br/>[main.go]"]
  node_player["Standalone Player<br/>[main.go]"]
end

node_owner(("Speaker Owner"))
node_browser(("Browser UI"))

node_owner -->|"operates"| node_browser
node_browser -->|"uses"| node_webapp
node_webapp -->|"serves"| node_web_ui
node_web_ui -->|"requests"| node_web_api
node_controls -->|"requests"| node_web_api
node_presets -->|"requests"| node_web_api
node_library -->|"requests"| node_web_api
node_sources -->|"requests"| node_web_api
node_settings -->|"requests"| node_web_api
node_stereo -->|"requests"| node_web_api
node_tunein -->|"requests"| node_web_api
node_web_ui -->|"uses"| node_device_presentation
node_web_ui -->|"uses"| node_discrete_command
node_web_ui -.->|"renders"| node_zones
node_presets -->|"renders"| node_catalog
node_presets -->|"uses"| node_preset_picker
node_library -->|"uses"| node_preset_picker
node_web_ui -.->|"uses"| node_content_location
node_settings -->|"uses"| node_settings_presentation
node_sources -->|"uses"| node_source_icons
node_web_api -.->|"calls"| node_http_handlers
node_service_app -->|"initializes"| node_datastore
node_service_app -->|"routes"| node_http_handlers
node_service_app -->|"creates"| node_webapp
node_service_app -->|"configures"| node_discovery
node_service_app -->|"configures"| node_service_providers
node_http_handlers -->|"delegates"| node_spotify
node_http_handlers -->|"delegates"| node_service_providers
node_service_app -->|"configures"| node_setup
node_setup -.->|"configures"| node_speaker
node_service_app -->|"configures"| node_stereo_coordinator
node_service_app -.->|"configures"| node_tts
node_cli -->|"controls"| node_client
node_client -->|"controls"| node_speaker
node_discovery -->|"discovers"| node_speaker
node_backup -->|"polls"| node_speaker
node_backup -->|"backs up"| node_owner
node_player -->|"runs"| node_webapp
node_player -->|"controls"| node_speaker
node_player -->|"delegates features"| node_service_app

click node_service_app "https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-service/main.go"
click node_http_handlers "https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/handlers"
click node_setup "https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/setup"
click node_datastore "https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/datastore"
click node_webapp "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/handler.go"
click node_web_ui "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/app.js"
click node_web_api "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/api.js"
click node_controls "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Controls.js"
click node_presets "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Presets.js"
click node_catalog "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/CatalogPicker.js"
click node_library "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Library.js"
click node_preset_picker "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/PresetPicker.js"
click node_settings "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Settings.js"
click node_sources "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Sources.js"
click node_stereo "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/StereoPair.js"
click node_tunein "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/TuneInBrowser.js"
click node_zones "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Zone.js"
click node_content_location "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/contentLocation.mjs"
click node_device_presentation "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/devicePresentation.js"
click node_discrete_command "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/discreteCommand.js"
click node_settings_presentation "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/settingsPresentation.mjs"
click node_source_icons "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/sourceIcons.js"
click node_discovery "https://github.com/gesellix/bose-soundtouch/tree/main/pkg/discovery"
click node_client "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/client/client.go"
click node_service_providers "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/amazon/service.go"
click node_spotify "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/spotify/service.go"
click node_tts "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/tts/service.go"
click node_stereo_coordinator "https://github.com/gesellix/bose-soundtouch/blob/main/pkg/stereopair/coordinator.go"
click node_cli "https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-cli/main.go"
click node_backup "https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-backup/main.go"
click node_player "https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-player/main.go"

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_service_app,node_http_handlers,node_setup,node_datastore,node_browser toneBlue
class node_webapp,node_web_ui,node_web_api,node_controls,node_presets,node_catalog,node_library,node_preset_picker,node_settings,node_sources,node_stereo,node_tunein,node_zones,node_content_location,node_device_presentation,node_discrete_command,node_settings_presentation,node_source_icons toneAmber
class node_discovery,node_client,node_speaker toneMint
class node_service_providers,node_spotify,node_tts,node_stereo_coordinator toneRose
class node_cli,node_backup,node_player,node_owner toneIndigo
```

## Components

### AfterTouch Service

- [Service Daemon](https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-service/main.go): `cmd/soundtouch-service/main.go`
- [HTTP Handlers](https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/handlers): `pkg/service/handlers`
- [Device Setup](https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/setup): `pkg/service/setup`
- [Local Data Store](https://github.com/gesellix/bose-soundtouch/tree/main/pkg/service/datastore): `pkg/service/datastore`

### Web Player

- [Embedded Web App](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/handler.go): `pkg/service/soundtouchweb/handler.go`
- [Web UI](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/app.js): `pkg/service/soundtouchweb/static/js/app.js`
- [UI API Client](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/api.js): `pkg/service/soundtouchweb/static/js/api.js`
- [Playback Controls](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Controls.js): `pkg/service/soundtouchweb/static/js/components/Controls.js`
- [Preset Browsing](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Presets.js): `pkg/service/soundtouchweb/static/js/components/Presets.js`
- [Catalog Picker](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/CatalogPicker.js): `pkg/service/soundtouchweb/static/js/components/CatalogPicker.js`
- [Music Library](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Library.js): `pkg/service/soundtouchweb/static/js/components/Library.js`
- [Preset Picker](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/PresetPicker.js): `pkg/service/soundtouchweb/static/js/components/PresetPicker.js`
- [Device Settings](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Settings.js): `pkg/service/soundtouchweb/static/js/components/Settings.js`
- [Source Selection](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Sources.js): `pkg/service/soundtouchweb/static/js/components/Sources.js`
- [Stereo Pairing](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/StereoPair.js): `pkg/service/soundtouchweb/static/js/components/StereoPair.js`
- [TuneIn Browser](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/TuneInBrowser.js): `pkg/service/soundtouchweb/static/js/components/TuneInBrowser.js`
- [Multiroom Zones](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/components/Zone.js): `pkg/service/soundtouchweb/static/js/components/Zone.js`
- [Content Location](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/contentLocation.mjs): `pkg/service/soundtouchweb/static/js/contentLocation.mjs`
- [Device Presentation](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/devicePresentation.js): `pkg/service/soundtouchweb/static/js/devicePresentation.js`
- [Command Readback](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/discreteCommand.js): `pkg/service/soundtouchweb/static/js/discreteCommand.js`
- [Settings Presentation](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/settingsPresentation.mjs): `pkg/service/soundtouchweb/static/js/settingsPresentation.mjs`
- [Source Icons](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/soundtouchweb/static/js/sourceIcons.js): `pkg/service/soundtouchweb/static/js/sourceIcons.js`

### Device Access

- [Device Discovery](https://github.com/gesellix/bose-soundtouch/tree/main/pkg/discovery): `pkg/discovery`
- [SoundTouch Client](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/client/client.go): `pkg/client/client.go`
- **SoundTouch Speakers**

### Service Integrations

- [Music Providers](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/amazon/service.go): `pkg/service/amazon/service.go`
- [Spotify Provider](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/spotify/service.go): `pkg/service/spotify/service.go`
- [Speech Service](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/service/tts/service.go): `pkg/service/tts/service.go`
- [Stereo Coordinator](https://github.com/gesellix/bose-soundtouch/blob/main/pkg/stereopair/coordinator.go): `pkg/stereopair/coordinator.go`

### Companion Tools

- [Command Line](https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-cli/main.go): `cmd/soundtouch-cli/main.go`
- [Account Backup](https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-backup/main.go): `cmd/soundtouch-backup/main.go`
- [Standalone Player](https://github.com/gesellix/bose-soundtouch/blob/main/cmd/soundtouch-player/main.go): `cmd/soundtouch-player/main.go`

### Other components

- **Speaker Owner**
- **Browser UI**

## Connections

- Speaker Owner → Browser UI: operates (evidence: `README.md`)
- Browser UI → Embedded Web App: uses (evidence: `README.md`)
- Embedded Web App → Web UI: serves
- Web UI → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/app.js`)
- Playback Controls → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/Controls.js`)
- Preset Browsing → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/Presets.js`)
- Music Library → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/Library.js`)
- Source Selection → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/Sources.js`)
- Device Settings → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/Settings.js`)
- Stereo Pairing → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/StereoPair.js`)
- TuneIn Browser → UI API Client: requests (evidence: `pkg/service/soundtouchweb/static/js/components/TuneInBrowser.js`)
- Web UI → Device Presentation: uses (evidence: `pkg/service/soundtouchweb/static/js/app.js`)
- Web UI → Command Readback: uses (evidence: `pkg/service/soundtouchweb/static/js/app.js`)
- Web UI → Multiroom Zones: renders (evidence: `pkg/service/soundtouchweb/static/js/app.js`)
- Preset Browsing → Catalog Picker: renders (evidence: `pkg/service/soundtouchweb/static/js/components/Presets.js`)
- Preset Browsing → Preset Picker: uses (evidence: `pkg/service/soundtouchweb/static/js/components/Presets.js`)
- Music Library → Preset Picker: uses (evidence: `pkg/service/soundtouchweb/static/js/components/Library.js`)
- Web UI → Content Location: uses
- Device Settings → Settings Presentation: uses (evidence: `pkg/service/soundtouchweb/static/js/components/Settings.js`)
- Source Selection → Source Icons: uses (evidence: `pkg/service/soundtouchweb/static/js/components/Sources.js`)
- UI API Client → HTTP Handlers: calls
- Service Daemon → Local Data Store: initializes (evidence: `cmd/soundtouch-service/main.go`)
- Service Daemon → HTTP Handlers: routes (evidence: `cmd/soundtouch-service/main.go`)
- Service Daemon → Embedded Web App: creates (evidence: `cmd/soundtouch-service/main.go`)
- Service Daemon → Device Discovery: configures (evidence: `cmd/soundtouch-service/main.go`)
- Service Daemon → Music Providers: configures (evidence: `cmd/soundtouch-service/main.go`)
- HTTP Handlers → Spotify Provider: delegates (evidence: `pkg/service/handlers/handlers_oauth.go`)
- HTTP Handlers → Music Providers: delegates (evidence: `pkg/service/handlers/handlers_oauth.go`)
- Service Daemon → Device Setup: configures (evidence: `cmd/soundtouch-service/main.go`)
- Device Setup → SoundTouch Speakers: configures
- Service Daemon → Stereo Coordinator: configures (evidence: `cmd/soundtouch-service/main.go`)
- Service Daemon → Speech Service: configures
- Command Line → SoundTouch Client: controls (evidence: `README.md`)
- SoundTouch Client → SoundTouch Speakers: controls (evidence: `README.md`)
- Device Discovery → SoundTouch Speakers: discovers
- Account Backup → SoundTouch Speakers: polls (evidence: `README.md`)
- Account Backup → Speaker Owner: backs up (evidence: `README.md`)
- Standalone Player → Embedded Web App: runs (evidence: `README.md`)
- Standalone Player → SoundTouch Speakers: controls (evidence: `cmd/soundtouch-player/main.go`)
- Standalone Player → Service Daemon: delegates features (evidence: `README.md`)
