A real-time multiplayer cricket game built with Next.js, Socket.IO, and MongoDB.
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- MongoDB
- npm or yarn
- Create two
.envfiles:
.env.local in the root directory:
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
NEXT_PUBLIC_SOCKET_URL=http://localhost:5001
DEV_FRONTEND_URL=http://localhost:3000
PROD_FRONTEND_URL=your_production_url
NEXT_PUBLIC_FILTER_USERNAME=falseserver/.env:
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
NEXT_PUBLIC_SOCKET_URL=http://localhost:5001
DEV_FRONTEND_URL=http://localhost:3000
PROD_FRONTEND_URL=your_production_url
NEXT_PUBLIC_FILTER_USERNAME=false- Clone the repository:
git clone https://github.com/mrizwan18/thumbbat-upgraded.git
cd thumbbat-upgraded- Install dependencies:
npm installYou'll need to run both the client and socket server in separate terminal windows.
- Start the Socket.IO server while staying in the /server directory:
npm run socket-serverThis will start the WebSocket server on port 5001.
- In a new terminal, start the Next.js development server while staying in the root directory:
npm run devThis will start the client application on http://localhost:3000.
- Real-time multiplayer cricket game
- User authentication and email verification
- Leaderboard system
- Bot mode for single-player gameplay
- Responsive design
- Real-time score tracking
- Innings system
- Frontend: Next.js, React, TailwindCSS, Framer Motion
- Backend: Express, Socket.IO
- Database: MongoDB with Mongoose
- Authentication: JWT, bcrypt
- Email: Nodemailer
- Type Safety: TypeScript, Zod
npm run dev # Start Next.js development server
npm run socket-server # Start Socket.IO server
npm run build # Build the production application
npm run start # Start the production server
npm run lint # Run ESLint/server- Socket.IO server and game logic/src/app- Next.js application routes/components- React components/utils- Utility functions and game logic/services- Socket service and API calls/styles- Global CSS and TailwindCSS configuration
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.