Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olzhasar/pyws-chess
A real-time chess game built with asyncio, FastAPI and websockets
https://github.com/olzhasar/pyws-chess
asyncio chess fastapi python websockets
Last synced: 19 days ago
JSON representation
A real-time chess game built with asyncio, FastAPI and websockets
- Host: GitHub
- URL: https://github.com/olzhasar/pyws-chess
- Owner: olzhasar
- License: mit
- Created: 2024-09-08T15:43:29.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-20T15:48:31.000Z (4 months ago)
- Last Synced: 2024-10-20T18:11:48.048Z (4 months ago)
- Topics: asyncio, chess, fastapi, python, websockets
- Language: JavaScript
- Homepage: https://chess.olzhasar.com
- Size: 201 KB
- Stars: 27
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyws-chess
A simple online chess game via websockets.
Live Demo:
[https://chess.olzhasar.com](https://chess.olzhasar.com)
![Preview](./preview.png)
## Technologies
- [asyncio](https://docs.python.org/3/library/asyncio.html)
- [FastAPI](https://fastapi.tiangolo.com/) for the server
- [msgspec](https://github.com/jcrist/msgspec) for message serialization
- [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for real-time communication
- [python-chess](https://python-chess.readthedocs.io/en/latest/) for server-side chess logic
- [chessboard.js](https://chessboardjs.com/) for client rendering
- [chess.js](https://github.com/jhlywa/chess.js) for client-side chess logic
- [Prometheus](https://prometheus.io/) and [prometheus-fastapi-instrumentator](https://github.com/trallnag/prometheus-fastapi-instrumentator) for metrics## Features
- Real-time chess game
- Client and server-side move validation
- Automatic matchmaking### Limitations
- Reconnection is not supported## Running locally
### Docker
```bash
docker build -t pyws-chess .
docker run -p 8000:8000 pyws-chess
```### Local installation
#### Pre-requisites
- [uv](https://github.com/astral-sh/uv)
- Python 3.11+```bash
cd src
uv run uvicorn app.main:app
```The server will be running on `http://localhost:8000`.
## License
MIT