···1+# Man Hunt
2+3+An iOS and Android app that lets you play man hunt with friends.
4+5+The game is played over WebRTC Data Channels and is entirely P2P (except for the
6+signaling process needed for WebRTC.)
7+8+<!-- TODO: Download & Install instructions for when we get to publishing -->
9+10+## Development
11+12+### Pre-requisites
13+14+If you have [nix](https://nixos.org) installed, all of these are handled for you.
15+16+- [Rust](https://rustup.rs)
17+- [Just](https://just.systems) (`cargo install just`)
18+- [Tauri's Pre-reqs](https://tauri.app/start/prerequisites/)
19+ - [(Also pre-reqs for mobile dev if you are working on the app part)](https://tauri.app/start/prerequisites/#configure-for-mobile-targets)
20+- Tauri's CLI (`cargo install tauri-cli`)
21+- [NodeJS](https://nodejs.org)
22+23+#### With Nix
24+25+Run `nix develop` to get a development shell with all needed dependencies set up.
26+You can then call the `just` recipes mentioned below.
27+28+### Setup
29+30+- Rust is ready to go
31+- For the frontend, run `just setup-frontend` to install the dependencies via `npm`
32+33+### Run App
34+35+- `just dev`: Will run the app locally on your computer, this will open a
36+ WebView with the frontend
37+ - Note: all geolocation returned from tauri-plugin-geolocation will be hard
38+ coded to `(0.0, 0.0)` in this mode.
39+- `just dev-android`: Will run the app on a connect Android device or VM via ADB
40+- `just signaling`: Will run the signaling server on port `3536`
41+ (this is needed for clients to connect)
42+43+### Project Layout
44+45+- [backend/](https://github.com/Bwc9876/manhunt-app/tree/main/backend): App
46+ backend, Rust side of the Tauri application
47+- [frontend/](https://github.com/Bwc9876/manhunt-app/tree/main/frontend): App
48+ frontend, Web side of the Tauri application
49+- [nix/](https://github.com/Bwc9876/manhunt-app/tree/main/nix): Nix files for
50+ the flake
51+- [manhunt-signaling/](https://github.com/Bwc9876/manhunt-app/tree/main/manhunt-signaling):
52+ Matchbox signaling server implementation in Rust
53+54+### Housekeeping
55+56+As you go, please run these `just` commands every-so-often and before you commit:
57+58+- `just fmt`: Formats all files in the repo
59+- `just check-backend`: Check (and fix) potential issues on the backend
60+ (only need to run if you edited the backend)
61+- `just check-frontend`: Check for potential issues on the frontend
62+ (only need to run if you edited the frontend)
63+- `just check-signaling`: Same thing as backend but for the singaling server
64+65+**Important**: When changing any type in `backend` that derives `specta::Type`,
66+you need to run `just export-types` to sync these type bindings to the frontend,
67+otherwise the TypeScript definitions will not match that ones the backend expects.
68+69+All changes made will be put through CI to check that all of these commands have
70+been done.
71+72+### Other Just Recipes
73+74+Run `just` without any args to get a list.
···23# Run a check on the backend
24[working-directory: 'backend']
25check-backend:
026 cargo check
27 cargo clippy --fix --allow-dirty --allow-staged -- -D warnings
28000002930# Run lint on the frontend
31[working-directory: 'frontend']
···41# Start the signaling server on localhost:3536
42[working-directory: 'manhunt-signaling']
43signaling:
44- cargo run 127.0.0.1:3536
···23# Run a check on the backend
24[working-directory: 'backend']
25check-backend:
26+ cargo fmt --check
27 cargo check
28 cargo clippy --fix --allow-dirty --allow-staged -- -D warnings
2930+[working-directory: 'manhunt-signaling']
31+check-signaling:
32+ cargo fmt --check
33+ cargo check
34+ cargo clippy --fix --allow-dirty --allow-staged -- -D warnings
3536# Run lint on the frontend
37[working-directory: 'frontend']
···47# Start the signaling server on localhost:3536
48[working-directory: 'manhunt-signaling']
49signaling:
50+ cargo run 0.0.0.0:3536