~/asadsiddiqui

Complete

Private Chat

Private Chat is a minimal, secure chat application that allows two users to communicate in a short-lived room with realtime updates and automatic destruction.

Screenshot 0
Screenshot 1
Screenshot 2
Screenshot 3

Tech Stack

Next.js (App Router)React 19TypeScriptTailwind CSS@tanstack/react-queryElysiaUpstash RedisUpstash RealtimeZodnanoidBun

The Problem

Most chat applications require persistent accounts and store conversations indefinitely, which is unsuitable for short-lived, private conversations.

  • 1.

    No lightweight way to create temporary private chats

  • 2.

    Lack of participant limits in shared chat links

  • 3.

    Messages persist longer than necessary

  • 4.

    Overhead of authentication and user management

The Solution

Private Chat enables ephemeral, secure conversations by enforcing strict room limits, time-based destruction, and realtime synchronization.

  • 1.

    Private, shareable chat rooms

  • 2.

    Maximum of two participants per room

  • 3.

    Self-destructing rooms with TTL countdown

  • 4.

    Realtime message synchronization

  • 5.

    Manual room destruction with instant client sync

Architecture

A real-time, event-driven chat system built on Next.js with Redis-backed state and pub/sub communication.

  • 1.

    Next.js App Router for UI and routing

  • 2.

    Elysia-based API mounted under Next.js

  • 3.

    Upstash Redis for room metadata and message storage

  • 4.

    Upstash Realtime for pub/sub events

  • 5.

    Server-side request gate for room access control

Key Technical Decisions

  • 1.

    Used Redis with TTL-based keys for room lifecycle management

    Enabled automatic room expiration without background cleanup jobs

  • 2.

    Restricted rooms to two participants at request-time

    Guaranteed privacy and prevented race conditions in room access

  • 3.

    Adopted realtime pub/sub instead of WebSocket servers

    Simplified infrastructure while retaining realtime behavior

Challenges & Resolutions

  • 1.

    Preventing unauthorized access to rooms

    Implemented cookie-based auth tokens validated against room metadata

  • 2.

    Keeping message history and room TTL in sync

    Aligned Redis key expirations on every message write

  • Future Enhancements

    • 1.

      Optional end-to-end encryption

    • 2.

      Configurable room TTL

    • 3.

      Read receipts and typing indicators

    • 4.

      Audit-safe message redaction

    © 2026 Asad Siddiqui. All rights reserved.

    Building clean, production-ready applications.