Real-time multiplayer framework for online math competitions with interactive games, built on top of boardgame.io.
An offline version of the 2023 framework is available here
An offline version of previous relay games is available here
Strategy games are available here (this one is based on another framework)
All demos are in Hungarian.
npm ci
Frontend needs to be built after every change, but the server auto-reloads.
docker compose --env-file=.env.docker up --build
(before first run, you will need npm run build
)
Also pay attention to create a correct .env.docker
file based on the .env.docker.sample
file.
You should be up and running the application on localhost
.
docker exec -t durer-aion_backend_1 ./import_teams.sh ./test.tsv
npm run build
...and reload page
:)
Except routing, and KOA hooks.
If you install a package used by the backend, you will have to docker-compose build
.
IMPORTANT!
The development enviroment uses a different connection setup to the database, so the .env files are different. Pay attention to use the .env.local file for development!
Both frontend and server auto-reloads.
- Set up the database (in Windows you can run it without sudo):
sudo docker run -it --rm -e POSTGRESQL_PASSWORD=postgres -p 127.0.0.1:5432:5432 bitnami/postgresql
- After that you should import teams.
On linux/unix
./import_teams.sh test.tsv
On Windows
.\import_teams.ps1 test.tsv
-
You should create an
.env
file (see.env.sample
). -
Run the following two commands in two separate terminal:
npm run dev:server
This starts the backend with the earlier started db. Changing the code of server it auto-reloads itself.
npx react-scripts start
This starts the frontend. Changing the code of frontend it auto-reloads itself. Note: you can use the backend without the frontend.
You should be up and running the application on localhost:3000
.
VS code gives you two options to debug the application. Both of them needs some setup first, and they can't be used at the same time.
Breakpoints work either on the server, or on the frontend, but not on both at the same time. See different debugging options for further references.
If you want to debug the server then instead of running npm run dev:server
go to Run and Debug
menu in VSCode and select Node.JS... -> Run Script: dev:server
If you want to use the Debugger to debug frontend code, you can use the Debug Frontend
option.
In this case, you still have to start the frontend, and the backend manually.
- Copy 4 files (board, game, main, strategy) to a new directory in
src/games/
. - Add game in
index.tsx
(frontend-only code) - Add game in
lobby.tsx
(client-side code) - Add game in
server.tsx
(server-side code)