A modern, stylish implementation of the classic Tic-Tac-Toe game, featuring a Neon Glassmorphism design. Built with React, TypeScript, and Tailwind CSS, and powered by Zustand for state management. Now includes online multiplayer using Socket.IO.
- Neon Glassmorphism UI: A stunning, modern interface with glowing effects, gradients, and glass-like panels.
- Time Travel: Jump back to any previous move in the game history to change your strategy.
- Persistent State: Your game progress is automatically saved to your browser's LocalStorage, so you never lose your game even if you refresh.
- Responsive Design: Fully responsive layout that looks great on both desktop and mobile devices.
- Sound Effects: Interactive sound feedback for moves and game events (Winning/Draw).
- Smart State Management: Utilizes
zustandfor efficient and clean state management. - Online Multiplayer (Socket.IO): Play with a friend over the network by joining/creating a Room ID, with real-time synced moves, undo/redo, and connection status handled via WebSockets.
- Framework: React (v19)
- Language: TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS (v4)
- State Management: Zustand
- Real-time Communication: Socket.IO (client & server)
- Backend: Node.js + Express + Socket.IO server (in
server/index.js) - Linting: ESLint
Follow these steps to set up the project locally on your machine.
Make sure you have Node.js installed.
-
Clone the repository (or download the source code):
git clone https://github.com/1970Mr/tic-toc-toe cd tic-toc-toe -
Install dependencies:
npm install # or yarn install # or pnpm install
-
Start the development (frontend) server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173(or the URL shown in your terminal).
To use the Online Multiplayer features, you also need to run the Socket.IO server:
- Copy
.env.exampleto.envin the project root (next topackage.json). The default values are suitable for local development; you can adjust them later if needed. - In another terminal, from the project root, run:
npm run server
- By default, the server listens on
http://localhost:3001and allows CORS fromhttp://localhost:5173(or the values you set in.env). - On the frontend, the socket client reads these optional environment variables (via Vite):
VITE_SOCKET_HOSTNAME(default: currentwindow.location.hostname)VITE_SOCKET_PORT(default:3001)VITE_SOCKET_PROTOCOL(default:http)
- On the server, you can configure:
PORT(default:3001)CORS_ORIGIN(default:http://localhost:5173)
Once both frontend and socket server are running, use the Online Multiplayer panel in the UI:
- Click "Go Online 🚀" to connect to the server.
- Enter a Room ID (e.g.
room1) and click "Join / Create Room". - Share this Room ID with a friend so they can join the same room and play against you in real time.
npm run dev: Starts the frontend development server (Vite).npm run server: Starts the Socket.IO backend server (Express + Socket.IO).npm run build: Builds the app for production.npm run lint: Runs ESLint to check for code quality issues.npm run preview: Previews the production build locally.
src/
├── components/ # React components (Board, GameInfo, etc.)
├── stores/ # Zustand store (useGameStore.ts)
├── utils/ # Helper functions (gameLogic.ts, soundUtils.ts)
├── App.tsx # Main application component
└── main.tsx # Entry point
Contributions are welcome! Feel free to open an issue or submit a pull request if you have any ideas for improvements.
This project is open source and available under the MIT License.

