Hivegame is a free online hive game server focused mostly on realtime gameplay and ease of use.
It is written in rust nightly and relies on the Leptos framework. Pure hive logic is inside the engine workspace.
- Install the Rust toolchain.
- Set the default toolchain to nightly from the project root:
rustup override set nightly
- Alternatively set the default toolchain to nightly globally:
rustup default nightly
- Add the WebAssembly target:
rustup target add wasm32-unknown-unknown
cargo install cargo-leptos
- Follow the installation instructions for your OS (example for Arch Linux).
- With PostgreSQL running, create a database
hive-local
and a userhive-dev
as the owner:
sudo -u postgres createuser hive-dev && sudo -u postgres createdb -O hive-dev hive-local
- Install Diesel CLI with PostgreSQL support
cargo install diesel_cli --no-default-features --features postgres
- Install Leptos Formatter
cargo install leptosfmt
- Run Database Migrations
- From the project root, navigate to
db
and run migrations:
cd db && diesel migration run && cd ..
- Run the Project
- The watch command will recompile your code when files change and serve it on localhost::3000, static changes inside the view! macro won't cause a recompile if running with the --hot-reload flag
cargo leptos watch --hot-reload
- Before Making a Pull Request please clippy and format your code
cargo clippy --fix --all-features && leptosfmt apis -q && cargo fmt
- Install Nix or just run:
curl -L https://nixos.org/nix/install | sh -s -- --daemon
- Add these experimental features to your nix config (
/etc/nix/nix.conf
)
experimental-features = nix-command flakes
- Start the development shell
nix develop -c $SHELL
- Init and Start the PostgreSQL DB
pg-start
- Now start the server
migration run
server
- Stop PostgreSQL
pg-stop
- (Optional) Setup direnv
- Before committing code please run
format
Ensure docker is installed on your machine. You can run the following command to start the server and database:
docker compose up --build -d
This command downloads and installs the required dependencies. The first time you run this command, it may take a few minutes to complete.
# to stop docker compose
docker compose down
# if you have already built the image, you can save some time by running without the build flag:
docker compose up -d
This will create a database, apply migrations and run the app on localhost:3000.
This source code with the exception of the graphics is licensed under the GNU Affero General Public License 3 license found in the LICENSE.md file in the root directory of this project. The official graphics for Hive are owned by Gen42 and may not be used without prior written consent.