Giter Club home page Giter Club logo

fullstack-rust's Introduction

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) :)

fullstack-rust's People

Contributors

produd avatar vascokk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fullstack-rust's Issues

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!

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.