{"id":51192347,"url":"https://github.com/tiny-systems/wasm-module","last_synced_at":"2026-06-27T16:30:51.230Z","repository":{"id":358415821,"uuid":"1241298399","full_name":"tiny-systems/wasm-module","owner":"tiny-systems","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-03T20:10:02.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T22:06:55.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiny-systems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-17T07:48:36.000Z","updated_at":"2026-06-03T20:10:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tiny-systems/wasm-module","commit_stats":null,"previous_names":["tiny-systems/wasm-module-v0","tiny-systems/wasm-module"],"tags_count":4,"template":false,"template_full_name":"tiny-systems/example-module","purl":"pkg:github/tiny-systems/wasm-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-systems%2Fwasm-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-systems%2Fwasm-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-systems%2Fwasm-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-systems%2Fwasm-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiny-systems","download_url":"https://codeload.github.com/tiny-systems/wasm-module/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiny-systems%2Fwasm-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34860892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"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":"2026-06-27T16:30:48.025Z","updated_at":"2026-06-27T16:30:51.111Z","avatar_url":"https://github.com/tiny-systems.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny Systems WASM Module\n\nRun user-supplied source code as WebAssembly per request. Author writes\nprogram source in node settings, the controller pod compiles it via the\nbundled TinyGo toolchain on `OnSettings`, and [wazero](https://wazero.io)\nexecutes the resulting wasm with WASI stdin/stdout JSON as the IO boundary.\n\nCompile errors surface as `TinyNode.Status.Error` exactly like js_eval's\nparse errors do — the platform UI renders them red and the MCP\n`read_project` exposes them so an agent can self-correct.\n\n## Components\n\n### `wasm_eval`\n\nAuthor writes a complete program; the component compiles + runs it.\n\n**Settings**\n\n| Field | Type | Required | Notes |\n|---|---|---|---|\n| `source.language` | enum (`tinygo`) | yes | Compiler to use. TinyGo is bundled. |\n| `source.content` | string (code) | yes | Complete program. Reads JSON from stdin, writes JSON to stdout. |\n| `inputData` | `configurable: any` | yes | Schema + example of what your program reads from stdin |\n| `outputData` | `configurable: any` | yes | Schema + example of what your program writes to stdout |\n| `enableErrorPort` | bool | yes | Route runtime failures to the Error port instead of failing |\n\n**Ports**\n\n- `request` — receives `{context, inputData}`. Edge config maps upstream data into `inputData`.\n- `response` — emits `{context, outputData}`. Context passes through unchanged; the wasm module does not see it.\n- `error` — visible when `enableErrorPort=true`. Emits `{context, error}` for wasm runtime failures.\n\n**Example source (TinyGo)**\n\n```go\npackage main\n\nimport (\n    \"encoding/json\"\n    \"os\"\n)\n\ntype In struct {\n    Name string `json:\"name\"`\n}\n\ntype Out struct {\n    Greeting string `json:\"greeting\"`\n}\n\nfunc main() {\n    var in In\n    _ = json.NewDecoder(os.Stdin).Decode(\u0026in)\n    _ = json.NewEncoder(os.Stdout).Encode(Out{\n        Greeting: \"Hello, \" + in.Name,\n    })\n}\n```\n\nDrop that into `Settings.Source.Content`, set `Settings.Source.Language = \"tinygo\"`,\ndeclare `inputData` as `{name: string}` and `outputData` as `{greeting: string}`,\nand the platform handles the rest.\n\n## How the compile loop works\n\n1. `build_flow` (or `edit_flow.configure_node`) writes settings to the TinyNode.\n2. The controller delivers `_settings` to the component instance.\n3. `OnSettings` writes source to a temp file, runs `tinygo build -target=wasi -no-debug`,\n   reads the output bytes, and asks wazero to compile the module.\n4. On any failure (compile error, wazero compile error), the SDK records\n   `TinyNode.Status.Error`. The UI shows it red; `read_project` returns it.\n5. On success, the compiled module is held; each request instantiates it\n   fresh and feeds it stdin / collects stdout.\n\n## Why WASM\n\n`js_eval` is great for quick JS transforms. `wasm_eval` covers cases\nwhere you want:\n\n- A typed language with a real type system at compile time\n- Native-speed code\n- Sandboxed execution by default — the wasm module sees only stdin,\n  stdout, stderr, no filesystem, no network, no host\n- Compact deterministic artifacts that can be versioned alongside flows\n\n## Bundled toolchain\n\nThe operator image is based on `tinygo/tinygo:0.39.0`, so the\ncontroller pod has TinyGo + LLVM-wasi in PATH. The image is ~1.5GB —\nlarger than a typical operator (distroless ≈ 20MB) — but that's the\ncost of inline compilation. Future versions may add Rust or\nAssemblyScript targets behind the same Source.Language enum.\n\n## Run locally\n\n```shell\ngo run cmd/main.go run \\\n  --name=tinysystems/wasm-module-v0 \\\n  --namespace=tinysystems-tinysystems \\\n  --version=0.2.0\n```\n\nYou'll need TinyGo on your local PATH for compilation to work\noutside the container:\n\n```shell\nbrew install tinygo\n```\n\n## Deploy\n\n```shell\nhelm install wasm-module tinysystems/tinysystems-operator \\\n  --set controllerManager.manager.image.repository=registry.example.com/wasm-module-v0\n```\n\n## Resources\n\n- [Tiny Systems Module SDK](https://github.com/tiny-systems/module)\n- [wazero](https://wazero.io) — pure-Go WASM runtime\n- [TinyGo](https://tinygo.org) — Go for small places, including wasm32-wasi\n- [Tiny Systems Platform](https://tinysystems.io)\n\n## License\n\nMIT-licensed. Depends on the [Tiny Systems Module SDK](https://github.com/tiny-systems/module) (BSL 1.1).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiny-systems%2Fwasm-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiny-systems%2Fwasm-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiny-systems%2Fwasm-module/lists"}