Skip to content

Repository files navigation

Realtime Private Chat

A realtime, private, self-destructing chat application built using Next.js, Redis, and Upstash Realtime.

Create a temporary chat room, share the link with a friend, and start chatting instantly.
Rooms automatically expire and all messages are permanently deleted.

Features

  • Private chat rooms
  • Self-destructing rooms (auto TTL)
  • Realtime messaging using WebSockets
  • Max 2 users per room
  • Auto-generated anonymous usernames
  • One-click room link copy
  • Manual "destroy room" option
  • Automatic cleanup using Redis TTL

Tech Stack

  • Next.js (App Router)
  • React
  • Upstash Redis
  • Upstash Realtime
  • Elysia (API routing)
  • Zod (validation)
  • Tailwind CSS
  • React Query

How It Works

  1. User creates a room
  2. A unique room ID is generated
  3. Redis stores room metadata with TTL
  4. Realtime connections are established
  5. Messages are broadcast instantly
  6. Room auto-destroys when TTL expires
  7. All messages are permanently deleted

Running Locally

1. Clone the repository

git clone https://github.com/yourusername/realtime_chat.git
cd realtime_chat

2. Install dependencies

npm install

3. Setting up environment variables

UPSTASH_REDIS_REST_URL=your_url
UPSTASH_REDIS_REST_TOKEN=your_token
NEXT_PUBLIC_BASE_URL=http://localhost:3000

4. Start development server

npm run dev

About

A realtime private chat app built with Next.js, Redis, and Upstash Realtime where users can create temporary self-destructing chat rooms and talk securely. Messages and rooms automatically expire, making conversations fully ephemeral.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages