{"id":13564917,"url":"https://github.com/tessi/wasmex","last_synced_at":"2025-06-16T23:01:56.846Z","repository":{"id":39793069,"uuid":"234062689","full_name":"tessi/wasmex","owner":"tessi","description":"Execute WebAssembly from Elixir","archived":false,"fork":false,"pushed_at":"2025-06-16T10:03:17.000Z","size":17941,"stargazers_count":638,"open_issues_count":11,"forks_count":38,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-06-16T11:20:47.885Z","etag":null,"topics":["elixir","elixir-library","rust","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tessi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-01-15T11:11:19.000Z","updated_at":"2025-06-16T10:02:04.000Z","dependencies_parsed_at":"2024-01-05T22:00:06.271Z","dependency_job_id":"d2ef7e89-0d97-4e57-ab15-d565a8b9da32","html_url":"https://github.com/tessi/wasmex","commit_stats":{"total_commits":160,"total_committers":12,"mean_commits":"13.333333333333334","dds":0.55,"last_synced_commit":"6594e2c1d592c0c58f72200d4eb2285b33c0f327"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/tessi/wasmex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessi%2Fwasmex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessi%2Fwasmex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessi%2Fwasmex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessi%2Fwasmex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tessi","download_url":"https://codeload.github.com/tessi/wasmex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessi%2Fwasmex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260148949,"owners_count":22966003,"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":["elixir","elixir-library","rust","wasm","webassembly"],"created_at":"2024-08-01T13:01:37.913Z","updated_at":"2025-06-16T23:01:56.766Z","avatar_url":"https://github.com/tessi.png","language":"Rust","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"300\" src=\"./logo.svg\" alt=\"Wasmex logo\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/tessi/wasmex/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/tessi/wasmex.svg\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/tessi/wasmex/actions/workflows/elixir-ci.yml\"\u003e\n    \u003cimg src=\"https://github.com/tessi/wasmex/actions/workflows/elixir-ci.yml/badge.svg?branch=main\" alt=\"CI\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nWasmex is a fast and secure [WebAssembly](https://webassembly.org/) and [WASI](https://github.com/WebAssembly/WASI) runtime for Elixir.\nIt enables lightweight WebAssembly containers to be run in your Elixir backend.\n\nIt uses [wasmtime](https://wasmtime.dev) to execute Wasm binaries through a [Rust](https://www.rust-lang.org) NIF.\n\nDocumentation can be found at [https://hexdocs.pm/wasmex](https://hexdocs.pm/wasmex/Wasmex.html).\n\n## Install\n\nThe package can be installed by adding `wasmex` to your list of\ndependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:wasmex, \"~\u003e 0.11.2\"}\n  ]\nend\n```\n\n## Example\n\nThere is a toy Wasm program in `test/wasm_test/src/lib.rs`, written in Rust (but could potentially be any other language that compiles to WebAssembly).\nIt defines many functions we use for end-to-end testing, but also serves as example code. For example:\n\n```rust\n#[no_mangle]\npub extern fn sum(x: i32, y: i32) -\u003e i32 {\n    x + y\n}\n```\n\nOnce this program compiled to WebAssembly (which we do every time when running tests), we end up with a `wasmex_test.wasm` binary file.\n\nThis Wasm file can be executed in Elixir:\n\n```elixir\nbytes = File.read!(\"wasmex_test.wasm\")\n{:ok, pid} = Wasmex.start_link(%{bytes: bytes}) # starts a GenServer running a Wasm instance\n{:ok, [42]} == Wasmex.call_function(pid, \"sum\", [50, -8])\n```\n\n## What is WebAssembly?\n\nQuoting [the WebAssembly site](https://webassembly.org/):\n\n\u003e WebAssembly (abbreviated Wasm) is a binary instruction format for a\n\u003e stack-based virtual machine. Wasm is designed as a portable target\n\u003e for compilation of high-level languages like C/C++/Rust, enabling\n\u003e deployment on the web for client and server applications.\n\nAbout speed:\n\n\u003e WebAssembly aims to execute at native speed by taking advantage of\n\u003e [common hardware\n\u003e capabilities](https://webassembly.org/docs/portability/#assumptions-for-efficient-execution)\n\u003e available on a wide range of platforms.\n\nAbout safety:\n\n\u003e WebAssembly describes a memory-safe, sandboxed [execution\n\u003e environment](https://webassembly.org/docs/semantics/#linear-memory) […].\n\nUsing WebAssembly on an Elixir host is great not only, but especially for the following use cases:\n\n* Running user-provided code safely\n* Share business logic between systems written in different programming languages. E.g. a JS frontend and Elixir backend\n* Run existing libraries/programs and easily interface them from Elixir\n\n## Development\n\nTo set up a development environment install [the latest stable rust](https://www.rust-lang.org/tools/install) and rust-related tooling:\n\n```bash\nrustup component add rustfmt\nrustup component add clippy\nrustup target add wasm32-unknown-unknown # to compile our example Wasm files for testing\nrustup target add wasm32-wasip1 # to compile our example Wasm/WASI files for testing\ncargo install --locked cargo-component # for Wasm component model files\n```\n\nThen install the erlang/elixir dependencies:\n\n```bash\nasdf install # assuming you install elixir, erlang with asdf. if not, make sure to install them your way\nmix deps.get\n```\n\nIf you plan to change something on the Rust part of this project, set the following ENV `WASMEX_BUILD=true` so that your changes will be picked up.\n\nI´m looking forward to your contributions. Please open a PR containing the motivation of your change. If it is a bigger change or refactoring, consider creating an issue first. We can discuss changes there first which might safe us time down the road :)\n\nAny changes should be covered by tests, they can be run with `mix test`.\nIn addition to tests, we expect the formatters and linters (`cargo fmt`, `cargo clippy`, `mix format`, `mix credo`) to pass.\n\n## License\n\nThe entire project is under the MIT License. Please read [the`LICENSE` file](https://github.com/tessi/wasmex/blob/master/LICENSE).\n\n### Licensing\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, shall be licensed as above, without any\nadditional terms or conditions.\n","funding_links":[],"categories":["WebAssembly","Elixir","Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftessi%2Fwasmex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftessi%2Fwasmex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftessi%2Fwasmex/lists"}