To install everything you need and confirm that the app builds, run:
./build.sh
This is the script that Netlify runs to build the app.
To serve the app using Trunk, run:
./serve.sh
Every time you make a change, Trunk will recompile and live-reload the page.
Just push main
to GitHub.
The frontend app is implemented with Yew. The relevant files are:
./Cargo.toml
./index.html
./src/
The Yew app is built using Trunk. The output files are written to the dist/
directory.
The backend is a single Netlify function implemented in Rust.
It accepts a query string as input, looks up a list of matching anagrams in its database, and returns them in its response.
The relevant files are:
netlify/functions/solve/
The dataset/
directory contains a Bash script and a Rust script for building
the database of anagrams.
The scripts take a
kaikki.org dictionary file
as input and transform them into an anagram dataset. The result is written as a
JSON file inside the backend's src
directory.
To build the dataset:
-
Run
./download-dictionary.sh
inside thedataset
directory. This will download the dictionary file. It is not stored in git because it is > 1 GB. -
Run
./extract-words.sh
to do some preprocessing. -
Run
cargo run --release
to generate the anagram dataset.