An application intended to be used alongside the Twilight Imperium 4th ed game.
How to dev?
Run docker compose up
in the root directory of the project.
- Ensure that you have a
backend/.env
file, you can copy thebackend/.env.example
file to get reasonable default settings. - Enter the
backend/server
directory and runcargo run
(note that the directory is relevant when using theDEMO_GAMES_SKIP_DB
env variable isfalse
)
- Ensure that you have a
frontend/.env
file, you can copy thefrontend/.env.example
file to get reasonable default settings. - Download dependencies run
yarn
in thefrontend
directory. - Run frontend by running
yarn dev
in thefrontend
directory.
The backend uses a system of "demo games" both for manual and automated testing purposes. Such demo games are located in the demo_games
directory and can be created using a CLI script in the backend/demo_game_creator
(see "Creating demo games" below).
If the VERIFY_DEMO_GAMES
env variable is set, all demo games will be replayed during compile-time to alert for breaking changes to the codebase.
Furthermore if the DEMO_GAMES_SKIP_DB
env variable is not set to true
, the demo games will be inserted into the database upon startup, if the OVERWRITE_DB_DEMO_GAMES
is also set then it will also reset those games to the state that they are stored in.
Creating a demo game is done by going to the backend/demo_game_creator
directory and running cargo run <GAME_ID> <GAME_NAME>
where the GAME_ID
argument must be a game that exists in the database (a snapshot of which will become the demo game) and the GAME_NAME
argument is a name that will identify the demo game. Note: this script requires the env variables DATABASE_URL
and DEMO_GAMES_DIR
to exist.