bubbles

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0

README

bubbles

A secure, self-hosted chat platform for a local network. One server binary runs on any LAN host, and every device joins through the web app or the desktop tray app.

bubbles needs no internet connection and no cloud account. It is a companion to netdiag: LAN tools post alerts ("printer offline", "gateway down") that everyone on the network sees, and people chat in channels, DMs and group DMs with files and photos.

What it does

  • Chat: public and private channels, DMs and group DMs, threads, reactions, mentions (@user, @channel, @here), pins, edit and delete, full-text search, unread counts and drafts that sync across devices, presence and typing.
  • Files: upload by button, drag and drop or paste. Images, video and audio show inline. EXIF location data is removed from JPEG, PNG and WebP.
  • Alerts and integrations: alerts with severity and acknowledgement, incoming webhooks (native JSON and a Slack-compatible subset), scoped app tokens, a realtime event stream, a Go SDK (pkg/bubblesclient) and an MCP server for agents.
  • Admin: invitations with roles, settings, audit log, encrypted backups, TLS and CA management, and a reset that clears content or does a factory reset.
  • Everywhere: one server binary for Windows, macOS and Linux (amd64 and arm64), a Docker image, and an installable web app for phones and computers.

All app traffic is HTTPS, with a certificate from a local certificate authority that each device trusts once. See docs/security.md for the threat model and what bubbles does not protect against.

Screenshots

Screenshots of the login page, a channel and the admin overview, in dark and light themes on desktop and phone sizes, are generated by web/tests/e2e/screenshots.spec.ts into docs/img/ (run with BUBBLES_SCREENSHOTS=1). The files are named <screen>-<theme>-<size>.png, for example:

Dark, desktop Light, desktop Dark, phone Light, phone
Channel, dark, desktop Channel, light, desktop Channel, dark, phone Channel, light, phone

Login (login-*) and the admin overview (admin-overview-*) follow the same naming.

A tour with more screens (alerts, threads, search, invites, reset, phones) is on the project site. Its screenshots come from web/tests/e2e/showcase.spec.ts (run with BUBBLES_SHOWCASE=1), and the page itself lives in site/.

