Skip to content

Malvin555/GroundChess

Repository files navigation

♟️ Multiplayer Chess App

A real-time 2-player chess game built with Next.js App Router, Socket.IO, and chess.js.


📸 Preview

Chess App Preview 1 Chess App Preview 2


🚀 Features

  • Real-time multiplayer with Socket.IO
  • Automatic color assignment (White, Black, or Spectator)
  • Move sync across clients
  • Game history & match results
  • PostgreSQL + Prisma for persistent storage

🛠️ Getting Started

1. Clone & Install

git clone https://github.com/yourusername/multiplayer-chess-app.git
cd multiplayer-chess-app
npm install

2. Set Up Environment Variables

Create a .env file:

JWT_SECRET=your_secret
DATABASE_URL=your_postgres_url

3. Configure Database (PostgreSQL + Prisma)

  • Make sure PostgreSQL is running
  • Update your .env:
DATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/chess_app_db"
  • Install dependencies:
npm install @prisma/client prisma pg
npx prisma init
npx prisma db push

4. Start the Dev Server

npm run dev

Visit http://localhost:3000/game/vs-player/room1 in two browser tabs to test multiplayer.


📅 Roadmap

  • ✅ Real-time gameplay
  • ✅ Color assignment
  • ✅ Move sync
  • ✅ Match history
  • ✅ Play vs bot
  • ✅ Responsive UI

🙋 FAQ

How do I play with a friend? Share a room URL (e.g., /game/vs-player/room1). Anyone with the link can join.

How does the database work? Prisma + PostgreSQL handles game data. See "Getting Started" for setup.


🤝 Contributing

Contributions and suggestions are welcome! Feel free to open an issue or PR.


📖 License

MIT

About

Real-time 2-player chess game built with Next.js and Socket.IO — school project for MPLS

Resources

License

Stars

Watchers

Forks

Contributors