End-to-end encryption (E2EE) sounds simple: encrypt on the sender's device, decrypt on the recipient's, and the server in the middle only sees ciphertext. When building E2EE Chat , the harder part wasn't the algorithms but one question: what if the server itself cheats?
This post walks through the app's key design, which libsodium primitive does which job, and the general limits every design of this kind has to accept. If you're learning about E2EE, I hope it helps you see how the pieces fit together.
System overview
Part Stack
Web app (PWA) React 19, TanStack Router and Query, Tailwind CSS 4, libsodium
API Fastify 5, Drizzle ORM on PostgreSQL, Centrifugo, Web Push
Files S3-compatible object storage
Accounts Keycloak, OpenID Connect with PKCE
Reads and writes go through REST, and every change (new messages, typing, read markers…) is pushed in real time over Centrifugo (Socket.IO until November 2026).…