Skip to content

Web service generating images of Japanese (Riichi) Mahjong hands.

License

Notifications You must be signed in to change notification settings

m4tx/chombo-gen

Repository files navigation

chombo-gen

Rust Build Status Docker Build Status GNU AGPL v3 licensed

ChomboGen is a web service that allows to generate images of Japanese (Riichi) Mahjong hands. The hands are provided in a text format and are generated in PNG format.

See it in action on hand.chombo.club.

Riichi Hand Generator screenshot

Development

The project is written purely in Rust, both its backend and frontend.

Backend

To run the development server, execute:

cd chombo-gen-backend
cargo run

This will start the server at localhost:8000.

To build a release version, execute:

cargo build --release

The target binary will be put at target/release/chombo-gen-backend.

Frontend

Frontend uses the yew framework. The code is compiled into a WebAssembly binary and then statically served.

First, install the Trunk bundler and add wasm32 target support to your Rust toolchain.

rustup target add wasm32-unknown-unknown
cargo install trunk

Then, you can use:

cd chombo-gen-frontend
trunk serve

to start local server at localhost:8080. It assumes that the backend is running at localhost:8000.

To build a distributable version of the frontend, execute:

trunk build --release

This will build a website in frontend/dist/ directory that can be statically served by a server such as nginx. You can override th backend URL by providing it as the CHOMBO_GEN_API_URL environment variable, like so:

export CHOMBO_GEN_API_URL=http://api.hand.example.com
trunk build --release

pre-commit

We encourage contributors to use predefined pre-commit hooks — to install them in your local repo, make sure you have pre-commit installed and run:

pre-commit install

Deployment

The easiest way to try locally or deploy chombo-gen is to use auto-generated Docker images. There is a separate image for backend, frontend, and a reverse proxy (that exposes both the backend and frontend under the same server), all of which are published on the GitHub Container Registry. There is an example docker-compose.yml file provided in the repository root.

In the project root directory, execute:

docker compose up -d

After that, the website will be available on at localhost:8000.

Attribution

This project uses riichi-hand-rs library, which uses:

About

Web service generating images of Japanese (Riichi) Mahjong hands.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages