• This repository has been archived on 12/Sep/2023
  • Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 4 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

Tool for building Rust functions for Node.js. Combine the performance of Rust, safety and portability of WebAssembly, and ease of use of JavaScript.

rustwasmc

Rust compiler toolkit for WebAssembly apps in the WasmEdge Runtime

npm npm GitHub language count GitHub top language

Developers: Getting started with the Second State Functions (a serverless FaaS service), Tencent Serverless Functions for AI inference, or your own Node.js server.

About

A one-stop tool for building Rust functions into WebAssembly for deployment on the WasmEdge Runtime.

Prerequisite

You will need to install the Rust compiler in order to use rustwasmc. Currently, we support up to Rust 1.50.0.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ source $HOME/.cargo/env

Install

From Linux command line

$ curl https://raw.githubusercontent.com/second-state/rustwasmc/master/installer/init.sh -sSf | sh

From NPM and Node.js

$ npm install -g rustwasmc # Append --unsafe-perm if permission denied

Usage

To build Rust functions for Node.js applications, use the following command. See a template application. The rustwasmc compiles and generates the wasm file, and the corresponding JavaScript file to call wasm functions from JavaScript. If the rust package contains only binary crate(s) and there are no library crate, the build command will only generate a wasm-wasi file for running as a standalone command program in the WasmEdge VM.

$ rustwasmc build

In most cases, you will want to enable AOT optimization in order to improve performance.

$ rustwasmc build --enable-aot

If you would like to use WasmEdge's extended APIs including Tensorflow, enable the extensions. Make sure that you install the wasmedge-extensions NPM module in this case.

$ rustwasmc build --enable-aot --enable-ext

To build Rust functions for Deno applications, use the following command. See a template application.

$ rustwasmc build --target deno

By default, rustwasmc will generate a directory for it's build output called pkg. If you'd like to customize this you can use the --out-dir flag.

$ rustwasmc build --out-dir out

Use clean subcommand to remove pkg and target directories.

$ rustwasmc clean

Logging

rustwasmc uses env_logger to produce logs when rustwasmc runs.

To configure your log level, use the RUST_LOG environment variable. For example:

$ RUST_LOG=info rustwasmc build

Known issues

For Rust version 1.51 and above, rustwasmc generates bytecode without WASI support. That means programs that access the file system, date and time, environment variables, and command line arguments would fail on Rust 1.50+. This should not affect most application use cases. We are working on a solution.

Acknowledgment

This project is derived from the open source wasm-pack.

More Repositories

1

wasmedge-quickjs

A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge.
JavaScript
487
star
2

wasm-learning

Building Rust functions for Node.js to take advantage of Rust's performance, WebAssembly's security and portability, and JavaScript's ease-of-use. Demo code and recipes.
Rust
430
star
3

SOLL

SOLL is a new compiler for generate Ewasm from solidity and yul. See a demo here: https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a
C++
376
star
4

buidl

A browser-based IDE for creating, deploying, and sharing blockchain apps (DApps, or decentralized apps). Publish your first blockchain DApps in 5 minutes! Here is how: https://docs.secondstate.io/buidl-developer-tool/getting-started
Vue
364
star
5

microservice-rust-mysql

A template project for building a database-driven microservice in Rust and run it in the WasmEdge sandbox.
Rust
346
star
6

dapr-wasm

A template project to demonstrate how to run WebAssembly functions as sidecar microservices in dapr
Rust
275
star
7

smart-contract-search-engine

Takes a link to a smart contract's raw ABI file and an RPC URL and then indexes all instances of that smart contract
JavaScript
267
star
8

WasmEdge-WASINN-examples

Rust
237
star
9

LlamaEdge

The easiest & fastest way to run customized and fine-tuned LLMs locally or on the edge
Rust
206
star
10

wasmedge-nodejs-starter

A template project to run Rust functions in Node.js through the Second State WebAssembly engine.
JavaScript
158
star
11

how_to_deploy_uniswap

Detailed instructions on how to deploy Uniswap on an Ethereum compatible blockchain
JavaScript
124
star
12

chat-with-chatgpt

Chat with ChatGPT via GitHub issue comments.
111
star
13

WasmEdge-go

The GO language SDK and API for WasmEdge
Go
107
star
14

vercel-wasm-runtime

