ZapRoom is a real-time, room-based chat application built with WebSocket technology. It allows users to join chat rooms and exchange messages instantly—no login or authentication required. Designed for simplicity and speed, ZapRoom delivers seamless messaging through a lightweight Node.js backend and a modern React frontend.
- Real-Time Messaging: Instant message delivery using WebSockets.
- Room-Based Chat: Create or join any room by simply entering a Room ID.
- Message History: New users instantly see the last 50 messages upon joining.
- Typing Indicators: See when other users in the room are typing.
- Private Messages (DMs): Send direct messages to other users within the same room.
- Automatic Host Assignment: The first user to join a room becomes the host.
- Lock Room: The host can lock a room to prevent new users from joining.
- Kick User: The host can remove a user from the room.
- Ban User: The host can permanently ban a user from rejoining the room.
- Input Validation & Sanitization: Protects against invalid data and XSS attacks.
- Rate Limiting: Prevents users from spamming the chat.
- Heartbeat & Liveness Checks: Automatically detects and removes dead connections.
- Graceful Shutdown: Server notifies clients and cleans up resources before shutting down.
- Modern UI: Clean and responsive interface built with Shadcn UI + Tailwind CSS.
- Dark Mode: Seamlessly switch between light and dark themes.
- Real-Time User List: See who is currently in the room.
- Toast Notifications: Get clear feedback for system events and errors.
- Auto-Reconnect: Client automatically attempts reconnection if disconnected.
- Runtime: Node.js
- Language: TypeScript
- Framework: WebSocket (
wslibrary) - Deployment: Railway
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: Shadcn UI
- Deployment: Railway
ZapRoom is configured for seamless deployment on Railway. The project includes railway.toml files in both the frontend and backend directories.
- Create a new empty project on Railway.
- Deploy from your GitHub repository.
- Railway will detect the monorepo-style setup and deploy both services (
zaproom-frontendandzaproom-backend). - Environment Variables:
- On the
zaproom-frontendservice, add a variable:NEXT_PUBLIC_WS_URL=wss://<your-backend-railway-url>
- On the
- Install Node.js (comes with npm).
Clone the repository:
git clone https://github.com/BROCODES2024/ZapRoom.git
cd ZapRoomcd backend
npm installcd ../frontend
npm installYou need two terminals open (one for backend, one for frontend).
Start the Backend Server (Terminal 1)
cd backend
npm run dev- Runs WebSocket server on:
ws://localhost:8080
Start the Frontend Application (Terminal 2)
cd frontend
npm run dev- Runs frontend on:
http://localhost:3000
Now open multiple browser tabs/windows at http://localhost:3000 to simulate different users joining and interacting in a chat room 🚀
ZapRoom is designed to be easily deployed across two platforms for optimal performance:
- Go to Railway and select Deploy from GitHub repo.
- Select your
ZapRoomrepository. - Railway will ask you to set the Root Directory. Set it to
/backend. - Deploy the service.
- In your Railway dashboard for this service, navigate to Settings -> Networking -> Public Networking and click Generate Domain.
- Railway will give you a domain (e.g.,
zaproom-backend-production...up.railway.app). - Keep this domain handy. You will need it for the frontend.
Vercel handles Next.js perfectly right out of the box with zero configuration files.
- Go to your Vercel Dashboard and click Add New -> Project.
- Import your
ZapRoomGitHub repository. - In the Configuration screen:
- Provide a Project Name.
- Important: Set the Root Directory to
frontend. - Vercel will automatically detect the Framework Preset as
Next.js.
- Over in the Environment Variables section, add:
- Key:
NEXT_PUBLIC_WS_URL - Value:
wss://<your-backend-railway-url>(Make sure to prependwss://to the Railway URL you copied earlier).
- Key:
- Click Deploy.
Vercel will quickly build and deploy the Next.js application globally. Once it's finished, click your new Vercel domain to chat instantly!
- Multiple users in real-time rooms
- Host moderation controls (lock/kick/ban)
- Private DMs + typing indicators
- Auto reconnect + modern UI (with Dark Mode toggle)
This project is licensed under the MIT License.
📂 GitHub Repo: ZapRoom