Skip to content

GhoulKingR/game-server

Repository files navigation

Tic-Tac-Toe game server

A tic-tac-toe game server written in Python.

Technology stack

  • FastAPI (Python): REST and WebSocket endpoints
  • Redis: Caching and state management
  • Apache Kafka: Event streaming in WebSocket endpoints

Running the server

With docker compose

  1. Clone the repo to your local machine:
git clone https://github.com/GhoulKingR/game-server
cd game-server
  1. Run the docker compose:
docker compose up

Without docker compose

You may want to run this server without docker ignore.

After cloning the project to your computer, you need to have a redis instance and kafka instance running, and their URLs. Once you have them, create an .env file in project directory and paste the following into it:

WEB_KAFKA_BROKER=broker_host:broker_port>
WEB_REDIS_HOST=redis_host
WEB_REDIS_PORT=redis_port

Replace, the values with the ones of your kafka and redis instance. Here's an example you can go off of:

WEB_KAFKA_BROKER=localhost:9092
WEB_REDIS_HOST=localhost
WEB_REDIS_PORT=6379

After creating the .env file:

  • Create a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
  • Install the project's dependencies
pip install -r requirements.txt
  • Run the server:
python3 main.py

Tip

You can see the various options available for running the server by running the command with the -h or --help flag.

About

A tic-tac-toe game server with chat functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published