{"id":13432766,"url":"https://github.com/second-state/rustwasmc","last_synced_at":"2025-10-07T06:31:33.287Z","repository":{"id":37178390,"uuid":"247967570","full_name":"second-state/rustwasmc","owner":"second-state","description":"Tool for building Rust functions for Node.js. Combine the performance of Rust, safety and portability of WebAssembly, and ease of use of JavaScript.","archived":true,"fork":false,"pushed_at":"2023-03-27T22:43:12.000Z","size":341,"stargazers_count":129,"open_issues_count":19,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-26T08:03:04.683Z","etag":null,"topics":["javascript","node-js","nodejs","rust","rust-functions","rust-lang","second-state","wasm","wasmedge","webassembly"],"latest_commit_sha":null,"homepage":"https://www.secondstate.io/articles/rustwasmc/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/second-state.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-03-17T12:46:23.000Z","updated_at":"2024-04-20T14:27:07.000Z","dependencies_parsed_at":"2024-01-16T01:26:02.505Z","dependency_job_id":null,"html_url":"https://github.com/second-state/rustwasmc","commit_stats":{"total_commits":94,"total_committers":4,"mean_commits":23.5,"dds":0.2021276595744681,"last_synced_commit":"fb9b16514b86e953c594afe3d0d9f67d35900fa5"},"previous_names":["second-state/ssvmup"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Frustwasmc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Frustwasmc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Frustwasmc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Frustwasmc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/second-state","download_url":"https://codeload.github.com/second-state/rustwasmc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235600004,"owners_count":19016192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","node-js","nodejs","rust","rust-functions","rust-lang","second-state","wasm","wasmedge","webassembly"],"created_at":"2024-07-31T02:01:16.312Z","updated_at":"2025-10-07T06:31:27.995Z","avatar_url":"https://github.com/second-state.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003erustwasmc\u003c/h1\u003e\n  \u003cp\u003e\n    \u003cstrong\u003eRust compiler toolkit for WebAssembly apps in the WasmEdge Runtime\u003c/strong\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n![npm](https://img.shields.io/npm/v/rustwasmc)\n![npm](https://img.shields.io/npm/dt/rustwasmc)\n![GitHub language count](https://img.shields.io/github/languages/count/second-state/rustwasmc)\n![GitHub top language](https://img.shields.io/github/languages/top/second-state/rustwasmc)\n\nDevelopers: Getting started with the [Second State Functions](https://www.secondstate.io/articles/getting-started-with-function-as-a-service-in-rust/) (a serverless FaaS service), [Tencent Serverless Functions for AI inference](https://github.com/second-state/tencent-tensorflow-scf/blob/main/README-en.md), or [your own Node.js server](https://www.secondstate.io/articles/getting-started-with-rust-function/).\n\n## About\n\nA one-stop tool for building Rust functions into WebAssembly for deployment on the [WasmEdge Runtime](https://github.com/WasmEdge/WasmEdge). \n\n## Prerequisite\n\nYou will need to install the Rust compiler in order to use `rustwasmc`. Currently, we support up to Rust 1.50.0.\n\n```\n$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n$ source $HOME/.cargo/env\n```\n\n## Install\n\nFrom Linux command line\n\n```\n$ curl https://raw.githubusercontent.com/second-state/rustwasmc/master/installer/init.sh -sSf | sh\n```\n\nFrom NPM and Node.js\n\n```\n$ npm install -g rustwasmc # Append --unsafe-perm if permission denied\n```\n\n## Usage\n\nTo build [Rust functions for Node.js](https://www.secondstate.io/articles/getting-started-with-rust-function/) applications, use the following command. See a [template application](https://github.com/second-state/wasmedge-nodejs-starter). 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.\n\n```\n$ rustwasmc build\n```\n\nIn most cases, you will want to enable AOT optimization in order to improve performance.\n\n```\n$ rustwasmc build --enable-aot\n```\n\nIf 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.\n\n```\n$ rustwasmc build --enable-aot --enable-ext\n```\n\nTo build Rust functions for Deno applications, use the following command. See a [template application](https://github.com/second-state/ssvm-deno-starter).\n\n```\n$ rustwasmc build --target deno\n```\n\nBy 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.\n\n```\n$ rustwasmc build --out-dir out\n```\n\nUse clean subcommand to remove pkg and target directories.\n```\n$ rustwasmc clean\n```\n\n## Logging\n\n`rustwasmc` uses [`env_logger`] to produce logs when `rustwasmc` runs.\n\nTo configure your log level, use the `RUST_LOG` environment variable. For example:\n\n```\n$ RUST_LOG=info rustwasmc build\n```\n\n[`env_logger`]: https://crates.io/crates/env_logger\n\n## Known issues\n\nFor 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.\n\n## Acknowledgment\n\nThis project is derived from the open source [wasm-pack].\n\n[wasm-pack]: https://github.com/rustwasm/wasm-pack\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecond-state%2Frustwasmc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecond-state%2Frustwasmc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecond-state%2Frustwasmc/lists"}