{"id":16841834,"url":"https://github.com/svozza/node-rust-wasm-lambda","last_synced_at":"2025-08-18T01:32:17.713Z","repository":{"id":241554005,"uuid":"807020487","full_name":"svozza/node-rust-wasm-lambda","owner":"svozza","description":"A sample project for compiling a Rust module to WASM and using JCO to import it in Node.js AWS Lambda function","archived":false,"fork":false,"pushed_at":"2024-05-30T17:38:22.000Z","size":25218,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T05:28:41.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svozza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-05-28T10:36:01.000Z","updated_at":"2024-05-30T17:38:25.000Z","dependencies_parsed_at":"2024-05-29T02:20:49.676Z","dependency_job_id":"3d0d2cc4-3472-4b54-a512-16e2064756f6","html_url":"https://github.com/svozza/node-rust-wasm-lambda","commit_stats":null,"previous_names":["svozza/node-rust-wasm-lambda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/svozza/node-rust-wasm-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svozza%2Fnode-rust-wasm-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svozza%2Fnode-rust-wasm-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svozza%2Fnode-rust-wasm-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svozza%2Fnode-rust-wasm-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svozza","download_url":"https://codeload.github.com/svozza/node-rust-wasm-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svozza%2Fnode-rust-wasm-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270932564,"owners_count":24670240,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-13T12:43:09.768Z","updated_at":"2025-08-18T01:32:17.483Z","avatar_url":"https://github.com/svozza.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js and WASM Lambda\n\n## Introduction\n\nThis is a sample project for compiling a Rust module to WASM and using JCO to import it in a Node.js \nAWS Lambda function.\n\n## Prerequisites\n\nYou must have the following tooling installed\n\n- [Rust](https://www.rust-lang.org/tools/install)\n- [Node.js](https://nodejs.org/en/download/package-manager/current)\n- [cargo-component](https://github.com/bytecodealliance/cargo-component)\n\n## Setup\n\nNote: This is based on the JCO launch announcement [blog post](https://bytecodealliance.org/articles/jco-1.0) but \nthe steps appear to be outdated so what follows is the changes required to make it work as of 2024-05-25.\n\nThe project was created by running the following `cargo-component` command:\n\n```shell\ncargo component new \u003cproject-name\u003e --lib\n```\nThis creates a component in `src/lib.rs` that has a simple Hello World function. This function was changed to one \nthat will turn a string into upper case:\n\n```rust\nimpl Guest for Component {\n    fn shout(input: String) -\u003e String {\n        let mut s = input.to_uppercase();\n        s.push_str(\"!\");\n        s.into()\n    }\n}\n```\n\nThe `wit/world.wit` file which uses the [IDL(https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md)] \nthat underpins the WebAssembly component model was also changed:\n\n```\npackage component:\u003cproject-name\u003e;\n\nworld example {\n    export shout: func(input: string) -\u003e string;\n}\n```\n\n## Instructions:\n1. Run `npm i` to install the `@bytecodealliance/jco`  and`@bytecodealliance/preview2-shim` dependencies \naqqqlocally.\n2. Run `npm run build` to compile the Rust module, invoke JCO and then build a zip file of the code\nin a folder called `dist`.\n3. Create a blank Node.js AWS lambda function.\n4. Upload the zip to the lambda function.\n5. Execute the lambda function with the default test event, which should produce the following output:\n\n```\n\"VALUE1!\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvozza%2Fnode-rust-wasm-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvozza%2Fnode-rust-wasm-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvozza%2Fnode-rust-wasm-lambda/lists"}