Skip to content
YSYousef SelawiSoftware Engineer

Web · PWA · 2026

Selawigram

A private, invite-only messenger with end-to-end encryption and calls.
Selawigram chat screen

Agentic engineering

I plan each project in a long conversation with an AI assistant, which writes up what we settle as a brief. Claude Code builds from that brief while I test, change scope and steer. How I work.

What I owned

  • The idea, the feature set and what to leave out
  • The plan: a long brainstorm with an AI assistant, turned into a written brief
  • Agreeing the architecture, stack and rules in the brainstorm
  • Reshaping scope as it came together: features added, changed and cut
  • Testing on real devices and in daily use

What the agent did

  • Building from the brief, phase by phase
  • Writing the code, the tests and the documentation
  • Fixing what testing turned up

Selawigram is a private messenger for a closed group of people. Members join by invite and install it straight from the browser on a phone or computer, with no app store involved. It has one-to-one and group chats, voice notes, polls, stickers, one-to-one and group video calls, screen sharing, encrypted backups and passkey login. Every message, photo and call is encrypted on the device, so the server only ever handles ciphertext.

The brief was simple to say and hard to build: a messenger that feels as complete as a mainstream one, where the person running the server can read nothing.

1. Proven cryptography, not custom crypto

The first decision was to not invent anything. The app uses a TypeScript implementation of the Signal Protocol, and every device gets its own Signal identity. A message is encrypted once per recipient device and posted as a set of envelopes. The Django backend stores only metadata and those envelopes, pushes them over WebSockets, holds them for offline devices, and deletes each one as soon as its device confirms delivery.

Media is encrypted with AES-256-GCM before upload and its key travels inside the Signal message. Keys and history live in IndexedDB on the device. Because history exists only on devices, the app has a passkey-protected encrypted backup, so losing a phone doesn't mean losing every conversation.

2. Encryption that repairs itself

Encrypting to every device means the device list can change in the middle of a send. The contract for that case is simple: the server rejects the send with a 409 listing the missing or stale devices, and the client re-encrypts and retries. When a message can't be decrypted, the app resets that one session and asks that one device to resend, and only members and devices that were present when the message was sent may ask.

Sending is outbox-based. Messages are saved locally first and sent on reconnect, and a client-generated id makes every send idempotent, so a retry can never produce a duplicate.

3. One web app instead of three native ones

The app is a single installable web app instead of native iOS and Android apps, with Web Push for notifications. That keeps one codebase, one release process and no app-store review. The one exception is a small Android wrapper for car head units, whose browser can't install web apps.

Calls use two architectures, picked per case. One-to-one calls are peer-to-peer WebRTC, with signalling encrypted over the socket and a TURN relay as fallback. Group calls go through a self-hosted LiveKit server with LiveKit's end-to-end encryption, rather than a mesh where every member connects to every other member.

Making updates safe

A web app that caches its own code has a failure mode native apps don't: a bad update can leave the app unable to start. During a deploy, missing files could come back as the HTML page with a 200 status, and the service worker would cache that page as code. It became a design problem rather than a one-off bug, with layered defences: the service worker rejects responses of the wrong type, an update only activates after its version is verified, stable file names are served with no-cache, and a startup check shows a Repair screen that never touches chats or keys.

Call notifications got the same treatment. A late push could resurrect "Incoming call" after the call had ended, so the service worker now remembers ended calls and rings expire.

Quality bar

  • About 260 automated tests, covering crypto, the messaging engine, polls, call sessions and the backend API.
  • Backend deploys gated by CI on lint, formatting and tests.
  • Passkey login, HttpOnly session cookies with CSRF protection, and a database with no public exposure.

Stack. React, TypeScript, TanStack Router, Django, Django Ninja, Django Channels, PostgreSQL, Redis, Celery, Signal Protocol, WebRTC, LiveKit.

Next case studySelawi Cam

Questions about this project? Email me.