A React Native trick-taking card game built with Expo and Firebase.
Card Masters is a multiplayer card game where players compete to reach a target score by strategically controlling tricks and accumulating points. The game supports both single-player (vs AI) and multiplayer modes.
Read the rules and gameplay details here.
- Frontend: React Native with Expo
- Authentication: Firebase Authentication
- State Management: Zustand
- Multiplayer Mode: Socket.io websockets
- Game Stats: Firebase Firestore
- Node.js
- Firebase
# Clone repository
git clone https://github.com/aubynsamuel/cardmasters-rn.git
cd cardmasters-rn
# Install dependencies
npm install
# Start development server
npm startCreate .env file:
Set up a Firebase project and add project configuration details.
FIREBASE_API_KEY=your_api_key
FIREBASE_AUTH_DOMAIN=your_auth_domain
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_STORAGE_BUCKET=your_storage_bucket
FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
FIREBASE_APP_ID=your_app_idThis project requires a game server for multiplayer functionality. The game server is available at aubynsamuel/cards-game-server.
- Game Server: Clone and set up the game server from the repository above
- Environment Configuration: Update your
.envfile with the server URL
Add the server URL to your .env file:
SERVER_URL=http://localhost:3000-
Start the Game Server
# Clone the game server git clone https://github.com/aubynsamuel/cards-game-server.git cd cards-game-server # Install dependencies npm install # Start the server npm start
-
Start Development
npm start
The client uses Socket.io for real-time communication. The connection is managed through the SocketContext provider which:
- Establishes websocket connection to the game server
- Handles connection/disconnection events
- Provides socket state to child components
- Manages reconnection logic
Add the following environment variables to your .env file:
SERVER_URL=http://localhost:3000 # Local development adjust if needed
SERVER_URL=https://your-server.com # Production server- Start the game server
- Run the client with
npm start - Open multiple instances (devices/emulators) to test multiplayer functionality
- Create or join game rooms through the app interface
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add 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.