opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

Record what your app does, then port it to Rust piece by piece
GitHub RepoViews4

Project Description

View on GitHub

How Do You Prove a Rust Rewrite Actually Works? Record It First

You've got a working app in Node, Python, or Go, and you've decided to rewrite it in Rust. The performance argument is compelling. The problem is that nobody wants to be the person who ships a rewrite that quietly changes behavior in a dozen places nobody tested. rust-anything takes a different angle on this: record what your original app does, port it piece by piece, and check every piece against the recording before moving on.

What It Does

rust-anything is a tool built around a four-step workflow. record runs your original app against generated edge cases, semantic traps, and your own inputs, saving what each call returns or throws. bridge then generates the Rust crate and a wrapper so callers keep the original API while you (or your coding agent) write the actual Rust. diff replays every recorded case against the new Rust code, and nothing ships until they all match and gate passes. Finally, app lift turns the result into a pure Rust app once replay passes with no fallback and every unit passes gate.

The project supports Node.js (TypeScript and JavaScript), Python, C, Go, Ruby, and Java as source languages, and it's aimed at whole apps—CLIs, HTTP servers, and libraries. It's distributed both as a crate and an npm package, and it's MIT licensed. The README also points to a real-world example: Prettier, ported to Rust, described as 19x faster with 17,224 recorded runs and 0 mismatches.

Why It's Cool

It treats behavior as the spec, not documentation. Most rewrites fail because the old code's real behavior lives in edge cases nobody wrote down. By recording actual outputs and thrown exceptions from generated edge cases and semantic traps, rust-anything turns "it should work the same" into something you can mechanically verify.

The incremental approach is the point. You don't have to bet the whole app on one giant rewrite. Each piece gets ported, replayed, and gated before the next one moves. That's a much saner way to migrate than a big-bang switchover, and it means you can stop at any point and still have something that works.

The wrapper keeps callers unchanged. Generating a wrapper around the Rust crate so the original API stays intact is a small detail that matters a lot—it means you can swap implementations underneath without rewriting every call site at once.

The original is never touched. During porting, the recording and replay happen alongside your existing app rather than replacing it, so there's no window where you've broken the thing you're trying to preserve.

The Prettier example is a useful sanity check. A 19x speedup claim is only credible if the behavior claim holds too, and the "17,224 recorded runs, 0 mismatches" framing is exactly the kind of evidence you'd want before trusting a port.

How to Try It

The README lists the package on both crates.io and npm, so installation depends on which ecosystem you're working in. The project's quick start section covers setup in more detail.

  1. Head to the repository: github.com/erkamyaman/rust-anything
  2. Follow the quick start section to install the tool and record your first set of cases.
  3. Run record against your original app to capture behavior from generated edge cases and your own inputs.
  4. Use bridge to generate the Rust crate and wrapper.
  5. Write the Rust implementation (or hand it to your agent).
  6. Run diff to replay the recorded cases and gate to check the result.
  7. When everything passes with no fallback, app lift promotes it to pure Rust.

The docs folder goes deeper on the real-world ports, how it works under the hood, porting whole apps, and a FAQ—all linked from the README if you want to read before you commit.

Final Thoughts

rust-anything is aimed at a specific person: someone with a working app in a supported language who wants Rust's performance but can't afford silent behavior changes. The record-replay-gate loop is the right shape for that problem, and the incremental design means you're never more than one bad port away from a working system. It's not a magic converter—you still write the Rust—but it gives you the verification harness that makes the rewrite tractable. If you've been putting off a Rust migration because you couldn't prove it was safe, this is worth a look.


Follow @githubprojects for more developer tools and open source projects.

Back to Projects
Project ID: rust-anythingLast updated: November 19, 2026 at 07:12 PM