# Tic Tac Toe A tic-tac-toe game with two modes: **CPU** (play against a CPU opponent that makes random moves) and **Online** (real-time 2-player over WebSocket). ## Stack - Frontend: vanilla JS + CSS (no build step) - Backend: Node.js + Express (serves static files) + `ws` (WebSocket) + `sql.js` (SQLite, file-based persistence) ## Project layout ``` public/ frontend (index.html, app.js, game.js, multiplayer.js, style.css) server/ backend (server.js, db.js, package.json, pnpm-lock.yaml) docs/ design docs Dockerfile production image docker-compose.yml ``` ## Run locally The backend lives in `server/` (the frontend has no build step). ```bash # install backend deps (pnpm) cd server && pnpm install # start (default port 8080) node server/server.js # or with an explicit port PORT=8080 node server/server.js ``` Then open . > The server reads `PORT` (default `8080`) and optional `BASE_PATH` (default empty). ## Run with Docker ```bash docker compose up --build ``` or build and run the image directly: ```bash docker build -t tictactoe . docker run -p 8080:8080 tictactoe ``` Then open . ## Notes - `server/data/` holds the SQLite file and is git-ignored. - Online games persist to SQLite; a host who reloads can re-enter via the saved token.