A template project for building high-performance, portable, and safe serverless functions in Vercel.
JavaScript
81
star
15

wasmedge-containers-examples

Shell
71
star
16

wasmedge_wasi_socket

A Rust lib for socket on WasmEdge.
Rust
70
star
17

meetups

70
star
18

rust-by-example-ext

Rust by Example -- Extended Edition
Dockerfile
64
star
19

lity

A rule-based contract-oriented high-level language.
C++
56
star
20

wasm-joey

Serverless Wasm - A lightweight Node.js application for deploying and executing WebAssembly(Wasm) binary-code via HTTP
JavaScript
54
star
21

ssvm-deno-starter

A template project to run Rust functions in Deno through the Second State WebAssembly engine.
Dockerfile
53
star
22

SewUp

A library to help you sew up your Ethereum project with Rust and just like develop in a common backend
Rust
52
star
23

rust-wasm-ai-demo

Rust functions for Tensorflow inference in Node.js. Rust's performance, WebAssembly's security and portability, and Javascript's ease-of-use.
Dockerfile
49
star
24

WasmEdge-go-examples

Go
46
star
25

recrypt-as-a-service

An open key management service to support privacy-first and scalable file sharing.
Rust
46
star
26

learn-rust-with-github-actions

Getting started with the Rust programming language using this VSCode and GitHub Actions template.
Dockerfile
46
star
27

aws-lambda-wasm-runtime

A template project for building high-performance, portable, and safe serverless functions in AWS Lambda.
JavaScript
44
star
28

wasmedge-seL4

Integrate WasmEdge with seL4
Shell
42
star
29

dapr-sdk-wasmedge

An experimental Dapr SDK in Rust. It is designed to run in WasmEdge applications.
Rust
41
star
30

MEGA

Make ETLs Great Again!
Rust
40
star
31

tencent-tensorflow-scf

A template project for serverless functions for Tensorflow inference on Tencent Cloud.
HTML
38
star
32

simple-staking-smart-contract

A smart contract which allows users to stake and un-stake (after a set period of time) a specified ERC20 token.
Solidity
38
star
33

wasm32-wasi-benchmark

C++
35
star
34

WebAssembly-landscape

The current development of WebAssembly
34
star
35

rust-examples

Simple Rust applications that run in WasmEdge
Rust
32
star
36

wasmedge-rustsdk-examples

Rust
31
star
37

tencent-scf-wasm-runtime

基于 WebAssembly 容器镜像的高性能腾讯云函数开发模版。A template project for building high-performance, portable, and safe serverless functions in Tencent Serverless Cloud Functions.
JavaScript
29
star
38

crunw

Add WasmEdge support to crun so that Docker and k8s tools can manage WasmEdge runtimes side by side with Docker-like application containers.
C
29
star
39

wasmedge-bindgen

Let WebAssembly's exported function support more data types for its parameters and return values.
Rust
29
star
40

wasmedge_tensorflow_interface

Rust
20
star
41

kubecon-eu-2023

20
star
42

substrate-ewasm

A substrate runtime module library (SRML) for Etherem flavored WebAssembly (ewasm)
18
star
43

runw

C++
18
star
44

simple-timelock-smart-contract

A simple timelock smart contract which locks ERC20 tokens for a specific time period and then allows users to unlock when that time period has elapsed
Solidity
17
star
45

netlify-wasm-runtime

A template project for building high-performance, portable, and safe serverless functions in Netlify.
JavaScript
16
star
46

rust-ssvm

Use EVMC binding SSVM and host written in Rust
Rust
15
star
47

serverless-reactor-starter

Rust
15
star
48

hugo-website

A no-code, no-software and no-cost solution to publishing sophisticated web sites managed by non-technical people.
HTML
15
star
49

witc

wasm-interface-types supplement & compiler of wasmedge
Haskell
13
star
50

ssvm-napi

SSVM Node.js Addon
C++
12
star
51

WasmEdge-tensorflow

C++
12
star
52

AI-as-a-Service

Rust
12
star
53

OCR-tesseract-on-Centos7

How to install and use tesseract OCR on Centos7 - without root access
11
star
54

interest-earner-smart-contract

A Solidity smart contract which allows users to stake, earn and un-stake.
Solidity
10
star
55

linear-timelock-smart-contract

