Coder Social home page Coder Social logo

ricardoalmeida / rust-yew-realworld-example-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetli/rust-yew-realworld-example-app

1.0 1.0 0.0 9.15 MB

Exemplary real world app built with Rust + Yew + WebAssembly, by Function Components + Hooks, also supports desktop by Tauri.

Home Page: https://jetli.github.io/rust-yew-realworld-example-app/

License: Apache License 2.0

Rust 98.59% HTML 0.91% TypeScript 0.05% Dockerfile 0.40% Shell 0.05%

rust-yew-realworld-example-app's Introduction

RealWorld Example App

Continuous Integration RealWorld Frontend

Rust + Yew + WebAssembly codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged WebAssembly web application built with Yew including CRUD operations, authentication, routing, pagination, and more. It utilizes Yew's latest function components and hooks. It also supports desktop application powered by Tauri.

We've gone to great lengths to adhere to the Yew community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it looks

You can view a live demo over at Demo

Home(Web) Article(Web)
Home Article
Edit(Desktop) Sign Up(Desktop)
Edit Sign Up

How it works

This is an application written in Rust that utilizes Yew and WebAssembly for developing the frontend web app that powers the RealWorld application.

You can view a full list of crates being used in Cargo.toml, but here are some of the main ones of note:

  • yew - a modern Rust framework for creating multi-threaded frontend apps with WebAssembly.
  • yew-router - a routing library for the Yew framework.
  • yew-hooks - Hooks for the Yew web framework, inspired by react hook libs like streamich/react-use and alibaba/hooks.
  • lazy_static - a macro for declaring lazily evaluated statics in Rust.
  • parking_lot - provides implementations of Mutex, RwLock, Condvar and Once etc.
  • pulldown-cmark - a pull parser for CommonMark, used to parse Markdown.
  • serde - a generic serialization/deserialization framework.
  • chrono - date and time library for Rust.

Getting started

With Docker

docker-compose up

You can visit http://localhost:8000 in your browser now.

Manually

  • Install Rust

  • Install wasm-pack

    cargo install wasm-pack
  • Install node

  • Install npm packages

    npm run install
  • Build and develop

    Copy .env.example to .env, and you can change the environment variables if you like.

    cp .env.example .env
    npm start

    You can visit http://localhost:8000 in your browser now.

  • Build and release

    npm run build

    You should find static files at crates/conduit-wasm/dist folder now, they are hosted in gh-pages branch as a demo.

  • Test

    Install chromedriver, run tests in headless browsers.

    npm test

With Tauri for desktop (optional)

  • Install Tauri

    cargo install tauri-cli --version ^1.0.0-rc

    or

    cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch next
  • Build and develop for desktop

    cargo tauri dev
  • Build and release for desktop

    cargo tauri build

Create Yew App

This project was bootstrapped with Create Yew App, if you want to quickly setup a new Yew web app for your own, you might try Create Yew App, an unofficial tool to set up a modern Yew web app by simply running one command.

npx create-yew-app my-app
cd my-app
npm start

Contributing

Feel free to take a look at the current issues in this repo for anything that currently needs to be worked on.

You are also welcome to open a PR or a new issue if you see something is missing or could be improved upon.

License

Apache License (Version 2.0)

See LICENSE for details

rust-yew-realworld-example-app's People

Contributors

bk138 avatar jetli avatar mihai-dinculescu avatar

Stargazers

 avatar

Watchers

 avatar

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.