https://slave-beta.vercel.app/
Real-time multiplayer card game built with Next.js and deployed on Vercel. Play the classic "Slave" (President/Scum) card game with friends online!
- 🎯 Real-time Multiplayer - Play with 4 players simultaneously
- 🎨 Premium UI - Beautiful dark theme with glassmorphism effects
- ⚡ Fast & Responsive - Smooth animations and instant updates
- 🚀 Serverless - Deployed on Vercel with no database required
- 📱 Mobile Friendly - Responsive design works on all devices
Slave (also known as President, Scum, or Asshole) is a card game for 4 players:
- Setup: Each player receives 13 cards from a shuffled deck
- Objective: Be the first to get rid of all your cards
- Playing:
- Players take turns playing cards of higher value than the previous play
- You can play singles, pairs, triples, or quads (must match previous play count)
- Card ranking: 3 (lowest) → 4 → 5 → ... → A → 2 (highest)
- If you can't or don't want to play, you can pass
- Round Reset: When all players pass, the last player who played starts a new round
- Winning: First player to empty their hand wins
- Node.js 18+ and npm
# Clone the repository
git clone <your-repo-url>
cd slave-card-game
# Install dependencies
npm install
# Run development server
npm run dev
# Open http://localhost:3000npm run build
npm start- Push your code to GitHub
- Go to vercel.com
- Click "New Project"
- Import your GitHub repository
- Click "Deploy" (Vercel will auto-detect Next.js)
- Your game will be live at
your-project.vercel.app
# Install Vercel CLI
npm install -g vercel
# Login to Vercel
vercel login
# Deploy
vercel
# Deploy to production
vercel --prodslave-card-game/
├── src/
│ ├── app/
│ │ ├── api/ # API routes
│ │ ├── game/ # Game room pages
│ │ ├── globals.css # Global styles
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Home page
│ ├── components/
│ │ ├── GameBoard.tsx # Main game interface
│ │ ├── Lobby.tsx # Lobby/room list
│ │ ├── PlayArea.tsx # Center play area
│ │ ├── PlayerHand.tsx # Player's cards
│ │ └── PlayerStatus.tsx # Player info
│ └── lib/
│ ├── gameLogic.ts # Game rules
│ ├── gameState.ts # In-memory state
│ └── types.ts # TypeScript types
└── public/ # Static assets
POST /api/rooms- Create a new game roomGET /api/rooms- List all active roomsGET /api/rooms/[roomId]- Get room statePOST /api/rooms/[roomId]/join- Join a roomPOST /api/rooms/[roomId]/start- Start the gamePOST /api/rooms/[roomId]/play- Play cards or pass
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Animations: Framer Motion
- Deployment: Vercel
- State Management: In-memory (Map-based)
- Real-time Updates: Polling (1.5s interval)
- Game state is stored in-memory on Vercel Serverless Functions
- Rooms will be lost after ~5-15 minutes of inactivity (cold start)
- Perfect for quick gaming sessions
- For persistent state, consider integrating Vercel KV (Redis)
- Uses polling instead of WebSocket (Vercel limitation)
- Client polls every 1.5 seconds for game state updates
- Reliable and simple for this use case
- For true WebSocket, consider using Pusher or Ably
- Enter your name on the home page
- Create a new game or join an existing room
- Wait for 4 players to join
- Click "Start Game" when ready
- Play your cards when it's your turn
- Pass if you can't or don't want to play
- Win by emptying your hand first!
MIT License - feel free to use this project for learning or fun!
Contributions are welcome! Feel free to open issues or submit pull requests.
Have fun playing Slave with your friends online! 🎴✨