Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Languages

Repo of the day: rust-anything, move your app to Rust without changing behaviour

A CLI that records how your TS, Python, Go or Java app behaves and won't accept the Rust port until it matches case by case.

rust-anything appeared on GitHub on 16 November 2026 and two days later had passed 1,300 stars. Its pitch usually ends badly: rewrite an entire application in Rust. The difference is that it translates nothing; it records what your current program does and won't let the rewrite move on until the Rust version answers the same way on every recorded case.

What it is

An MIT-licensed Rust CLI that drives a piece-by-piece migration to Rust of a project written in Node.js/TypeScript, Python, C, Go, Ruby or Java (PHP and C# in preview). You or your coding agent write the Rust; the tool supplies everything else:

  • Where the time goes (profile): runs a real workload under each language's profiler and points at the loop worth moving.
  • What to port first (analyze): units, order, risks with file:line, and which crate replaces each dependency.
  • The bridge (bridge): generates a crate with bindings (napi-rs or wasm-bindgen, PyO3, cgo, JNI, magnus…) so the rest of the code keeps calling the same API.
  • The spec (record): runs the original on generated edge cases (non-ASCII, emoji, -0, NaN, overflows, map ordering…) and saves what it returns or throws.
  • The proof (diff, bench, shadow, gate): replays every case against Rust, measures whether it really is faster, lets you run both in production while returning the original's result, and only calls a port done when it passes clippy -D warnings, an unsafe audit and the behaviour check.

For a whole app, CLI or HTTP server, it works as a black box: app record captures the app from the outside, app front-door creates a Rust binary (or axum server) that initially forwards everything to the original, each ported unit gets wired in, and app lift finally removes the original and leaves a pure Rust project validated by cargo test.

How to use it

Install it from crates.io or npm, and setup registers it as an MCP server and skill in Claude Code, Codex, Cursor and Gemini CLI:

bash
cargo install rust-anything
rust-anything setup          # --remove undoes it

The loop for porting a hot path in a TypeScript project, per the README:

bash
rust-anything profile . -- node bench.mjs
rust-anything bridge . src/fuzzy.ts --batch fuzzyScore:text
# write src/port.rs (you or your agent), then:
rust-anything record rust/fuzzy-rs && rust-anything build rust/fuzzy-rs
rust-anything diff rust/fuzzy-rs
rust-anything gate rust/fuzzy-rs

A word on setup: it edits your agents' global config (~/.claude.json, ~/.codex/config.toml, ~/.cursor/mcp.json, ~/.gemini/settings.json). It saves a .rust-anything.bak copy of each file first, but if you'd rather keep it to one project, the README shows how to add the MCP server to that project's .mcp.json only. The README also suggests asking your agent to install it; better to run those two commands yourself and know what changes.

What I like and what I don't

I like that the README is upfront about its limits, with a whole section on them. Passing diff only proves the Rust matches the recorded cases. Regexes are the clearest example: the regex crate has no lookaround or backreferences, and \w or \b behave differently on non-ASCII text. Nor does it compare timing, memory, concurrency under load, or side effects beyond stdout, stderr, files and HTTP responses (network calls, databases, signals). For an SRE, that is exactly where rewrites tend to break.

I also like that it doesn't promise free speed. The README admits that calling Rust once per small function is often slower than a JIT, because every call crosses the bridge; that's why profile looks for the whole loop and --batch moves it in one go. Its published numbers (20x faster on x18n's search in Node, 17x in Python, 4x in Go, 3x in Java) come from its own benchmarks, which first check the results are identical, measured on 4 cores.

What I don't: the project is two days old. PHP and C# are in preview with no bridge yet, and the whole-app and lift flows are the most ambitious and least battle-tested part. For hardware-facing C, analyze itself recommends not porting it.

rust-anything vs porting by hand with PyO3 or napi-rs

Until now, moving a hot path to Rust meant writing the bindings yourself with PyO3 or napi-rs and trusting whatever tests you already had.

rust-anythingBy hand with PyO3 / napi-rs
ApproachRecords the original, demands case-by-case parityHand-written bindings, existing tests
Languages6 (plus 2 in preview)One per bindings crate
Rolloutshadow runs both, returns the originalWhatever you build
LicenceMITPyO3 and napi-rs, open source
MaturityTwo days on GitHubYears in production

When to use which. If you're porting one function that already has solid test coverage, PyO3 or napi-rs by hand is simpler and adds no extra tool. rust-anything earns its place when you don't trust your tests, when an agent writes the port and you need an objective gate that says "done", or when the migration spans several units and you want ordering, bridging and production comparison from day one.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