Rocket Yew WASM app documentation - Matthjass13/RustForTheWeb GitHub Wiki

How to use the app

Preparations

  • Clone the project
  • Install Docker desktop via this link (you can change on the left side bar depending on your OS: https://docs.docker.com/desktop/setup/install/windows-install/
  • After installation of docker, just go in the root of the project and launch docker compose up
  • create a .env at the root of the project and put these elements (the information in db are just for demo so password and all are not critical)

POSTGRES_USER=user1

POSTGRES_PASSWORD=password

POSTGRES_DB=postgres_db

Usage

  • Access the app with http://localhost:8001/
  • You can register a user with the role of admin or user and log with it. Depending on the role you may be allowed or not to do some of the actions below
  • You can fetch users list, add one, edit them and also delete
  • You can register a user with the "admin" or "user" role and log with it. Depending on the role, some actions may be restricted.

What does it demonstrate ?

It's a basic CRUD app but entirely done with Rust. For the backend, the framework Rocket was used. For the frontend, the framework Yew + Web Assembly are used to directly execute rust code into the web browser, showing a full stack web app entirely with Rust. Some elements of security were added like HTTP headers to avoid any scripting in the navigator or using the web app in a IFrame and also CORS Policy to only authorize calls from the frontend endpoint. Authentication was added to the app as well as protected HTPP routes with Request guards. The passwords are hashed using Argon2 algorithm.