Repository navigation
feat(infra): add Rust (workers-rs) Cloudflare Worker example - #38
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Cloudflare Worker written in Rust with workers-rs, deployed by the existing Alchemy stack. Alchemy does not compile Rust, so a
Command.Buildrunsworker-buildfirst and abundle: falseWorker uploads its output.The crate is a Cargo workspace member, so host
cargo check/test --workspacecovers it. It setsrust-version = "1.88"because workers-rs 0.8 pulls inwasm-streams0.6.Reference docs for the team: darkmatter/skills#20 (Alchemy skill,
examples.md).Evidence
Live on Cloudflare (Alchemy 2.0.0-beta.81, throwaway stages, destroyed after):
RustWorkerBuild created, thenRustWorker created;GET /returned the greeting,GET /artifactslisted an object uploaded to the R2 bucket.RustWorkerBuild noop,RustWorker noop.updated, Workerupdated, response showed the new text.Cargo.tomledit:RustWorkerBuild updated,RustWorker updated — Uploading worker (196.57 KB).alchemy dev: Worker served onlocalhost:1337and reloaded after a manualworker-build --release.Checks in the Nix devshell, all exit 0:
bun run check,bun run test,bun run lint,bun run fmt:check,cargo check --workspace,cargo test --workspace,cargo fmt --all -- --check,nix flake check.Merge Danger
Door: two-way
Revert removes the crate, the stack entry, and the devshell packages.
Blast Radius: deploys
Every
alchemy deploy/alchemy devofpackages/infranow creates this Worker and needsworker-build, the wasm32 std, andlldwhenever the build runs. The Nix devshell provides them; a non-Nix machine does not. GitHub CI is unaffected: it runs no Alchemy and only builds the crate for the host on stable Rust.