webapp.rs

A web application completely written in Rust.

Github星跟踪图

WebApp.rs

CircleCI
Coverage
Deps
Docs master
Docs release
Docs release backend
Docs release frontend
License MIT
Crates.io
Crates.io
Crates.io

A web application completely written in Rust

Target of this project is to write a complete web application including backend
and frontend within Rust.

Rust wasm             Rust app
in browser <- REST -> HTTP Server -- actix-web, Yew                   Diesel (ORM) -> PostgreSQL

Blog Posts

  1. A Web Application completely in Rust.
  2. Lessons learned on writing web applications completely in Rust.

Build

The following build dependencies needs to be fulfilled to support the full
feature set of this application:

The app consist of a frontend and a backend. For getting started with hacking,
the backend can be tested via make run-backend, whereas the frontend can be
tested with make run-frontend. You can adapt the application configuration
within Config.toml if needed.

This installs build requirements, rust and cargo-web, on Ubuntu or Debian.

wget https://sh.rustup.rs -O rustup-init
sudo sh rustup-init -y
sudo apt-get install -y pkg-config libssl-dev
sudo cargo install cargo-web

This builds the project.

git clone https://github.com/saschagrunert/webapp.rs.git
cd webapp.rs
make all

Run

make deploy uses podman to start a PostgreSQL container and the Rust backend container.
If you wish to use docker instead of podman, set CONTAINER_RUNTIME=podman in the top of Makefile.
Edit Config.toml if needed to set the backend url and PostgreSQL credentials:

[server]
url = "http://127.0.0.1:30080"
...
[postgres]
host = "127.0.0.1"
username = "username"
password = ""
database = "database"

Ensure the runtime dependencies are installed, and the start the two containers.

sudo apt install -y postgresql-client
cargo install diesel_cli --no-default-features --features "postgres"
sudo make deploy

The application should now be accessible at
http://127.0.0.1:30080.
During development, you can start the containers separately, using
make run-app to start only the rust backend container, and run-postgres to start only the PostgreSQL container.

If both the backend and frontend are running, you can visit the web application
at http://127.0.0.1:30080. After the successful
loading of the application you should see an authentication screen like this:

authentication screen

The login screen will accept any username and password that are equal, such as me (username) and me (password). There is currently no further user
authentication yet, but non matching combination will result in an
authentication failure. After the successfully login you should be able to see
the content of the application:

content screen

The authentication should persist, even after a manual page reload. Logging out
of the application via the logout button should also work as intended.

Control Flow

The complete control flow of the application looks like this:

control screen

Contributing

You want to contribute to this project? Wow, thanks! So please just fork it and
send me a pull request.

主要指标

概览
名称与所有者saschagrunert/webapp.rs
主编程语言Rust
编程语言Rust (语言数: 7)
平台
许可证MIT License
所有者活动
创建于2018-06-09 10:14:05
推送于2023-03-16 12:07:33
最后一次提交2022-10-20 11:24:25
发布数1
最新版本名称v1.0.0 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数2.2k
关注者数44
派生数221
提交数1.8k
已启用问题?
问题数26
打开的问题数10
拉请求数1676
打开的拉请求数13
关闭的拉请求数225
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?