Overview
Discover what makes Databag powerful
Databag is a lightweight, federated messenger designed for self‑hosting environments. At its core it implements a **topic‑based** communication model rather than traditional one‑to‑one contact lists, enabling unlimited participants per thread while keeping the server footprint minimal enough to run on a Raspberry Pi Zero. The application exposes a RESTful API and WebSocket endpoints for real‑time messaging, authentication, and call signalling. End‑to‑end encryption is enforced at the application layer using asymmetric key pairs that are **not** tied to any blockchain or domain, ensuring that even a privileged administrator cannot read sealed topics.
Decentralized & Federated
Public‑Private Key Identity
End‑to‑End Encryption
Audio/Video Calls
Overview
Databag is a lightweight, federated messenger designed for self‑hosting environments. At its core it implements a topic‑based communication model rather than traditional one‑to‑one contact lists, enabling unlimited participants per thread while keeping the server footprint minimal enough to run on a Raspberry Pi Zero. The application exposes a RESTful API and WebSocket endpoints for real‑time messaging, authentication, and call signalling. End‑to‑end encryption is enforced at the application layer using asymmetric key pairs that are not tied to any blockchain or domain, ensuring that even a privileged administrator cannot read sealed topics.
Key Features
- Decentralized & Federated – Nodes communicate directly over HTTPS/WebSocket; users on separate instances can chat without a central broker.
- Public‑Private Key Identity – Users generate key pairs locally; the server stores only a public identifier, preserving privacy.
- End‑to‑End Encryption – All payloads are encrypted client‑side; the server only relays ciphertext.
- Audio/Video Calls – Signalling via WebSocket; NAT traversal requires an external TURN/STUN relay (not bundled).
- Topic‑Based Threads – Messages are grouped by topic; threads can have unlimited members.
- Low Latency Push – WebSocket push events replace polling, enabling near real‑time notifications.
- Multi‑Factor Authentication – TOTP integration for added account security.
Technical Stack
| Layer | Technology |
|---|---|
| Backend | Go (latest stable) – high concurrency, static binaries. |
| WebSocket & REST | Gorilla WebSocket, standard net/http. |
| Database | PostgreSQL (or SQLite for minimal setups) – stores user metadata, public keys, and message indices. |
| Storage | Local filesystem for media; optional S3‑compatible object storage via API. |
| Encryption | NaCl / libsodium for ECDH key exchange, AEAD‑GCM for payloads. |
| Containerization | Prebuilt Docker images (arm64, amd64) on Docker Hub; Docker‑Compose templates for Swag (NGINX+LetsEncrypt). |
| Client SDKs | Native Android/iOS apps (Java/Kotlin, Swift) and a web client using React/TypeScript. |
The server binary is statically compiled, allowing it to run on any Linux distribution without external dependencies. The minimal footprint and use of WebSockets make the application suitable for edge deployments.
Core Capabilities & APIs
- Authentication – JWT‑based session tokens; TOTP support via
/api/auth/totp. - User Management – CRUD endpoints for user profiles and key rotation.
- Topic APIs – Create, delete, invite participants;
/api/topics/{id}/messagessupports pagination and read receipts. - Messaging – POST
/api/messageswith signed payload; WebSocket channelws://<node>/wsfor real‑time delivery. - Call Signalling – WebSocket messages
call-init,call-answer,ice-candidatefor WebRTC. - Webhooks – Optional outbound hooks for new messages or calls, configurable per topic.
All APIs are documented in OpenAPI format and available under /api/docs. The client SDKs consume these endpoints directly, providing a consistent developer experience.
Deployment & Infrastructure
Databag is intentionally minimalistic: a single Go binary, a PostgreSQL instance, and an optional TURN server for calls. It can be run:
- On bare metal – as a systemd service or Docker container.
- In containers – prebuilt images support both
amd64andarm64. - With Docker‑Compose – the provided
compose.yamlordocker-compose-swag.ymlincludes NGINX reverse proxy and automatic Let’s Encrypt certificates. - Scalable – multiple instances can be load‑balanced; the database is the single point of coordination, but reads can be sharded if needed.
Because the server stores only public keys and encrypted payloads, a compromised node does not expose user data. The lightweight design also allows scaling to thousands of concurrent WebSocket connections on modest hardware.
Integration & Extensibility
- Plugin System – The core exposes a Go plugin interface; third‑party modules can add new message types, custom authentication backends, or analytics.
- Webhooks & Callbacks – External services can subscribe to topic events via HTTPS callbacks.
- API Hooks – Custom middleware can be injected into the HTTP stack for rate‑limiting, logging, or feature toggles.
- Cross‑Platform Clients – The web client is open source; developers can fork or embed it in other applications.
- Federation Protocol – The node communicates with peers using a JSON‑over‑HTTPS spec; developers can implement new federation nodes in any language that supports the same API surface.
Developer Experience
- Configuration – Environment variables (
DB_URL,DOMAIN,TURN_*) control all aspects; no hard‑coded defaults. - Documentation – The
doc/folder contains a design overview, API spec, and Figma UI files. - Community – Active GitHub issues, Slack channel, and a Figma file for UI feedback.
- Testing – The repository includes unit tests and integration scripts; CI runs on GitHub Actions.
The developer workflow is straightforward: pull the repo, run docker-compose up, and start hacking on the Go
Open SourceReady to get started?
Join the community and start self-hosting Databag today
Related Apps in apis-services
Mastodon
Decentralized, real‑time social networking
Discourse
Open‑source community forum platform with real‑time chat and AI
Rocket.Chat
Secure, open‑source team communication platform
Novu
Unified notification platform for multi‑channel delivery
Mattermost
Secure, self‑hosted team collaboration with chat, voice, and AI
Jitsi Meet
Free, encrypted video conferencing for everyone
Weekly Views
Repository Health
Information
Explore More Apps
Damselfly
Fast, AI‑powered photo management for large collections
Simple Machines Forum
Open‑source, customizable community forum software
Aptabase
Privacy‑first analytics for mobile, desktop and web apps
Pinchflat
Automated YouTube downloader for self-hosted media stacks

GitLab
All-in-one DevSecOps platform for secure, fast software delivery
Koel
Self‑hosted web music streaming for developers