Rust-Svelte-on-Rust

Starter template for Rocket backend server

Starter template for Svelte frontend apps with Rust Rocket backend server.

Requirements

  • Rust - Install
  • Svelte
  • Rocket
  • NodeJs - Install

We will use Rust nightly.

Background

Create a new project based on this example: Mozilla Developer Network, Getting Started with Svelte

Starting from scratch

Optional: Assuming you are not using this repository, to start with a clean slate for Rust/Svelte

npx degit sveltejs/template moz-todo-svelte
cd moz-todo-svelte
cargo new myproject
#now move stuff around

Installation

Install github CLI tool

Using these instructions

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
echo "Install rust and cargo (Rust's package manager)"
curl https://sh.rustup.rs -sSf | sh
echo "clone, or better yet your github cli tool"
git clone https://github.com/joemooney/rust-rocket-svelte
or
gh repo clone joemooney/rust-rocket-svelte
rustup override set nightly
npm install

These are the steps to get to the initial point for starting development. Then we move the svelte related files into the client directory etc.

Getting Started

Start Rocket server and Rollup in two different terminals

Terminal #1

To build and hot reload svelte components, this will not launch a http server.

npm run dev  

Terminal #2

Compile and run the rust rocket http server:

cargo run  
  • Navigate to localhost:8000. You should see your app running.
  • Svelte client code is in client directory. ** Upon saving changes live-reloading via rollup will be rendered in the browser.
  • Rust server Rocket code is in src directory. ** To rebuild Rust code use cargo run after saving your changes.
  • All static files are served from public direcotry. Including the JS code compiled by Svelte Compiler.

Building and running in production mode

To create an optimised version of the app:

npm run build
cargo build

Built With

Rocket

Svelte

Svelte Material UI

Svelte Material Icons

Change Log

Step 1

Initial barebones Rust/Rocket/Svelte page working.

Step 2

Got communication working from Svelete client calling Rust asynchronously.

Step 3

Added Material UI components to create a first draft user interface.

TODO: I did not keep track of all that I did, need to repeat the process.

npm i svelte-material-ui
npm i -D @smui/data-table
npm i -D @smui/tab
npm i -D @smui/tab-bar
npm i svelte-material-icons

Versions

Find the latest versions by id

Information - Updated Jun 02, 2022

Stars: 2
Forks: 3
Issues: 0

Tensorflow rust bindings with loads of easy to use documentation

bindings for documentation can be found in github or on our docs page

Tensorflow rust bindings with loads of easy to use documentation

Wasm template for Rust hosting without npm-deploy on github pages using Travis script

It automatically hosts your wasm projects on gh-pages using a travis script on the latest commit

Wasm template for Rust hosting without npm-deploy on github pages using Travis script

If you like Rusty Engine, please sponsor me on GitHub or on Patreon, or take...

If you like Rusty Engine, please sponsor me on Patreon, or Bevy, which I encourage you to use directly for more serious game engine needs

If you like Rusty Engine, please sponsor me on GitHub or on Patreon, or take...

Try Out Development Containers: Rust

A development container is a running GitHub Codespaces or vscode-remote-try-* sample projects, too

Try Out Development Containers: Rust

Roctogen: a rust client library for the GitHub v3 API

This client API is generated from the Isahc HTTP client

Roctogen: a rust client library for the GitHub v3 API

Rust crate for logging to LogDNA

Bug reports and pull requests are welcome on GitHub at

Rust crate for logging to LogDNA

A rust github template for ease of use

Install the rust toolchain in order to have cargo installed by following

A rust github template for ease of use

Rust-generated WebAssembly GitHub action template

A template to bootstrap the creation of a Rust-generated WebAssembly GitHub action

Rust-generated WebAssembly GitHub action template

Template for Rust lib/bin module with built-in GitHub Action to build and test

You will want to change the lib name and bin name in Cargo

Template for Rust lib/bin module with built-in GitHub Action to build and test

cargo_auto_github_lib

Library for cargo-auto automation tasks written in rust language with functions for github

cargo_auto_github_lib

A Rust library to connect to AxonServer

See the GitHub project Command / Query Responsibility Segregation (CQRS)

A Rust library to connect to AxonServer
Facebook Instagram Twitter GitHub Dribbble
Privacy