Piskvorky is TicTacToe multiplayer game build with Kotlin Multiplatform.
Project is using these technologies and libraries:
- Kotlin Multiplatform - for sharing code between server and client(s) modules
- Ktor - as http server
- Serialization - for serialization of json api messages
- Koin - for dependency injection, using alpha version with multiplatform support
- kotlin-react - Kotlin wrapper of ReactJS for building js client application
- Exposed - an ORM framework for Kotlin
- OpenApi - for generating api model classes, see specification
- Docker - for build and deploy, see installation
1. Clone this repository
git clone https://github.com/MFori/Piskvorky.git
2. Build using gradle wrapper
gradlew build
3. Setup database
Create mysql db and pass connection params as environmental variables as below.
4. Run server
set SERVER_DB_ADDRESS=localhost
set SERVER_DB_USER=root
set SERVER_DB_PASSWORD=password
set SERVER_DB_PORT=3306
set SERVER_DB_NAME=piskvorky_db
java -jar server/build/libs/piskvorky-server.jar
Server will listen at http://localhost:9090
, admin is located at http://localhost:9090/admin
5. Start client
Copy content of web/distributions
to some web server as nginx (see nginx configuration) or run kotlin-browser gradle task as browserProductionRun
6. Play
Create new account or use predefined admin account:
email: [email protected]
pass: test123
You can use prepared files run.bat/run.sh to build project using gradle wrapper and deploy to docker (Docker must be installed.) with this commands:
gradlew build
docker-compose build
docker-compose up
Server will be listening at http://localhost:9090
client app will be accessible at http://localhost:80
.
Project is using gradle and is split into these modules:
- domain - contains domain objects and other shared code between server and client(s) modules
- server - http server using Ktor
- web - web client app in kotlin/js and ReactJS wrapper
Repository used Alpha features such as Kotlin Multiplatform and some problems with that may occur.
There is list of known issues:
- Netty exception on every request: https://youtrack.jetbrains.com/issue/KTOR-646
- Ktor's websocket auto ping/pong seems not working
This repository is semestral work of KIV/PIA.
Please see this doc.