A modern, real-time chat application where users can communicate temporarily without registration. Each user receives a random temporary ID valid only for the current session.
Welcome Screen Initial screen where users can see their temporary ID and connect with others
Incoming Connection Notification when another user wants to connect
Chat Screen Real-time chat interface with message history and typing indicators
β¨ No Registration Required - Just open and chat
π Temporary User IDs - Random 6-character IDs generated on connection
β‘ Real-time Messaging - Instant message delivery using WebSocket
π Session-based - All data is temporary and cleared when users disconnect
π₯ Peer-to-Peer Connection - Connect directly with another user using their ID
π¬ Typing Indicators - See when the other user is typing
π± Responsive Design - Works seamlessly on desktop and mobile
- React 18 - Modern UI library
- Vite - Fast build tool and dev server
- Socket.IO Client - WebSocket client
- CSS3 - Modern styling with animations
- Node.js - JavaScript runtime
- Express - Web application framework
- Socket.IO - Real-time bidirectional event-based communication
- ES Modules - Modern JavaScript module system
tempchat/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # React components
β β β βββ WelcomeScreen.jsx
β β β βββ WelcomeScreen.css
β β β βββ ConnectionRequest.jsx
β β β βββ ConnectionRequest.css
β β β βββ ChatInterface.jsx
β β β βββ ChatInterface.css
β β β βββ MessageList.jsx
β β β βββ MessageList.css
β β β βββ MessageBubble.jsx
β β β βββ MessageBubble.css
β β βββ context/ # React context for state management
β β β βββ ChatContext.jsx
β β βββ hooks/ # Custom React hooks
β β β βββ useSocket.js
β β βββ services/ # Service layer
β β β βββ socketService.js
β β βββ App.jsx # Main App component
β β βββ App.css
β β βββ main.jsx # Entry point
β β βββ index.css # Global styles
β βββ index.html
β βββ vite.config.js
β βββ package.json
β βββ .env
β
βββ server/ # Express backend
β βββ src/
β β βββ controllers/ # Request handlers
β β β βββ socketController.js
β β βββ services/ # Business logic
β β β βββ userService.js
β β βββ utils/ # Utility functions
β β β βββ logger.js
β β βββ index.js # Server entry point
β βββ package.json
β βββ .env
β βββ .env.example
β
βββ package.json # Root package.json
βββ .gitignore
βββ README.md
- Node.js >= 18.0.0
- npm or yarn
# Clone the repository git clone <your-repo-url> cd tempchat # Install root dependencies npm install # Install all dependencies (client + server) npm run install:all
Run both client and server concurrently:
npm run dev
This will start:
- Frontend dev server at
http://localhost:5173 - Backend server at
http://localhost:5000
Start Backend:
npm run dev:server
Start Frontend:
npm run dev:client
PORT=5000 CLIENT_URL=http://localhost:5173 NODE_ENV=development
VITE_SERVER_URL=http://localhost:5000
-
Open the Application - Navigate to
http://localhost:5173 -
Get Your ID - The system automatically assigns you a temporary user ID (e.g.,
ABC123) -
Share Your ID - Share your ID with someone you want to chat with
-
Connect - Enter the other user's ID in the connection form and click "Connect"
-
Chat - Once connected, start sending messages in real-time
-
Disconnect - Click the disconnect button (β) to end the conversation
GET /health # Health check endpoint
GET /api/info # API information
connection:request- Request connection to another userconnection:accept- Accept incoming connection requestmessage:send- Send a messagetyping:start- Start typing indicatortyping:stop- Stop typing indicatorconnection:disconnect- Disconnect from current chat
user:assigned- Receive assigned user IDconnection:success- Connection establishedconnection:request:received- Incoming connection requestconnection:accepted- Connection request acceptedconnection:error- Connection errorconnection:ended- Connection terminatedmessage:received- New message receivedtyping:user- Other user typing status
- Service Layer Pattern - Business logic separated into services
- Event-driven Architecture - Socket.IO handles real-time events
- In-memory Storage - User data stored temporarily in memory
- Room-based Communication - Isolated chat rooms for each connection
- Context API - Global state management
- Custom Hooks - Reusable logic for Socket.IO integration
- Component-based - Modular and maintainable UI components
- Service Layer - Socket.IO client abstraction
- 6-character alphanumeric IDs (e.g.,
A1B2C3) - Generated on connection
- Unique across active sessions
- Automatically cleaned up on disconnect
- No database required
- All data stored in memory
- Automatic cleanup on disconnect
- No persistent user data
- WebSocket-based (Socket.IO)
- Instant message delivery
- Typing indicators
- Connection status updates
- Backend: Add socket events in
socketController.js - Frontend: Add event handlers in
useSocket.jshook - UI: Create components in
client/src/components/
- ES6+ features
- Functional components with hooks
- CSS modules for styling
- Comprehensive comments
cd client
npm run buildUpdate environment variables for production:
- Set proper CORS origins
- Update server URLs
- Set NODE_ENV to
production
- Frontend: Vercel, Netlify, or Cloudflare Pages
- Backend: Railway, Render, or Heroku
- Note: Ensure WebSocket support on hosting platform
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- No message persistence
- No chat history
- Single active connection per user
- No file sharing
- No group chats
- Message history (in-session)
- File/image sharing
- Group chat support
- Emoji picker
- Message reactions
- Audio/video calls
- End-to-end encryption
- Multiple simultaneous connections
- User status (online/offline)
- Dark mode
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For issues and questions, please open an issue on GitHub.
Made with β€οΈ using React and Express