To begin working with the Graphite codebase, you will need to set up the project to build and run on your local machine. Development usually involves running the dev server which watches for changes to frontend (web) and backend (Rust) code and automatically recompiles and reloads the Graphite editor in your browser.
Dependencies
Graphite is built with Rust and web technologies, which means you will need to install:
Next, install the dependencies required for development builds:
Regarding the last one: you'll likely get faster build times if you manually install that specific version of wasm-bindgen-cli
. It is supposed to be installed automatically but a version mismatch causes it to reinstall every single recompilation. It may need to be manually updated periodically to match the version of the wasm-bindgen
dependency in Cargo.toml
.
Linux users: click here
On Linux, you likely need to install this set of additional packages which are required by Tauri, even if you're just building the web app:
# On Debian-based (Ubuntu, Mint, etc.) distributions:
# On Fedora-based (RHEL, CentOS, etc.) distributions:
# On OpenSUSE-based distributions:
# On NixOS or when using the Nix package manager:
Repository
Clone the project to a convenient location:
Development builds
From either the /
(root) or /frontend
directories, you can run the project by executing:
This spins up the dev server at http://localhost:8080 with a file watcher that performs hot reloading of the web page. You should be able to start the server, edit and save web and Rust code, and shut it down by double pressing CtrlC. You sometimes may need to reload the browser's page if hot reloading didn't behave right.
This method compiles Graphite code in debug mode which includes debug symbols for viewing function names in stack traces. But be aware, it runs slower and the Wasm binary is much larger. Having your browser's developer tools open will also significantly impact performance in both debug and release builds, so it's best to close that when not in use.
Production builds
You'll rarely need to compile your own production builds because our CI/CD system takes care of deployments. However, you can compile a production build with full optimizations by first installing the additional cargo-about
dev dependency:
And then running:
This produces the /frontend/dist
directory containing the static site files that must be served by your own web server.