Effortless WASM deployment anywhere
built on libp2p and WASI
Fungi is a modular project for distributed computing. It combines WASI (wasmtime) and libp2p. With Fungi, you can seamlessly run WASI applications on both local and remote devices. It allows you to securely connect to remote devices and perform tasks safely.
Fungi is still in an experimental stage and welcomes contributions of any kind.
Fungi consists of two components:
- fungi: A WASI runtime for both local and remote devices.
- fungi-daemon: A libp2p service and a remote access service.
By default, all functionalities are bundled into a single binary -- fungi
cargo build --release
# Output binary file: target/release/fungi
- Run fungi:
$ fungi
(output:)
Initializing Fungi...
Generating key pair...
Key pair generated Secp256k1:PublicKey { ... }
Key pair saved at $HOME/.fungi/.keys/keypair
Fungi initialized at $HOME/.fungi
Starting Fungi...
#
- Add some WASM applications to this node.
By default, the fungi WASI runtime will only search for and run WASM applications in the $HOME/.fungi/root/bin
directory.
(Optional) You can quickly obtain a WASM application by building the Hello World example provided in this project:
rustup target add wasm32-wasi
cargo build -p hello-fungi --release --target=wasm32-wasi
# Output .wasm file: target/wasm32-wasi/release/hello-fungi.wasm
Copy the WASM application to the directory:
cp target/wasm32-wasi/release/hello-fungi.wasm $HOME/.fungi/root/bin/
- Return to the fungi cli, and run wasm:
...
Starting Fungi...
# hello-fungi.wasm
Hello, Fungi!
Fungi enable mDNS by default, which will discover and register LAN device address automatically. You can connect to a LAN node using only the Peer ID
.
- On Device A within the same LAN, run the fungi daemon with a UNSAFE debug flag to allow all inbound peers. For demonstration only.
fungi daemon --debug-allow-all-peers true
# Copy the `Peer ID` from the output
- On Device B within the same LAN, run the fungi daemon:
fungi daemon
- On Device B, open another shell and connect to Device A:
fungi -p ${PEER_ID_FROM_DEVICE_A}
Platform | Status |
---|---|
macOS | ✅ |
Windows | ✅ |
Linux | ✅ |
Android | ✅ |
iOS | 💤 |
Web | 💤 |
*only support 64-bit, see: Cranelift supports
TODO
Apache License 2.0 - see the LICENSE file for details.