Solidity smart contract which disburses ERC20 tokens linearly, over a specific period of time (all values are dynamic and are set by the contract owner)
Solidity
10
star
56

substrate-wasmedge

Substrate on WasmEdge
Rust
10
star
57

ssvm-tencent-starter

Shell
9
star
58

nodejs-helper

Rust
9
star
59

WasmEdge-tensorflow-tools

C++
9
star
60

llm-web-api-server

Rust
8
star
61

wasm-llm

Python
6
star
62

WasmEdge-evmc

Second State WebAssembly VM for EVMC Extension
C++
6
star
63

wasmedge-core

WasmEdge Node.js Addon
C++
6
star
64

wasmedge_plugin_rust_sdk

Rust
5
star
65

tencent-meme-scf

HTML
5
star
66

chatbot-ui

TypeScript
5
star
67

WasmEdge-image

C
5
star
68

qdrant-rest-client

A lightweight Qdrant client library for Rust
Rust
4
star
69

llm_todo

Python
4
star
70

wasmedge-mysql

A repository which provides a MySQL persistent storage solution for the WasmEdge runtime
JavaScript
4
star
71

SSVMRPC

A Remote Procedure Call (RPC) implementation which facilitates both code-deployment and code-execution interactions with SecondState's stateless Virtual Machine (SSVM)
Rust
4
star
72

opendapps

HTML
4
star
73

ssvm-napi-extensions

C++
4
star
74

micro-slots

Storing and accessing multiple integer values in Ethereum, using only one single uint256 slot
Python
4
star
75

libeni

Official C++ implementation of libENI, which is part of the Lity project.
C++
4
star
76

serialize_deserialize_u8_i32

A Rust library that safely converts, back and forward, between u8 and i32
Rust
3
star
77

tencent-ocr-scf

Serverless functions for OCR on Tencent Cloud.
HTML
3
star
78

ssvm-tencent-tensorflow

HTML
3
star
79

wasmedge_hostfunctionexample_interface

This is an example to create a host function interface for calling the WasmEdge internal host functions.
Rust
3
star
80

wasmmark

JavaScript
3
star
81

wasmedge-extensions

WasmEdge for Node.js Addon with extensions
C++
3
star
82

server-side-wasm-video-editing

An example of how to build a third-party application that uses SecondState's Wasm VM to edit video on the server side. This prototype shows how video can undergo frame-by-frame, pixel-by-pixel processing using native Wasm data only i.e. pixel as i32
HTML
3
star
83

docai-hf-rs

Document AI for WasmEdge
2
star
84

linkerd-wasm

A template project to run WebAssembly functions as microservices in Linkerd
2
star
85

wasmedge_process_interface

Rust
2
star
86

rfq-marketplace

Rust
2
star
87

WASI-NN-GGML-PLUGIN-REGISTRY

This is a registry project for storing all released WasmEdge WASI-NN GGML plugin with different llama.cpp versions.
2
star
88

linear-timelock-user-interface

Interface for LinearTimelock.sol smart contract
JavaScript
2
star
89

rust-faas-showcases

HTML
2
star
90

rust_native_storage_library

A library which compiles to `.so` and `.dylib` and facilitates the native storage (and retrieval) of key:value pairs on the host system
Rust
2
star
91

WasmEdge-storage

Second State WebAssembly VM for Rust Storage Extension
C++
2
star
92

simple-timelock-user-interface

A user interface for the simple timelock smart contract
JavaScript
2
star
93

WasmEdge-paratime

An Oasis Paratime using WasmEdge
Rust
2
star
94

SSVMContainer

A Rust application that sits between incoming requests from the network and the SSVM. This application handles the deployment of Wasm applications and manages the execution of services (callable functions inside the Wasm application). The actual execution takes place inside the SSVM. The SSVM is a stack-based Virtual Machine which is stateless. This SSVMContainer application is responsible for fielding incoming deployments and service calls as well as storing application state.
HTML
2
star
95

wasmedge_rustls_api

Rust
1
star
96

libsql_wasi_nn

Rust
1
star
97

haiku-connector

Haiku Connector Runner
Rust
1
star
98

wasmedge_hyper_rustls

A crate similar to rustls-hyper for wasi.
Rust
1
star
99

wasmedge_asyncify

Rust
1
star
100

interest-earner-user-interface

A user interface for the interest earner smart contract
JavaScript
1
star