• Stars
    star
    2,160
  • Rank 21,344 (Top 0.5 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A web application completely written in Rust. 🌍

WebApp.rs

CircleCI Coverage 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 wasm-pack, on Ubuntu or Debian.

> sudo apt-get update
> sudo apt-get install -y pkg-config libssl-dev npm sudo wget
> wget https://sh.rustup.rs -O rustup-init
> sudo sh rustup-init -y
> cargo install wasm-pack
> sudo npm install -g rollup

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=docker 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 then 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, it is even better 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.

More Repositories

1

demystifying-containers

A series of blog posts and talks about the world of containers 📦
Python
721
star
2

kubernix

Single dependency Kubernetes clusters for local testing, experimenting and development
Rust
710
star
3

git-journal

The Git Commit Message and Changelog Generation Framework 📖
Rust
564
star
4

indextree

Arena based tree 🌲 structure by using indices instead of reference counted pointers
Rust
533
star
5

demo

A framework for performing live pre-recorded command line demos in the wild 📼
Go
272
star
6

nn

A tiny neural network 🧠
Haskell
121
star
7

rain

Visualize vertical data inside your terminal 💦
Rust
88
star
8

ccli

Command line parsing in go, with coloring support 🌈
Go
83
star
9

func

Functional additions to C
C++
55
star
10

dotfiles

My hand crafted .dotfiles 🤚🛠❤️
Shell
48
star
11

performabot

Continuous performance analysis reports for software projects 🤖
Haskell
41
star
12

kmod

A Linux kernel module written in Rust
Rust
34
star
13

craft

Cargo inspired build system for C based projects
Rust
32
star
14

kubeflow-data-science-on-steroids

The blog post about Kubeflow, including all materials
Jupyter Notebook
30
star
15

go-modiff

Command line tool for diffing go module dependency changes between versions 📔
Go
29
star
16

yew-router

Router extension to yew
Rust
27
star
17

peel-ip

Packet parsing for the Internet Protocol Suite 📦
Rust
26
star
18

microservice-rs

Microservice template using Rust and Cap'n Proto RPCs.
Rust
26
star
19

peel

Dynamic packet parsing within trees 🌲🌳🌴
Rust
22
star
20

fosdem20

Demo material used for the Podman talk at FOSDEM 2020
Go
22
star
21

stm32h7-rs

Rust on STM32H7 Microcontrollers
Rust
14
star
22

syscall-recorder

ebpf syscall recording demo project
C
9
star
23

unibar

A GPU accelerated status bar written in Rust 🦄
Rust
8
star
24

seer

A collaborative resource planning tool 🔮
Haskell
5
star
25

fastcmp

A fast byte slice comparison library
Rust
5
star
26

path

IP based connection identification and tracing 👟
Rust
5
star
27

webapp.hs

Haskell
4
star
28

umask-observe

umask observability based on bpftrace for OpenShift nodes
Shell
3
star
29

mowl

My own little logger ✏️
Rust
3
star
30

crio-demos

CRI-O Demonstration Material
Go
3
star
31

failure

Pure and type driven error handling for Haskell
Haskell
2
star
32

build-rust

The Docker based Rust build toolchain
Dockerfile
2
star
33

pidwatch-rs

C
2
star
34

rapidc

Rust
2
star
35

kubeflow-notebook-gpu

Kubeflow GPU Notebook Container Image
Dockerfile
2
star
36

pinns.rs

A simple utility to pin Linux namespaces
Rust
2
star
37

backingFsBlockDev

Go
1
star
38

peeler

Peel your network traffic
Rust
1
star
39

tunneldevice

Playing around with tunnel devices in Rust
Rust
1
star
40

build-haskell

The Docker based Haskell build toolchain
Dockerfile
1
star
41

go-docgen

A markdown and man page documentation generator for go applications
Go
1
star
42

netfilter_kmod

Playing around with the netfilter within the kernel
C
1
star
43

ci

Haskell
1
star
44

netlink_kmod

Playing around with routing netlinks inside the kernel
C
1
star
45

seccomp-oci-artifact-demo

Go
1
star
46

byopki

Bring Your Own Public Key Infrastructure for container signing and verification demo
Shell
1
star