Skip to content

Example of using a full stack with Rust.

License

Notifications You must be signed in to change notification settings

ersonp/mone-goblin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of using a full stack with Rust.

This repository is an example of a complete stack built entirely in Rust ("RASTY"):

  • Rust as almost unique base language (except for minimal JS needed to style the interface with TailwindCSS)
  • Actix-web, a Rust framework, for the backend (our API server)
  • SurrealDB, the database that connects with our API, which has been developed by its creators with Rust
  • Yew.rs, Rust's web framework for building web applications with Webassembly

In itself, the frontend applications perform a CRUD to the database using the RESTful API.


To run the application stack

1.- actix-surrealdb-api, server/API built using Rust's Actix-web framework and SurrealDB database running in a Docker container.

In addition to the obvious prerequisite of having Rust and Docker installed, we need to do the following:

Create the container with a SurrealDB image and a Docker managed storage volume running at the project root:

$ docker compose up -d

If we have cargo-watch installed using:

$ cargo install cargo-watch

we won't have to restart the server every time we make a code change; running the following command in the root of the project actix-surrealdb-api:

$ cargo watch -x run

rather:

$ cargo run

the server will restart automatically 😀.

To stop the Docker container in which SurrealDB is running:

$ docker stop surrealdb

And to raise the container again:

$ docker start surrealdb

We can read the content of the database with the commands:

$ docker exec -it surrealdb /surreal sql -c http://localhost:8000 -u root -p root --ns namespace --db database --pretty

namespace/database> SELECT * FROM task ORDER BY created_at DESC;

2.- todo-yew-web, Web application developed with Rust/WebAssembly + Yew + Tailwindcss.

To run the Web App, add the WebAssembly target:

$ rustup target add wasm32-unknown-unknown

Install Trunk (web application bundler for Rust) to run the app:

$ cargo install trunk

Run the following command in the root of the project todo-yew-web:

$ trunk serve

Build the application by running:

$ trunk build --release

About

Example of using a full stack with Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published