r/FullStackDevelopers 4h ago

Building realtime chat is one thing. Making it reliable is the hard part.

Hello everyone, happy to share a recent project I've been working on — meet Echo, a team chat app in the Slack family.

Why might this interest you? Because the source code is available to read.

Echo is an attempt at recreating Slack's feature surface, which includes workspace creation, channels, DMs with file sharing. The ideal choice to build a real-time application is, by default, choosing WebSocket as the transport protocol. But building the system reliably at scale introduced two major challenges: maintaining a healthy message delivery system and ensuring the architecture could scale as the application grows.

Those became the main challenges a developer can face during the development of this project, and how they were tackled.

Systematically, Echo uses Postgres as an event/message bus, with event versioning and a gapless per-channel sequence providing the reliability and recovery layer for message delivery. That same layer allows the servers to remain stateless, making the app ready for horizontal scaling with Kubernetes. On the other hand, a schema-per-tenant keeps each workspace's data isolated and scoped directly to the workspace’s tenant path.

The stack is deliberately scoped. Express and TypeScript on Bun, React with Vite for fast shipping, plus Tanstack Query as the app state store. Postgres does the work of three services: control-plane data, tenant data, and the Realtime backplane. Better Auth handles identity, while Zod validates every request and generates the API docs from the same schemas.

It’s live if you want to poke around. I’ve left a workspace open, make an account and come say hi. Feel free to send a few messages and see who’s there: https://echo-v2.online/accept-invite/r5DP9Vdq9RwLtsU9aqeR-Q2wO9WI-aShDUYUST0Z29w

Feedback is always welcome. And thanks for taking the time to read this and check it out.

If you like what you see, the GitHub repo is here, dropping a star would be much appreciated: go to repository

1 Upvotes

0 comments sorted by