
Realtime Private Chat
Minimal, secure real-time chat experience with ephemeral room flow and terminal-inspired dark UI.
Timeline
2 Weeks
Role
Full Stack Engineer
Team
Solo
Status
CompletedTechnology Stack
Key Challenges
- Implementing end-to-end type safety between frontend and backend
- Managing real-time WebSocket state and reconnections
- Engineering the self-destructing room mechanism
Key Learnings
- Building high-performance APIs with Elysia.js and Eden
- Leveraging serverless Upstash Redis for pub/sub messaging
- Optimizing client-side caching with TanStack Query
Realtime Private Chat
Situation
Building a responsive chat application usually requires setting up heavy dedicated WebSocket servers and managing complex database relationships just to support simple messaging. I wanted to engineer an ephemeral, highly secure chatting experience where users could spin up instant, self-destructing rooms without the overhead of heavy backend infrastructure.
Task
The objective was to create an instant messaging platform focused on privacy and speed. It needed to:
- Support real-time messaging with sub-second latency.
- Allow users to create distinct chat rooms seamlessly.
- Implement an ephemeral, self-destructing countdown mechanism where rooms and their messages are permanently deleted.
- Ensure end-to-end type safety to prevent runtime errors between the client and server.
Action
I developed a modern, serverless-oriented chat architecture utilizing Next.js for the frontend and Elysia.js for an incredibly fast backend API.
1. Serverless Pub/Sub & Persistence
- Replaced traditional stateful WebSocket servers by integrating Upstash Redis, utilizing its Realtime pub/sub capabilities for instant message delivery.
- Designed an ephemeral data model where recent message history is cached in Redis upon room entry, guaranteeing fast loading times.
2. End-to-End Type Safety
- Built the backend using Elysia.js, and consumed the API on the frontend via the Eden client. This ensured that API routes, request payloads, and response structures were perfectly synchronized and strictly typed.
- Utilized TanStack Query to efficiently manage server state and cache data on the client side without unnecessary refetches.
3. Ephemeral Room Flow
- Created a unique "self-destructing" mechanism. A countdown timer triggers a sweeping action that completely wipes all room-related data from Redis, ensuring true privacy.
- Developed a terminal-inspired, responsive dark UI with TailwindCSS v4, featuring auto-generated anonymous usernames stored in the browser's local storage to reduce onboarding friction.
Result
The Realtime Private Chat app delivers a secure, instantaneous messaging experience.
- High Performance: The combination of Elysia.js and Upstash ensures real-time updates are pushed with minimal latency.
- Reliable Engineering: Utilizing Eden for end-to-end type safety drastically reduced API integration bugs during development.
- Privacy First: The successful implementation of the self-destruct countdown mechanism perfectly addresses the core requirement of secure, temporary communication.
