WhoFirst is a web application designed to determine who pressed the buzzer "first". It is suitable for quizzes, game shows, or auctions that require precision and fairness, utilizing WebSocket technology for fast (Low-Latency) communication.
- Real-time Buzzer: Accurately determines the fastest buzzer press.
- Room System:
- Create Room: Create a new room and become the Host to control the game.
- Join Room: Join a room using a Room Code.
- Host Controls:
- Start a new round (Reset).
- Set Countdown timer.
- View the order of players who pressed the buzzer.
- Player Customization: Set and change player names.
- Responsive Design: Supports both mobile and desktop usage.
- React (Vite)
- Tailwind CSS (Styling)
- Socket.io-client (Real-time communication)
- Node.js & Express
- Socket.io (WebSocket server)
- TypeScript (Both Client & Server)
- Node.js (v18 or higher)
- npm or yarn
-
Clone the project
git clone <repository-url> cd who-is-first
-
Install Dependencies
npm install
(This command will install dependencies for the root, client, and server)
Run both Frontend and Backend concurrently in Development mode:
npm run dev- Frontend: http://localhost:5173
- Backend: http://localhost:3001
npm run dev:server- Run only the Servernpm run dev:client- Run only the Clientnpm run build- Build both Client and Servernpm run build:prod- Build and run Server (Production mode)npm run lint- Check Code standardsnpm run format- Format Code
- Copy the example environment file:
cp .env.example .env
- Edit
.envif needed (default port is 3001).
You can easily run the application using Docker.
docker-compose up --build -dThe app will be available at http://localhost:3001
- Build the image:
docker build -t whofirst . - Run the container:
docker run -p 3001:3001 whofirst
Since the Frontend is a standard Vite React app, you can deploy it to Vercel easily.
- Push your code to GitHub/GitLab/Bitbucket.
- Import the project in Vercel.
- IMPORTANT: Change the Root Directory setting to
client.- Vercel will automatically detect Vite settings.
- Add Environment Variable:
VITE_SERVER_URL: The URL of your deployed Backend (e.g.,https://your-backend-api.onrender.com).
Note: Vercel (Serverless) does NOT support persistent WebSockets effectively. You need to deploy the Backend (Server) to a platform that supports long-running Node.js processes.
- Railway (Best fit for this repo)
- Render (Web Service)
- Fly.io
- DigitalOcean App Platform (Worker/Service)
This project already builds the client and serves client/dist from the Node server, so Railway can run both frontend + backend in a single service.
- Push the repo to GitHub/GitLab.
- Go to Railway Dashboard
- Click New Project → Deploy from GitHub Repo
- Select this repository
- Railway will auto-detect
railway.jsonand handle everything → Deploy
That's it! Your app is live at https://<your-railway-app>.up.railway.app ✅
railway.jsonsets Build Command:npm run buildrailway.jsonsets Start Command:node server/dist/index.js- WebSocket (Socket.IO) fully supported on Railway
- Frontend automatically served at
/from the backend
If you need to configure manually in Railway UI:
- Create a new Web Service
- Set these values:
- Build Command:
npm run build - Start Command:
node server/dist/index.js
- Build Command:
- Deploy
Railway automatically provides a PORT environment variable, which the server already uses.
You can also use Render with Docker for full-stack deployment:
- Fork this repository.
- Click the button above (or create a new Web Service on Render).
- Connect your repository.
- Render will automatically detect the
dockerenvironment fromrender.yaml.
If you prefer Vercel for the frontend and Railway for the backend:
- Deploy Backend on Railway (follow the Quick Start section above)
- Deploy Frontend on Vercel:
- Set Root Directory to
client - Add environment variable:
VITE_SERVER_URL=https://<your-railway-app>.up.railway.app - Deploy
- Set Root Directory to
/client- Frontend Source code (React)/server- Backend Source code (Node.js/Express)