- Rust 96.8%
- SCSS 3.2%
| .cargo | ||
| .sqlx | ||
| migrations | ||
| public | ||
| style | ||
| werewolves | ||
| werewolves-macros | ||
| werewolves-proto | ||
| werewolves-server | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE.md | ||
| README.md | ||
werewolves
webapp for running in-person games of the social deduction game "werewolf". runs on the concept of a host with two screens:
- privately-facing screen (such as their phone or a tablet) that they will be running the game from
- public-facing screen ("big screen") that will display information to all players during the day, and prompt night actions during the night
building
prerequisites
werewolves is written in rust and uses leptos as its wasm framework, therefore the tooling required to build werewolves is:
- rust
- cargo-leptos
- once rust is installed, you can install cargo-leptos by running:
cargo install --locked cargo-leptos
- once rust is installed, you can install cargo-leptos by running:
build environment variables
build-time environment
these values are taken at build-time and cannot be changed once built
| variable | description | default value |
|---|---|---|
BASE_URL |
the server's url that will be used for generating the joining qr code | https://wolf.emilis.dev/ |
DEBUG |
adds 20 dummy players for testing to any created game | - |
run-time environment
these values will be read while the server runs
| variable | description | default value |
|---|---|---|
HOST |
host to listen on | 127.0.0.1 |
PORT |
port to listen on | 3000 |
MAX_DB_CONNECTIONS |
maximum number of database connections in the database pool | 30 |
PG_CONN_STRING |
connection string to connect to the postgres database | postgres:///werewolves?host=/var/run/postgresql |
for the database url, it is advised to use unix sockets if the database is on the same machine
building (real)
with the right environment variable set, you can use the following command to build a release build:
cargo leptos build --release
release builds will take a while to build. they are intionally run with 1 codegen-units, which removes any parallelism, but might improve optimization. more info.
currently, release builds take ~5 minutes to build on my machine with an AMD Ryzen 9 7950X3D
development builds
to build werewolves for development run the command
cargo leptos watch
this will run it in watch-mode, recompiling and re-serving the application every time there's a change to a rust file
migrations
migrations will run automatically.
binary output
the project compiles to a single server binary. it is statically linked and embeds all the resources it serves.
it will be found at target/release/werewolves for release builds.