Real-time multiplayer dice betting game built with serverless architecture.
- Frontend: React + Vite + Tailwind + Framer Motion
- API: Vercel Serverless Functions
- Realtime: Pusher
- Database: Upstash Redis
baucua/
├── apps/
│ ├── web/ # React frontend (Vite)
│ └── api/ # Vercel serverless functions
├── packages/
│ └── shared/ # Shared types & constants
├── package.json
└── pnpm-workspace.yaml
- Node.js 18+
- pnpm (
npm i -g pnpm)
Pusher (https://pusher.com)
- Create a free account → Create a Channels app
- Note your App ID, Key, Secret, Cluster
Upstash Redis (https://upstash.com)
- Create a free account → Create a Redis database
- Note your REST URL and REST Token
# In project root
cp .env.example .env
# In apps/api/
cp ../../.env .env
# In apps/web/
cp ../../.env .envEdit .env with your actual credentials.
pnpm install
pnpm dev- Frontend: http://localhost:3000
- API: http://localhost:3001
- Open http://localhost:3000
- Create a room (you become the Host)
- Share the room code with friends
- Friends join via the room code
- Host starts a round → Players bet → Host rolls → Results!
- 6 symbols: Bầu 🍐, Cua 🦀, Tôm 🦐, Cá 🐟, Gà 🐓, Nai 🦌
- 3 dice are rolled each round
- Bet on any symbol(s) during the 15s betting phase
- Payout: 1 match = 1x, 2 matches = 2x, 3 matches = 3x
- 0 matches = lose your bet
cd apps/api
vercel --prodcd apps/web
vercel --prodSet environment variables in Vercel dashboard for both projects.
Update VITE_API_URL in the web project to point to your deployed API URL.
Hosts can override dice results for testing:
- In Host Controls, click "🔧 Dev Mode"
- Select desired dice values
- Roll — the selected result will be used