{"id":15668654,"url":"https://github.com/bytecodealliance/sample-wasi-http-rust","last_synced_at":"2025-03-26T18:32:26.981Z","repository":{"id":257495264,"uuid":"852904832","full_name":"bytecodealliance/sample-wasi-http-rust","owner":"bytecodealliance","description":"An example `wasi:http` server component written in Rust","archived":false,"fork":false,"pushed_at":"2025-03-17T10:29:28.000Z","size":201,"stargazers_count":10,"open_issues_count":7,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T11:12:33.284Z","etag":null,"topics":["components","demo","example","rust","template","wasi","wasm"],"latest_commit_sha":null,"homepage":"","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/bytecodealliance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-05T16:20:56.000Z","updated_at":"2025-03-13T18:55:14.000Z","dependencies_parsed_at":"2024-09-17T03:47:16.483Z","dependency_job_id":"a9a2371b-a10f-4ff3-a3d7-4a7bf1e30338","html_url":"https://github.com/bytecodealliance/sample-wasi-http-rust","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":0.4,"last_synced_commit":"40d1d97d8f03d1fa794535306a009bc8681de520"},"previous_names":["yoshuawuyts/rust-wasi-hello","yoshuawuyts/wasi-rust-sample","yoshuawuyts/sample-wasi-http-rust","bytecodealliance/sample-wasi-http-rust"],"tags_count":3,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fsample-wasi-http-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fsample-wasi-http-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fsample-wasi-http-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fsample-wasi-http-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytecodealliance","download_url":"https://codeload.github.com/bytecodealliance/sample-wasi-http-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245713106,"owners_count":20660344,"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":["components","demo","example","rust","template","wasi","wasm"],"created_at":"2024-10-03T14:13:05.548Z","updated_at":"2025-03-26T18:32:26.974Z","avatar_url":"https://github.com/bytecodealliance.png","language":"Rust","readme":"# Sample: `wasi:http` in Rust\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/yoshuawuyts/rust-wasi-hello)\n\nAn example project showing how to build a spec-compliant\n[`wasi:http/proxy`][wasi-http] server for WASI 0.2 written in Rust. This sample\nincludes several [routes](#routes) that showcase different behavior. This sample\ncan be run by any spec-compliant `wasi:http/proxy` server.\n\nEach release of this sample is packaged up as a [Wasm OCI image][wasm-oci-image]\nand published to the [GitHub Packages Registry][gh-pkg]. See the [\"Deploying\npublished artifacts\"][using-arifacts] section for more on how to fetch and run\nthe published artifacts.\n\n## Routes\n\nThe following HTTP routes are available from the component:\n\n```text\n/               # Hello world\n/wait           # Sleep for one second\n/echo           # Echo the HTTP body\n/echo-headers   # Echo the HTTP headers\n/echo-trailers  # Echo the HTTP trailers\n```\n\n## Installation\n\nThe easiest way to try this project is by opening it in a GitHub Codespace. This\nwill create a VS Code instance with all dependencies installed. If instead you\nwould prefer to run this locally, you can run the following commands:\n\n```bash\n$ curl https://wasmtime.dev/install.sh -sSf | bash # install wasm runtime\n$ cargo install cargo-component                    # install build tooling\n$ cargo install wkg                                # install wasm OCI tooling\n```\n\n## Local Development\n\nThe HTTP server uses the `wasi:http/proxy` world. You can run it locally in a\n`wasmtime` instance by using the following [cargo-component] command:\n\n```rust\n$ cargo component serve\n```\n### Note on Debugging\nThere are launch and task configuration files if you want to use VSCode for debugging in an IDE; however, if you prefer using GDB or LLDB directly the configuration files should be enough to get you up and running. Note that the [GDB configuration requires an absolute path](https://github.com/bytecodealliance/sample-wasi-http-rust/blob/fe47fc9f6c87d09575f6683a26f9a67e3e71aa26/.vscode/launch.json#L28), so that configuration in VSCode you will need to modify for your computer.\n\n## Deploying published artifacts\n\nThis project automatically published compiled Wasm Components as OCI to GitHub\nArtifacts. You can pull the artifact with any OCI-compliant tooling and run it\nin any Wasm runtime that supports the `wasi:http/proxy` world. To fetch the\nlatest published version from GitHub releases using [wkg][wkg] and run it in a\nlocal [`wasmtime` instance][wasmtime] you can run the following commands:\n\n```bash\n$ wkg oci pull ghcr.io/bytecodealliance/sample-wasi-http-rust/sample-wasi-http-rust:latest\n$ wasmtime serve sample-wasi-http-rust.wasm\n```\n\nFor production workloads however, you may want to use other runtimes or\nintegrations which provide their own OCI integrations. Deployment will vary\ndepending on you providers, though at their core they will tend to be variations\non the pull + serve pattern we've shown here.\n\n## See Also\n\n**Hosts**\n- [sample-wasi-http-aks-wasmcloud](https://github.com/yoshuawuyts/sample-wasi-http-aks-wasmcloud) - A `wasi:http` example host environment running on AKS using the WasmCloud runtime\n\n## License\n\nApache-2.0 with LLVM Exception\n\n[cargo-component]: https://github.com/bytecodealliance/cargo-component\n[wasm-oci-image]: https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/\n[gh-pkg]: https://github.com/bytecodealliance/sample-wasi-http-rust/pkgs/container/sample-wasi-http-rust%2Fsample-wasi-http-rust\n[using-arifacts]: #working-with-deployment-artifacts\n[wasi-http]: https://github.com/WebAssembly/wasi-http\n[wkg]: https://github.com/bytecodealliance/wasm-pkg-tools/tree/main/crates/wkg\n[wasmtime]: https://wasmtime.dev\n","funding_links":[],"categories":["Components"],"sub_categories":["Applications"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fsample-wasi-http-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytecodealliance%2Fsample-wasi-http-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fsample-wasi-http-rust/lists"}