xref: /wasmtime-44.0.1/README.md (revision eaa01d7b)
1<div align="center">
2  <h1><code>wasmtime</code></h1>
3
4  <p>
5    <strong>A standalone runtime for
6    <a href="https://webassembly.org/">WebAssembly</a></strong>
7  </p>
8
9  <strong>A <a href="https://bytecodealliance.org/">Bytecode Alliance</a> project</strong>
10
11  <p>
12    <a href="https://github.com/bytecodealliance/wasmtime/actions?query=workflow%3ACI"><img src="https://github.com/bytecodealliance/wasmtime/workflows/CI/badge.svg" alt="build status" /></a>
13    <a href="https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime"><img src="https://img.shields.io/badge/zulip-join_chat-brightgreen.svg" alt="zulip chat" /></a>
14    <img src="https://img.shields.io/badge/rustc-stable+-green.svg" alt="supported rustc stable" />
15    <a href="https://docs.rs/wasmtime"><img src="https://docs.rs/wasmtime/badge.svg" alt="Documentation Status" /></a>
16  </p>
17
18  <h3>
19    <a href="https://bytecodealliance.github.io/wasmtime/">Guide</a>
20    <span> | </span>
21    <a href="https://bytecodealliance.github.io/wasmtime/contributing.html">Contributing</a>
22    <span> | </span>
23    <a href="https://wasmtime.dev/">Website</a>
24    <span> | </span>
25    <a href="https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime">Chat</a>
26  </h3>
27</div>
28
29## Installation
30
31The Wasmtime CLI can be installed on Linux and macOS (locally) with a small install
32script:
33
34```console
35curl https://wasmtime.dev/install.sh -sSf | bash
36```
37This script installs into `$WASMTIME_HOME` (defaults to `$HOME/.wasmtime`), and executable is placed in `$WASMTIME_HOME/bin`.
38
39After running the install script above, follow the on-screen instructions.
40
41Windows or otherwise interested users can download installers and
42binaries directly from the [GitHub
43Releases](https://github.com/bytecodealliance/wasmtime/releases) page.
44
45For additional installation options, refer to the [online book CLI installation page](https://docs.wasmtime.dev/cli-install.html).
46
47Documentation on Wasmtime's currently supported versions can be found [in the
48online book
49documentation](https://docs.wasmtime.dev/stability-release.html#current-versions).
50
51## Example
52
53If you've got the [Rust compiler
54installed](https://www.rust-lang.org/tools/install) then you can take some Rust
55source code:
56
57```rust
58fn main() {
59    println!("Hello, world!");
60}
61```
62
63and compile it into a WebAssembly component with:
64
65```console
66rustup target add wasm32-wasip2
67rustc hello.rs --target wasm32-wasip2
68```
69
70Once compiled, you can run your component:
71
72```console
73wasmtime hello.wasm
74```
75
76You should see the following output:
77
78```text
79Hello, world!
80```
81
82(Note: make sure you installed Rust using the [`rustup`][rustup] method in the official
83instructions above, and do not have a copy of the Rust toolchain installed on
84your system in some other way as well (e.g. the system package manager). Otherwise, the `rustup target add...`
85command may not install the target for the correct copy of Rust.)
86
87[rustup]: https://rustup.rs
88
89## Features
90
91* **Fast**. Wasmtime is built on the optimizing [Cranelift] code generator to
92  quickly generate high-quality machine code either at runtime or
93  ahead-of-time. Wasmtime is optimized for efficient instantiation, low-overhead
94  calls between the embedder and wasm, and scalability of concurrent instances.
95
96* **[Secure]**. Wasmtime's development is strongly focused on correctness and
97  security. Building on top of Rust's runtime safety guarantees, each Wasmtime
98  feature goes through careful review and consideration via an [RFC
99  process]. Once features are designed and implemented, they undergo 24/7
100  fuzzing donated by [Google's OSS Fuzz]. As features stabilize they become part
101  of a [release][release policy], and when things go wrong we have a
102  well-defined [security policy] in place to quickly mitigate and patch any
103  issues. We follow best practices for defense-in-depth and integrate
104  protections and mitigations for issues like Spectre. Finally, we're working to
105  push the state-of-the-art by collaborating with academic researchers to
106  formally verify critical parts of Wasmtime and Cranelift.
107
108* **[Configurable]**. Wasmtime uses sensible defaults, but can also be
109  configured to provide more fine-grained control over things like CPU and
110  memory consumption. Whether you want to run Wasmtime in a tiny environment or
111  on massive servers with many concurrent instances, we've got you covered.
112
113* **[WASI]**. Wasmtime supports a rich set of APIs for interacting with the host
114  environment through the [WASI standard](https://wasi.dev).
115
116* **[Standards Compliant]**. Wasmtime passes the [official WebAssembly test
117  suite](https://github.com/WebAssembly/testsuite), implements the [official C
118  API of wasm](https://github.com/WebAssembly/wasm-c-api), and implements
119  [future proposals to WebAssembly](https://github.com/WebAssembly/proposals) as
120  well. Wasmtime developers are intimately engaged with the WebAssembly
121  standards process all along the way too.
122
123[Wasmtime]: https://github.com/bytecodealliance/wasmtime
124[Cranelift]: https://cranelift.dev/
125[Google's OSS Fuzz]: https://google.github.io/oss-fuzz/
126[security policy]: https://bytecodealliance.org/security
127[RFC process]: https://github.com/bytecodealliance/rfcs
128[release policy]: https://docs.wasmtime.dev/stability-release.html
129[Secure]: https://docs.wasmtime.dev/security.html
130[Configurable]: https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html
131[WASI]: https://docs.rs/wasmtime-wasi/latest/wasmtime_wasi/
132[Standards Compliant]: https://docs.wasmtime.dev/stability-tiers.html
133
134## Language Support
135
136You can use Wasmtime from a variety of different languages through embeddings of
137the implementation.
138
139Languages supported by the Bytecode Alliance:
140
141* **[Rust]** - the [`wasmtime` crate]
142* **[C]** - the [`wasm.h`, `wasi.h`, and `wasmtime.h` headers][c-headers], [CMake](crates/c-api/CMakeLists.txt)
143* **C++** - the [`wasmtime.hh` header][c-headers]
144* **[Python]** - the [`wasmtime` PyPI package]
145* **[.NET]** - the [`Wasmtime` NuGet package]
146* **[Go]** - the [`wasmtime-go` repository]
147* **[Ruby]** - the [`wasmtime` gem]
148
149Languages supported by the community:
150
151* **[Elixir]** - the [`wasmex` hex package]
152* **Perl** - the [`Wasm` Perl package's `Wasm::Wasmtime`]
153
154[Rust]: https://bytecodealliance.github.io/wasmtime/lang-rust.html
155[C]: https://bytecodealliance.github.io/wasmtime/lang-c.html
156[`wasmtime` crate]: https://crates.io/crates/wasmtime
157[c-headers]: https://bytecodealliance.github.io/wasmtime/c-api/
158[Python]: https://bytecodealliance.github.io/wasmtime/lang-python.html
159[`wasmtime` PyPI package]: https://pypi.org/project/wasmtime/
160[.NET]: https://bytecodealliance.github.io/wasmtime/lang-dotnet.html
161[`Wasmtime` NuGet package]: https://www.nuget.org/packages/Wasmtime
162[Go]: https://bytecodealliance.github.io/wasmtime/lang-go.html
163[`wasmtime-go` repository]: https://pkg.go.dev/github.com/bytecodealliance/wasmtime-go
164[Ruby]: https://bytecodealliance.github.io/wasmtime/lang-ruby.html
165[`wasmtime` gem]: https://rubygems.org/gems/wasmtime
166[Elixir]: https://docs.wasmtime.dev/lang-elixir.html
167[`wasmex` hex package]: https://hex.pm/packages/wasmex
168[`Wasm` Perl package's `Wasm::Wasmtime`]: https://metacpan.org/pod/Wasm::Wasmtime
169
170## Documentation
171
172[�� Read the Wasmtime guide here! ��][guide]
173
174The [wasmtime guide][guide] is the best starting point to learn about what
175Wasmtime can do for you or help answer your questions about Wasmtime. If you're
176curious in contributing to Wasmtime, [it can also help you do
177that][contributing]!
178
179[contributing]: https://bytecodealliance.github.io/wasmtime/contributing.html
180[guide]: https://bytecodealliance.github.io/wasmtime
181
182---
183
184It's Wasmtime.
185