Skip to content
/ fungi Public

Effortless WASM deployment anywhere, built on libp2p and WASI.

License

Notifications You must be signed in to change notification settings

enbop/fungi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

72600e2 Β· Jan 3, 2025

History

69 Commits
Sep 21, 2024
Aug 25, 2024
Dec 2, 2024
Dec 2, 2024
Jan 3, 2025
Dec 2, 2024
Oct 13, 2024
Jan 3, 2025
Jan 3, 2025
Sep 7, 2024
Aug 25, 2024
Aug 25, 2024
Dec 2, 2024
Dec 2, 2024
Aug 13, 2024
Sep 7, 2024

Repository files navigation


Fungi logo

Fungi

Effortless WASM deployment anywhere

built on libp2p and WASI


What is Fungi?

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.

Quickstart

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

Download fungi from Github releases:

Github releases

Build fungi from source:

cargo build --release

# Output binary file: target/release/fungi

Run with Local Node

  1. 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...
 # 
  1. 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/
  1. Return to the fungi cli, and run wasm:
...
Starting Fungi...
# hello-fungi.wasm
Hello, Fungi!

Run with Remote Node

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.

  1. 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
  1. On Device B within the same LAN, run the fungi daemon:
fungi daemon
  1. On Device B, open another shell and connect to Device A:
fungi -p ${PEER_ID_FROM_DEVICE_A}

Platform Support

Platform Status
macOS βœ…
Windows βœ…
Linux βœ…
Android βœ…
iOS πŸ’€
Web πŸ’€

*only support 64-bit, see: Cranelift supports

Roadmap

TODO

License

Apache License 2.0 - see the LICENSE file for details.