A private, self-destructing chat application with real-time messaging
Next.js β’ React β’ TypeScript β’ Elysia β’ Upstash
- Self-Destructing Rooms: All messages automatically expire after 10 minutes
- Anonymous Identity: Animal-based usernames for privacy
- No Logs: Messages are permanently deleted after expiration
- Room Capacity: Maximum 2 users per room for intimate conversations
- Instant Messaging: Real-time message delivery using Upstash Realtime
- Live Updates: Messages appear instantly without page refresh
- Room Sharing: Easy link sharing to invite others
- Manual Destruction: Option to destroy room immediately
- Dark Theme: Beautiful technical aesthetic with dark backgrounds
- Responsive Design: Works seamlessly on desktop and mobile
- Smooth Animations: Polished interactions and transitions
- Status Indicators: Real-time connection and encryption status
- Node.js 20+ (or Bun)
- Upstash Account (for Redis and Realtime)
- npm, yarn, pnpm, or bun
-
Clone the repository
git clone https://github.com/adithpv/Ghost-chat-app cd ghost-chat-app -
Install dependencies
npm install # or bun install -
Set up environment variables
Create a
.env.localfile in the root directory:UPSTASH_REDIS_REST_URL=your_redis_rest_url UPSTASH_REDIS_REST_TOKEN=your_redis_rest_token
-
Run the development server
npm run dev # or bun dev -
Open your browser
Navigate to http://localhost:3000
- Next.js 16 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- Tailwind CSS 4 - Styling
- TanStack Query - Data fetching and caching
- Eden - Type-safe API client
- Upstash Redis - Serverless Redis for message storage
- Upstash Realtime - Real-time pub/sub for live messaging
- ESLint - Code linting
- Prettier - Code formatting
- React Compiler - Automatic optimization
- Enter the lobby and get assigned an anonymous animal-based username
- Click "Create Secure Room" to generate a new chat room
- Share the room link with another person
- Start chatting in real-time!
- Messages are sent to the Elysia backend API
- Stored in Upstash Redis with automatic expiration
- Broadcasted via Upstash Realtime to all connected clients
- Displayed instantly in the chat interface
- Rooms automatically expire after 10 minutes of activity
- All messages are permanently deleted from Redis
- Users are redirected to the lobby with a destruction notification
- Manual destruction option available at any time
ghost-chat-app/
βββ src/
β βββ app/ # Next.js app directory
β β βββ api/ # API routes (Elysia backend)
β β βββ room/[roomId]/ # Chat room page
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home/lobby page
β βββ components/
β β βββ lobby/ # Lobby components
β β β βββ LobbyHeader.tsx
β β β βββ LobbyAlert.tsx
β β β βββ LobbyControls.tsx
β β β βββ LobbyVisual.tsx
β β β βββ LobbyStatusPanel.tsx
β β βββ providers/ # React context providers
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utilities and clients
β βββ schemas/ # Zod schemas
β βββ utils/ # Helper functions
βββ public/ # Static assets
βββ package.json
Users are assigned random animal-based usernames (cat, dog, elephant, etc.) stored locally in the browser. This ensures privacy while maintaining a fun, memorable identity.
Each room supports exactly 2 users to ensure intimate, private conversations. If a third person tries to join, they'll see a "Room Full" error.
Using Upstash Realtime's pub/sub system, messages are instantly broadcasted to all connected clients without polling or manual refresh.
All rooms have a TTL (Time To Live) of 10 minutes. After expiration, all messages are permanently deleted from Redis, ensuring no data persistence.
# Development
npm run dev # Start development server
# Production
npm run build # Build for production
npm run start # Start production server
# Code Quality
npm run lint # Run ESLint
npm run format # Format code with Prettier| Variable | Description | Required |
|---|---|---|
UPSTASH_REDIS_REST_URL |
Upstash Redis REST API URL | β |
UPSTASH_REDIS_REST_TOKEN |
Upstash Redis REST API Token | β |
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables in Vercel dashboard
- Deploy!
Ghost Chat can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- Render
- Fly.io
- AWS Amplify
Make sure to set all required environment variables in your deployment platform.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Next.js for the amazing framework
- Elysia for the fast backend
- Upstash for serverless Redis and Realtime
- Tailwind CSS for the styling system

