Anonymous Chat is a privacy-first, real-time messaging application that enables instant communication without any data persistence. Built with modern web technologies, it provides a secure, ephemeral chatting experience where conversations vanish the moment participants leave.
🔐 Privacy Promise: No databases, no logs, no history. Your conversations are truly temporary.
|
|
|
graph LR
A[👤 User Visits] --> B{Action?}
B -->|Create| C[🆕 Generate Room Code]
B -->|Join| D[🔑 Enter Room Code]
C --> E[📋 Share Code/Link]
D --> F[✍️ Enter Display Name]
E --> F
F --> G[💬 Start Chatting]
G --> H[👋 Leave Room]
H --> I[🗑️ Messages Vanish]
- Create a Room - Get a unique 8-character room code
- Share the Link - Copy and send the room URL or code
- Join & Chat - Enter your display name and start messaging
- Leave Anonymously - No trace left behind when you exit
┌─────────────────────────────────────────────────────────────┐
│ Client (Browser) │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ Next.js App (React + TypeScript) │ │
│ │ • Page Routing │ │
│ │ • Socket.io Client │ │
│ │ • Tailwind CSS Styling │ │
│ └────────────────────────────────────────────────────────┘ │
└───────────────────────────┬─────────────────────────────────┘
│ WebSocket Connection
↕
┌───────────────────────────┴─────────────────────────────────┐
│ Custom Node Server │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ Socket.io Server │ │
│ │ • Room Management (In-Memory) │ │
│ │ • Message Broadcasting │ │
│ │ • User Presence Tracking │ │
│ └────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
⚠️ No Database Layer ⚠️
Ensure you have Node.js 18+ and npm 8+ installed on your machine.
node --version # Should be v18.0.0 or higher
npm --version # Should be 8.0.0 or higher1️⃣ Clone the repository
git clone https://github.com/yourusername/anon-chat.git
cd anon-chat2️⃣ Install dependencies
npm install3️⃣ Run development server
npm run dev4️⃣ Open in browser
Navigate to http://localhost:3000 🎉
# Build the application
npm run build
# Start production server
npm startThe server will start on port 3000 (or PORT environment variable).
anon-chat/
├── 📄 server.js # Custom Node.js + Socket.io server
├── 📄 next.config.js # Next.js configuration
├── 📄 tailwind.config.js # Tailwind CSS configuration
├── 📄 tsconfig.json # TypeScript configuration
├── 📦 package.json # Dependencies and scripts
│
└── 📂 app/ # Next.js App Router
├── 📄 layout.tsx # Root layout with metadata
├── 📄 page.tsx # Home page (create/join room)
├── 📄 globals.css # Global styles and animations
│
└── 📂 chat/
└── 📂 [roomCode]/
└── 📄 page.tsx # Chat room interface
- No Database - All data stored in server memory only
- Auto-Cleanup - Rooms deleted automatically when empty
- No Tracking - Zero cookies, analytics, or user identification
- Client-Side Only - Display names never leave the socket connection
- No History - Late joiners cannot see previous messages
- Real-time Messaging - Instant message delivery via WebSockets
- Room System - Unique 8-character alphanumeric room codes
- Multi-User Support - Unlimited participants per room
- Typing Indicators - See when others are composing messages
- User Presence - Live count of online participants
- Join/Leave Notifications - System messages for user activity
- Link Sharing - One-click copy of room invitation link
- No Registration - Start chatting immediately
- Name Selection - Choose any display name per room
- Mobile Responsive - Optimized for phones and tablets
- Dark Mode - Modern dark theme with gradient backgrounds
- Smooth Animations - Fade-in effects and typing indicators
- Keyboard Shortcuts - Press Enter to send messages
- Auto-Scroll - Messages automatically scroll to bottom
| Event | Payload | Description |
|---|---|---|
join-room |
{ roomCode, username } |
Join a chat room |
send-message |
{ roomCode, content, username } |
Send a message |
typing |
{ roomCode, username, isTyping } |
Update typing status |
disconnect |
- | User leaves (automatic) |
| Event | Payload | Description |
|---|---|---|
message |
{ id, type, content, username, timestamp } |
New message received |
user-joined |
{ username, message } |
User joined notification |
user-left |
{ username, message } |
User left notification |
online-users |
string[] |
Updated list of online users |
user-typing |
{ username, isTyping } |
Typing indicator update |
# Server Configuration
PORT=3000 # Server port (default: 3000)
NODE_ENV=production # Environment mode- Room Code Length: Modify in
app/page.tsx(line 13) - Socket.io Config: Adjust in
server.js(lines 21-25) - Theme Colors: Update in
tailwind.config.js - Typing Timeout: Change in
app/chat/[roomCode]/page.tsx(line 168)
Contributions are welcome! Here's how you can help:
- 🍴 Fork the repository
- 🔨 Create a 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
- No Persistence - Messages lost on server restart (by design)
- No File Sharing - Text messages only
- No Encryption - WebSocket traffic not end-to-end encrypted
- Memory-Based - High user count may impact server memory
This project is licensed under the MIT License - see the LICENSE file for details.
Aditya Raj
- Portfolio: adityaraj.vercel.app
- GitHub: @aditya8raj