Elephant

A privacy-first, self-hostable messenger. Signal Protocol end-to-end encryption, a Go backend and a Flutter app.

Status
Active · v0.3.2 (November 2026)
Role
Started the project; wrote most of the Go server and much of the Flutter app. Built with Chandru and Manideep, with app fixes from Hamdan.
Stack
Go · Flutter · PostgreSQL 16 · Signal Protocol · Docker
Links
Source · Releases · Docker Hub

Problem #

Most messengers ask you to trust the server. I wanted one where the server can’t read direct messages, that anyone can run on their own hardware, and whose code is open (AGPL-3.0). The goal was a real system, not a demo. That meant real-time delivery, working offline, sane auth, and releases people can install.

Approach #

Elephant is three tiers: a Flutter client, a Go server and PostgreSQL 16.

Architecture #

Flutter app ──HTTPS──> chi router + middleware
     │                 (CORS, rate limit, logging, JWT)
     │                          │
     │                          ▼
     │                 controllers ─> services ─> repository
     │                                   ▲            │
     └─────WSS───> WebSocket hub ────────┘            │ pgx pool
                   (goroutine + buffered              ▼
                    send channel per            PostgreSQL 16
                    connection)

The server follows a strict layering: routes/, middlewares/, controllers/, services/, repository/, models/. Only the repository layer talks to the database.

The WebSocket hub is the core of the design. Each connection gets its own goroutine and its own buffered send channel. When a message arrives, the hub looks up the recipient’s connection and writes to that channel. A writer goroutine drains it. A slow or stalled client can only back up its own channel. It can’t block the hub or anyone else.

On the server side I built the key-distribution API: uploading identity keys and prekeys, fetching a prekey bundle, and recording or resetting verification. Chandru built the client-side Signal integration on top of it.

Trade-offs #

Results #

Status and next steps #

Elephant is actively developed. Next up: rate limiting on the auth endpoints, end-to-end encryption for group chats, and getting the F-Droid listing merged.