A mobile-friendly React web application for playing the classic Judgement card game with friends. Built with React, Tailwind CSS, and Firebase for real-time multiplayer gameplay.
Judgement is a trick-taking card game where 4 players compete to win the most hands:
- Players: Exactly 4 players required
- Cards: Each player gets 13 cards (5 initially, then 8 more after trump selection)
- Trump: One player selects the trump suit after seeing their first 5 cards
- Objective: Win the most hands to be declared the winner
- Rules: Follow suit if possible, trump cards beat non-trump cards
- โ Real-time multiplayer for 4 players
- โ Google Authentication with Gmail
- โ Trump suit selection mechanism
- โ Card validation and turn management
- โ Automatic hand winner determination
- โ Live scoring and leaderboard
- โ Game completion and winner announcement
- ๐ฑ Mobile-first responsive design
- โก Real-time updates via Firebase Realtime Database
- ๐ Secure Google OAuth authentication
- ๐จ Beautiful UI with Tailwind CSS
- ๐ฎ Touch-optimized card interactions
- ๐จ Fast development with Vite
- ๐ Hot module replacement (HMR)
- ๐ด Redux Toolkit for state management
- ๐ฅ Firebase middleware for real-time sync
- Frontend: React 18 + Vite
- State Management: Redux Toolkit + React-Redux
- Styling: Tailwind CSS
- Backend: Firebase (Authentication + Realtime Database)
- Deployment: Ready for Vercel/Netlify
- Node.js 16+ and npm
- Firebase project with Authentication and Realtime Database enabled
- Google OAuth configured in Firebase Console
- Go to Firebase Console
- Create a new project
- Enable Google Analytics (optional)
- In Firebase Console, go to Authentication > Sign-in method
- Enable Google provider
- Add your domain to authorized domains
- Go to Realtime Database in Firebase Console
- Create database in test mode
- Choose your preferred location
- Update security rules:
{
"rules": {
"games": {
"$gameId": {
".read": true,
".write": true,
"players": {
"$uid": {
".validate": "$uid === auth.uid"
}
}
}
}
}
}- Go to Project Settings > General
- Scroll down to Your apps
- Click Web app and register your app
- Copy the config object
# Clone the repository
git clone <your-repo-url>
cd judgement-card-game
# Install dependencies
npm installUpdate src/firebase.js with your Firebase configuration:
const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-project.firebaseapp.com",
databaseURL: "https://your-project-default-rtdb.firebaseio.com/",
projectId: "your-project-id",
storageBucket: "your-project.appspot.com",
messagingSenderId: "123456789",
appId: "your-app-id",
measurementId: "your-measurement-id",
};# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview- Sign in with your Google account
- Wait for 3 other players to join
- Mark yourself as ready
- First player receives 5 cards
- They choose the trump suit
- All players then receive 8 more cards (13 total)
- Players take turns playing cards
- Must follow the lead suit if possible
- Trump cards beat non-trump cards
- Highest valid card wins the hand
- Player who wins the most hands (out of 13) wins the game
- Ties are broken by... most recent hand won
The app is optimized for mobile devices with:
- Touch-friendly card interactions
- Responsive layouts for all screen sizes
- Safe area support for devices with notches
- Optimized for portrait orientation
- Fast loading and smooth animations
src/
โโโ components/ # React components
โ โโโ Card.jsx # Individual card component
โ โโโ GameBoard.jsx # Main game interface
โ โโโ GameComplete.jsx # End game screen
โ โโโ LoginScreen.jsx # Google auth login
โ โโโ MobileButton.jsx # Reusable button component
โ โโโ TrumpSelector.jsx# Trump suit selection
โ โโโ WaitingRoom.jsx # Player lobby
โโโ store/ # Redux state management
โ โโโ store.js # Main store configuration
โ โโโ hooks.js # Typed Redux hooks
โ โโโ firebaseMiddleware.js # Firebase real-time sync
โ โโโ slices/ # Redux slices
โ โโโ authSlice.js # Authentication state
โ โโโ gameSlice.js # Game state and logic
โ โโโ uiSlice.js # UI state management
โโโ utils/ # Utility functions
โ โโโ gameConstants.js # Game constants
โ โโโ gameUtils.js # Game logic utilities
โโโ firebase.js # Firebase configuration
โโโ App.jsx # Main app component
The application uses Redux Toolkit for predictable state management:
- Auth Slice: User authentication and profile data
- Game Slice: Game state, players, cards, and game logic
- UI Slice: Loading states, modals, and user interface state
- Firebase Middleware: Real-time synchronization with Firebase
For detailed Redux setup and usage, see REDUX_SETUP.md.
- Modify
tailwind.config.jsfor custom theme - Update component styles in individual files
- Colors and spacing follow Tailwind conventions
- Modify game logic in
src/utils/gameUtils.js - Update constants in
src/utils/gameConstants.js - Extend Firebase database structure as needed
npm install -g vercel
vercelnpm run build
# Upload dist/ folder to Netlifynpm install -g firebase-tools
firebase login
firebase init hosting
firebase deployFirebase Connection Issues
- Verify your Firebase config in
src/firebase.js - Check that Realtime Database is enabled
- Ensure authentication is properly configured
Authentication Problems
- Verify Google OAuth is enabled in Firebase Console
- Check that your domain is in authorized domains
- Clear browser cache and try again
Game State Issues
- Check browser console for errors
- Verify Firebase security rules
- Ensure all 4 players are properly connected
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- React team for the amazing framework
- Firebase for real-time backend services
- Tailwind CSS for beautiful styling
- Vite for lightning-fast development
Enjoy playing Judgement with your friends! ๐ด๐