2
0%
MIT
unpublishedneglected

Reasonably Reactive Rust

Demo/starter project using Reason + React and Rust + Rocket

Featuring:

Reasoning

This project was primarily created to combine some new technologies in order to see what a more complete project could look like and how the individual parts would work together. Specifics:

  • Rust: fast and safe code without garbage collection
  • Rocket: developer-focused conveniences over type safe code
  • Reason and ReasonReact: type safe interactions React and JavaScript
  • Parcel: frontend asset bundling with minimal configuration

Requirements

Getting Started

rustup override set nightly
yarn install
yarn develop

yarn develop will run Parcel in watch mode and leverage cargo-watch to rebuild frontend and backend applications on file change.

Building for Production

yarn build
cargo build --release

The result can be started with:

ROCKET_ENV=production cargo run --release

or your preferred manner.

Need a Reset?

yarn clean

F.A.Q.

Parcel is too new/unproven and/or is missing $FEATURE. Can it be changed out for $PREFERRED_BUNDLER?
Parcel was specifically chosen for this purpose because it requires minimal configuration to get started. To swap it out, remove Parcel as a dependency (e.g. yarn remove parcel-bundler), add another bundler (e.g. yarn add --dev $PREFERRED_BUNDLER), and update the scripts in package.json to use that bundler.
Rust nightly changes too frequently. What now?
Rust stable will need to be setup as the default for the project (e.g. rustup override set stable). This would require a change from Rocket to something else. See below.
Rocket has too much magic. What are alternative options?
Are we web yet? has a list of potential alternatives. Once one has been selected, replace Rocket specific dependencies in Cargo.toml and code in src with $PREFERRED_WEB_FRAMEWORK related goodies.

License

This project is licensed under the MIT License. See LICENSE for more details.