Quick start

  1. Download the zip for your system from the project's releases page, and check the file against SHA256SUMS.
  2. Unzip it and run the server on a computer that stays on your network. See HOW-TO-OPEN.txt for the warnings that Windows (SmartScreen) and macOS (Gatekeeper) show for unsigned programs.
  3. Read the console. It prints the setup token and the addresses to open, for example https://192.168.1.20:28225.
  4. Open that address in a browser on the server, enter the setup token and create the administrator account.
  5. Add other devices. Open the onboarding page on port 28226 (for example http://192.168.1.20:28226), install the local CA once, then scan the QR code or open the address. docs/onboarding.md has the steps for iPhone, iPad, Android, Windows, macOS, Linux and Firefox.

The default ports are 28225 (HTTPS) and 28226 (onboarding). Ports 8443 and 8080 are used by many other servers and dev tools, so bubbles avoids them: 28225 and 28226 sit in an IANA-unassigned block (28201-28239), below the Linux ephemeral range (32768-60999) and the Windows/macOS ephemeral range (49152+), and clear of common LAN-party game ports. 28225 spells "BUBBL" on a phone keypad.

The default data directory is %LOCALAPPDATA%\bubbles on Windows, ~/Library/Application Support/bubbles on macOS and $XDG_DATA_HOME/bubbles (or ~/.local/share/bubbles) on Linux. Override it with --data-dir.

Common flags, all also available as BUBBLES_* environment variables: --https-addr, --http-addr, --mdns-name (default bubbles, shown as bubbles.local), --no-mdns, --tls-cert and --tls-key, --tls-extra-dns, --allow-public. Run bubbles serve -h for the list.

Docker

The image is multi-arch (linux/amd64 and linux/arm64), built on distroless and runs as a non-root user with data in /data.

docker compose -f deploy/docker/docker-compose.yml up -d --build

The compose file uses host networking so that mDNS (bubbles.local) works. A bridge-network alternative with published ports is included as a comment, but mDNS does not work there; devices use the IP address instead.

Without compose, using a released image:

docker run -d --name bubbles --network host -v bubbles-data:/data \
  ghcr.io/donaldsteele/bubbles:<version>
docker logs bubbles          # setup token and addresses

Use a bind mount (for example -v "$PWD/bubbles-data:/data") if you want the database and files on the host. The container's health check runs bubbles healthcheck.

Run as a service

bubbles service install
bubbles service start
bubbles service status

Windows runs bubbles as a Windows service with a firewall rule on the Private network profile only. macOS uses a LaunchDaemon, and Linux a systemd unit (deploy/systemd/bubbles.service). Details: docs/admin.md.

Connect netdiag and other apps

  • Go SDK: pkg/bubblesclient handles pairing, CA pinning, a reconnecting event stream and a coalescing alert queue, so a flapping device cannot flood the channel.
  • Pairing: the app asks to pair, and an admin approves the request after comparing the code and CA fingerprint.
  • Webhooks: any tool that can post a webhook (Uptime Kuma, Grafana, Home Assistant) can post into a channel without changes.

See docs/integrations.md and docs/netdiag.md.

MCP

The MCP server lets Claude and other agents read channels, post messages and acknowledge alerts with an app token. Run the stdio bridge with:

bubbles mcp --conn "bubbles://192.168.1.20:28225/?token=<app-token>&fp=sha256:<ca-fingerprint>"

The token is read from the connection string or BUBBLES_CONN and is never printed. See docs/mcp.md.

Backup and restore

bubbles backup --out bubbles.bbk --passphrase-file passphrase.txt
bubbles restore bubbles.bbk --passphrase-file passphrase.txt

Backups are encrypted by default. --no-encrypt writes the CA private key in plaintext, so avoid it. Restore refuses a non-empty data directory unless you pass --force. Details: docs/admin.md.

Reset

The admin Danger zone (and bubbles reset on the console) has two actions:

  • Clear content deletes messages, files, pictures, alerts and event history. It keeps users, channels, apps, webhooks and settings.
  • Factory reset wipes everything and returns to the setup wizard with a new setup token. It keeps the CA by default, so devices stay trusted. Generate new CA destroys the old CA key, and attendees must install the new one. Keep server settings carries settings over.

Both need the admin password and the instance name typed. Both offer an encrypted backup first. Erasure is not forensic-grade on SSDs; see docs/security.md.

Build

Requires Go 1.26.9 or newer and Node 26.

npm --prefix web ci
npm --prefix web run build      # writes internal/webui/dist (embedded in the server)
go build ./cmd/bubbles

Release archives for all six targets (windows, darwin, linux on amd64 and arm64):

bash scripts/build.sh           # or: scripts/build.ps1 on Windows

Development

npm --prefix web run dev        # Vite dev server
npm --prefix web run check      # svelte-check, eslint, prettier
npm --prefix web run test       # Vitest
go test ./...

Module path

The Go module is github.com/donaldsteele/bubbles. A fork that publishes under its own path runs scripts/set-module-path.ps1 -Module github.com/<owner>/bubbles once.

License

Apache-2.0. See LICENSE and NOTICE.

Directories

Path Synopsis
cmd
bubbles command
Command bubbles is the single-binary chat server and its admin tooling.
Command bubbles is the single-binary chat server and its admin tooling.
examples
echo-bot command
Command echo-bot registers a /echo slash command and answers every invocation with its arguments, visible only to the person who ran it.
Command echo-bot registers a /echo slash command and answers every invocation with its arguments, visible only to the person who ran it.
netdiag-sender command
Command netdiag-sender is the reference mapping from netdiag-style Notice JSON lines to bubbles alerts.
Command netdiag-sender is the reference mapping from netdiag-style Notice JSON lines to bubbles alerts.
internal
alerts
Package alerts is the alert domain (plan pipeline step 11): an app posts an alert under a dedupe key; repeats update one message instead of flooding the channel, escalations and overdue renotifications are marked as such for the notification dispatcher, members acknowledge and resolve, and a key that was resolved opens a new alert the next time.
Package alerts is the alert domain (plan pipeline step 11): an app posts an alert under a dedupe key; repeats update one message instead of flooding the channel, escalations and overdue renotifications are marked as such for the notification dispatcher, members acknowledge and resolve, and a key that was resolved opens a new alert the next time.
app
Package app is the composition root of `bubbles serve`: it opens the store, loads the TLS material, builds the HTTPS and onboarding handlers, binds both listeners, runs the background jobs and shuts everything down gracefully.
Package app is the composition root of `bubbles serve`: it opens the store, loads the TLS material, builds the HTTPS and onboarding handlers, binds both listeners, runs the background jobs and shuts everything down gracefully.
apps
Package apps is the integration domain: app accounts (a bot user plus the app row), their scoped bearer tokens, the bearer authenticator, per-token rate limits and the pairing flow that hands a new app its first token.
Package apps is the integration domain: app accounts (a bot user plus the app row), their scoped bearer tokens, the bearer authenticator, per-token rate limits and the pairing flow that hands a new app its first token.
audit
Package audit appends rows to the audit_log table.
Package audit appends rows to the audit_log table.
auth
Package auth implements accounts and access control: argon2id passwords with a common-password blocklist, first-run setup, cookie sessions, invites, password-reset links, roles, login and API rate limiting, and the authentication middleware.
Package auth implements accounts and access control: argon2id passwords with a common-password blocklist, first-run setup, cookie sessions, invites, password-reset links, roles, login and API rate limiting, and the authentication middleware.
backup
Package backup creates and restores bubbles backup archives (.bbk).
Package backup creates and restores bubbles backup archives (.bbk).
buildinfo
Package buildinfo holds identifiers stamped into release binaries at link time.
Package buildinfo holds identifiers stamped into release binaries at link time.
chat
Package chat is the chat domain service: channels, direct messages, messages, threads, reactions, pins, read state and the bootstrap snapshot.
Package chat is the chat domain service: channels, direct messages, messages, threads, reactions, pins, read state and the bootstrap snapshot.
config
Package config resolves the bootstrap settings of `bubbles serve` from flags and BUBBLES_* environment variables, prepares the data directory and enforces single-instance and bind policy.
Package config resolves the bootstrap settings of `bubbles serve` from flags and BUBBLES_* environment variables, prepares the data directory and enforces single-instance and bind policy.
discovery
Package discovery advertises the server over mDNS (DNS-SD): a _bubbles._tcp service instance on the HTTPS port plus A/AAAA records for <mdns-name>.local on the ranked LAN interfaces.
Package discovery advertises the server over mDNS (DNS-SD): a _bubbles._tcp service instance on the HTTPS port plus A/AAAA records for <mdns-name>.local on the ranked LAN interfaces.
dnsname
Package dnsname holds the one DNS-name validator shared by configuration parsing and the local CA's name constraints.
Package dnsname holds the one DNS-name validator shared by configuration parsing and the local CA's name constraints.
events
Package events defines the realtime event vocabulary and appends events to the global event log inside a store write transaction.
Package events defines the realtime event vocabulary and appends events to the global event log inside a store write transaction.
files
Package files is the file domain service: streaming uploads into a content-addressed store, metadata stripping, thumbnails, quotas, the permission check and headers of file serving, and the binding of uploaded files to messages.
Package files is the file domain service: streaming uploads into a content-addressed store, metadata stripping, thumbnails, quotas, the permission check and headers of file serving, and the binding of uploaded files to messages.
files/filestest
Package filestest builds the image fixtures of the file tests in Go, so no binary test data is checked in: JPEGs with EXIF (GPS and orientation), XMP, IPTC and comments, PNGs with text and EXIF chunks, WebP files with metadata chunks, an oversized PNG header and an SVG with a script.
Package filestest builds the image fixtures of the file tests in Go, so no binary test data is checked in: JPEGs with EXIF (GPS and orientation), XMP, IPTC and comments, PNGs with text and EXIF chunks, WebP files with metadata chunks, an oversized PNG header and an SVG with a script.
hooks
Package hooks is the incoming-webhook domain (plan pipeline step 12): a secret URL, POST /hooks/{token}, that posts into one channel as a pseudo-app.
Package hooks is the incoming-webhook domain (plan pipeline step 12): a secret URL, POST /hooks/{token}, that posts into one channel as a pseudo-app.
httpapi
Package httpapi is the HTTPS front end: router, middleware (request id, panic recovery, LAN guard, security headers), the JSON error model, the REST handlers and the embedded single-page app.
Package httpapi is the HTTPS front end: router, middleware (request id, panic recovery, LAN guard, security headers), the JSON error model, the REST handlers and the embedded single-page app.
logging
Package logging builds the server logger: JSON lines to a size-rotated file under the data directory plus human-readable text on the console, with helpers that keep secrets out of both.
Package logging builds the server logger: JSON lines to a size-rotated file under the data directory plus human-readable text on the console, with helpers that keep secrets out of both.
mcpserver
Package mcpserver exposes Bubbles to MCP clients (AI agents) as eight tools.
Package mcpserver exposes Bubbles to MCP clients (AI agents) as eight tools.
netutil
Package netutil classifies network addresses, ranks the host's LAN interfaces and guards HTTP handlers so only LAN clients get through.
Package netutil classifies network addresses, ranks the host's LAN interfaces and guards HTTP handlers so only LAN clients get through.
notify
Package notify decides, server-side, who gets a Web Push for a message or an alert (plan pipeline steps 6 and 7).
Package notify decides, server-side, who gets a Web Push for a message or an alert (plan pipeline steps 6 and 7).
onboarding
Package onboarding serves the plain-HTTP onboarding listener: a page that explains how to trust the local CA on each platform, the CA certificate in DER, PEM and iOS profile form, QR codes for this server's HTTPS URLs and invite landing pages.
Package onboarding serves the plain-HTTP onboarding listener: a page that explains how to trust the local CA on each platform, the CA certificate in DER, PEM and iOS profile form, QR codes for this server's HTTPS URLs and invite landing pages.
push
Package push is bubbles' Web Push: VAPID keys, the subscription store, the payload builder and the sender.
Package push is bubbles' Web Push: VAPID keys, the subscription store, the payload builder and the sender.
reset
Package reset implements the two destructive lifecycle operations of a bubbles server (pipeline steps 19 and 20): clear content, which deletes every message, file, alert and event but keeps accounts, channels, apps and settings, and factory reset, which wipes the data directory back to the setup wizard.
Package reset implements the two destructive lifecycle operations of a bubbles server (pipeline steps 19 and 20): clear content, which deletes every message, file, alert and event but keeps accounts, channels, apps and settings, and factory reset, which wipes the data directory back to the setup wizard.
retention
Package retention is the hourly clean-up job: it hard-deletes messages older than the retention of their channel, deletes uploads that were never attached, removes blobs that no file refers to any more, and once a day sweeps the blob store for blobs that no row refers to at all.
Package retention is the hourly clean-up job: it hard-deletes messages older than the retention of their channel, deletes uploads that were never attached, removes blobs that no file refers to any more, and once a day sweeps the blob store for blobs that no row refers to at all.
search
Package search implements full-text message search: the query grammar, the FTS5 MATCH construction, membership filtering, snippets and cursor pagination behind GET /api/v1/search.
Package search implements full-text message search: the query grammar, the FTS5 MATCH construction, membership filtering, snippets and cursor pagination behind GET /api/v1/search.
service
Package service installs bubbles as an operating-system service: a Windows service (SCM), a macOS LaunchDaemon or a Linux systemd unit.
Package service installs bubbles as an operating-system service: a Windows service (SCM), a macOS LaunchDaemon or a Linux systemd unit.
settings
Package settings reads and writes the instance settings stored in the settings table.
Package settings reads and writes the instance settings stored in the settings table.
store
Package store owns the SQLite database file: opening it with the required pragmas, the read pool, the single writer goroutine, schema migrations and ID generation.
Package store owns the SQLite database file: opening it with the required pragmas, the read pool, the single writer goroutine, schema migrations and ID generation.
tlsca
Package tlsca runs the built-in, name-constrained local certificate authority: CA create/load, leaf issue and renewal from the discovered SAN set, hot swap through tls.Config.GetCertificate, bring-your-own certificate reload, fingerprints and the iOS .mobileconfig profile.
Package tlsca runs the built-in, name-constrained local certificate authority: CA create/load, leaf issue and renewal from the discovered SAN set, hot swap through tls.Config.GetCertificate, bring-your-own certificate reload, fingerprints and the iOS .mobileconfig profile.
webui
Package webui serves the embedded Svelte single-page app.
Package webui serves the embedded Svelte single-page app.
wsgateway
Package wsgateway serves the realtime WebSocket endpoint GET /api/v1/ws: authentication (the request's principal) plus the Origin check, the hello frame, resume and replay from the event log, live delivery from the hub, heartbeats, client signal frames and the close codes of docs/protocol.md.
Package wsgateway serves the realtime WebSocket endpoint GET /api/v1/ws: authentication (the request's principal) plus the Origin check, the hello frame, resume and replay from the event log, live delivery from the hub, heartbeats, client signal frames and the close codes of docs/protocol.md.
pkg
bubblesclient
Package bubblesclient is the Go SDK for a bubbles server: CA-pinned TLS, messages, alerts, uploads, slash commands, a reconnecting event stream, an outage-tolerant alert queue, mDNS discovery and pairing.
Package bubblesclient is the Go SDK for a bubbles server: CA-pinned TLS, messages, alerts, uploads, slash commands, a reconnecting event stream, an outage-tolerant alert queue, mDNS discovery and pairing.
notifyrules
Package notifyrules decides whether one message or alert event should notify one recipient (plan pipeline step 6).
Package notifyrules decides whether one message or alert event should notify one recipient (plan pipeline step 6).
protocol
Package protocol holds the wire types of the bubbles REST API.
Package protocol holds the wire types of the bubbles REST API.
tools
distzip command
Command distzip writes a zip archive that stores each named file at the archive root under its base name.
Command distzip writes a zip archive that stores each named file at the archive root under its base name.
e2e-fixtures command
Command e2e-fixtures writes the binary fixtures used by the Playwright suite: a JPEG that carries EXIF GPS, XMP and IPTC metadata and a plain PNG.
Command e2e-fixtures writes the binary fixtures used by the Playwright suite: a JPEG that carries EXIF GPS, XMP and IPTC metadata and a plain PNG.
loadtest command
Command loadtest drives a bubbles server with many realtime clients and reports send-to-receive latency, message loss and server memory.
Command loadtest drives a bubbles server with many realtime clients and reports send-to-receive latency, message loss and server memory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL