Reference implementation of a full-stack Rust application

Overview

Full-stack Rust with WebAssembly

Look Ma, No JavaScript !!!

img.png

My very first Rust project (implementation of the "Connect 5" game), I used as a learning tool.

My goal was to create some sort of a "reference implementation" of a Fullstack Rust application. Hopefully you will find it useful :). Here you can find how to:

Client:

  • build Web client in Rust, without a single line of JavaScript, using Yew WebAssembly framework
  • use yew-router for navigation between pages
  • use multithreading components, communicating by "message passing" with Yew Agents
  • use Yew StorageService to keep session data
  • utilise a CSS framework (Bulma)

Server:

  • Use Actix Web web framework to implement REST API
  • Diesel ORM with SQLite as default DB
  • Session cookies
  • Integration testing for the REST API
  • Mocking functions (db calls) in unit tests

Usage:

Install trunk and build the client:

cd client
cargo install trunk wasm-bindgen-cli
trunk build -d ../server/static/ 

Start the server:

cd server
cargo run --package connect5-rust --bin connect5-rust

Open http://127.0.0.1:8088/ in your browser. Open a second session in another browser for player #2.

There are still few things that need to be improved/fixed, but the project served it's purpose (for me, at least) and is useful as it is, so I'll probably won't be fixing them. Feel free, however, to do so and may be create some PR(s) :)

You might also like...
Web Application with using Rust(Actix, Diesel and etc)
Web Application with using Rust(Actix, Diesel and etc)

Santa Service App Used technology stack Web Server with using Rust (Actix, Actix-web, Diesel) Data base (Postgres) Console Application (Tokio) Tasks o

Oso is an open source policy engine for authorization that’s embedded in your application

Oso What is Oso? Oso is an open source policy engine for authorization that’s embedded in your application. It provides a declarative policy language

The official DAW application of the RustyDAW project (name in progress)
The official DAW application of the RustyDAW project (name in progress)

rusty-daw-application The official DAW application of the RustyDAW project (name in progress) Take a look at the design doc. Join our community at the

a port of yaxpeax-dis that runs as a web application

this a rough translation of yaxpeax-dis, the CLI tool, to instead accept architectures and data to disassemble as an HTTP request. the package is then deployed to dis.yaxpeax.net as a compute@edge application.

A web application to configuration Caddy based on MoonZoon.

Cream A web application to configuration Caddy based on MoonZoon. MoonZoon is a Rust Fullstack Framework. Live demo Run on a local machine Check you'v

Starknet application for Ledger Nano S, SP, X
Starknet application for Ledger Nano S, SP, X

Ledger Starkware app Please visit our website at zondax.ch This project contains the Starkware app (https://starkware.co/) for Ledger Nano S and X. Le

Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

Axum + JWT authentication Middleware that allows you to start building your application fast

axum_jwt_ware Integration Guide Simple Axum + JWT authentication middleware with implemented Login and refresh token. Goal I aim to simplify the proce

Extremely simple Axum + SolidJS starter for a fullstack web application.

royce Extremely simple Axum + SolidJS starter for a fullstack web application. Deploy immediately with a ready-to-use preconfigured Docker deployment.

Comments
  • Doesn't compile on Ubuntu or Windows 10

    Doesn't compile on Ubuntu or Windows 10

    I'm not sure if I'm doing something wrong, but the build doesn't recognize yew-services as a dependency.

    ~/rust/fullstack-rust$ cargo build Updating crates.io index Updating git repository https://github.com/yewstack/yew.git error: no matching package named yew-services found location searched: https://github.com/yewstack/yew.git?branch=master required by package client v0.1.0 (/home/azureuser/rust/fullstack-rust/client)

    ~/rust/fullstack-rust$ rustc --version rustc 1.54.0 (a178d0322 2021-07-26)

    Should I be using an older version of rust or is there something else I can do to resolve it?

    Obviously, it's not critical as I was just interested in your example, but I would try any suggestions you might have and get back to you. Thanks!

    opened by VincePlatt 1
  • Getting HTTP 405 when trying to register

    Getting HTTP 405 when trying to register

    Hi @vascokk, not sure if I'm missing something, but I ran the commands in the README and I'm getting a POST http://127.0.0.1:8088/register/a/a 405 (Method Not Allowed) when trying to register a user and a color. Are you able to run the project from the master branch?

    opened by adriaanjoubert 1
Owner
Vassil "Vasco" Kolarov
Vassil
A full-featured and easy-to-use web framework with the Rust programming language.

Poem Framework A program is like a poem, you cannot write a poem without writing it. --- Dijkstra A full-featured and easy-to-use web framework with t

Poem Web 2.2k Jan 6, 2023
A Rust GraphQL system with full support for subscriptions and authentication that works out of the box.

Diana is a GraphQL system for Rust that's designed to work as simply as possible out of the box, without sacrificing configuration ability.

arctic_hen7 36 Dec 19, 2022
Rust Axum Full Course code.

Rust Axum Full Course source code. YouTube Full Course: https://youtube.com/watch?v=XZtlD_m59sM&list=PL7r-PXl6ZPcCIOFaL7nVHXZvBmHNhrh_Q MIT OR Apache,

null 27 Apr 19, 2023
A highly customizable, full scale web backend for web-rwkv, built on axum with websocket protocol.

web-rwkv-axum A axum web backend for web-rwkv, built on websocket. Supports BNF-constrained grammar, CFG sampling, etc., all streamed over network. St

Li Junyu 12 Sep 25, 2023
Rust Rest API Stack with User Management

A secure-by-default rest api stack implemented with hyper, tokio, bb8 and postgres. This project is focused on providing end-to-end encryption by default for 12-factor applications. Includes a working user management and authentication backend written in postgresql with async S3 uploading for POST-ed data files.

Jay 10 Dec 25, 2022
Heavy Metal Leptos Stack with Tailwind, Axum, Sqlite, and Cargo Leptos

Heavy Metal Stack Leptos stack with Axum, TailwindCSS, and Sqlite This example creates a basic todo app with an Axum backend that uses Leptos' server

Ben Wishovich 7 Dec 31, 2022
A Rust application which funnels external webhook event data to an Urbit chat.

Urbit Webhook Funnel This is a simple Rust application which funnels external webhook event data to an Urbit chat. This application is intended to be

Robert Kornacki 15 Jan 2, 2022
Sample serverless application written in Rust

This is a simple serverless application built in Rust. It consists of an API Gateway backed by four Lambda functions and a DynamoDB table for storage.

AWS Samples 165 Jan 8, 2023
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
Build, bundle & ship your Rust WASM application to the web.

Trunk Build, bundle & ship your Rust WASM application to the web. ”Pack your things, we’re going on an adventure!” ~ Ferris Trunk is a WASM web applic

Anthony Dodd 2.2k Jan 7, 2023