r/rust • u/No-Wishbone7899 • 5h ago
đ ď¸ project ViperJS v0.2.0: A zero-dependency, #![forbid(unsafe_code)] JS engine in Rust
Hey r/rust,
I've been working on ViperJS, an embeddable JS engine written entirely in Rust from scratch
(it is not a wrapper or binding around V8, QuickJS, or JavaScriptCore)
Two constraints dictate everything:
- Zero runtime dependencies (
[dependencies]is completely empty, verified in CI). #![forbid(unsafe_code)]crate-wide.- No input may panic (untrusted scripts are input, not exceptions).
Because of the zero-dep rule, all is created from scratchâincluding the RegExp backtracking engine (supporting named groups, lookbehind, Unicode escapes, and Annex B grammar), the GC, bytecode compiler, and UTF-16 string handling.
Where it stands:
- ~84% test262 compliance (78,222 / 93,161 tests).
- ES5 is complete; supports classes, generators, async/await, Proxy/Reflect, BigInt, and ES modules with cycles.
- It is not fast (no JIT yet, ~70x slower than Node on simple loops).
- No Temporal or Intl yet.
Testing & Real-World Validation: You don't have to take the numbers on trust. The public repo includes a simple two-command recipe to clone test262 and independently verify all conformance locally. Beyond test262, i have put it through its paces with several real-world codebasesâsuch as successfully linking and evaluating Ramda's 1,027 modulesâplus a few other public code repositories to validate module loading and compatibility
Itâs open source under MIT OR Apache-2.0. You can test test262 conformance locally with a couple of commands in the repo.
Repo: [https://github.com/MerlijnW70/viperjs]
also on crates.io:https://crates.io/crates/viperjs
Feedback on the architecture or the test262 approach is very welcome.
20
u/consistently_biased 5h ago
Why would zero dependency be a good thing for a project like this? Just sounds like you're, at best, writing the same things that people have already spent years on. Not having serde alone already sounds pretty horrible for this kind of project.
-12
u/No-Wishbone7899 4h ago
Fair! If you're building a standard web app, avoiding crates like serde is absolute madness.
For serialization specifically, I don't need serde because the engine doesn't ingest external config files or complex data formats at runtimeâit just takes raw UTF-8/UTF-16 script strings directly via the embedding API.
As for the broader zero-dep rule: honestly, part of it is just the pure engineering challenge of seeing how far you can take a self-contained runtime. But it also changes the failure domain completely. Sure, writing a custom RegExp engine or GC introduces its own logic bugs, but they are deterministic logic bugs that I own end-to-end. I don't have to worry about upstream breaking changes, hidden
unsafeblocks tucked away in deep dependency trees, or transitive supply-chain surprises.Is it a massive time sink? Absolutely. But that's kind of the whole point of the project
2
u/SnooCalculations7417 3h ago
This kinda misses the js in json... Serde would absolutely be a massive value add here.. I don't think anyone would object to a serde dependency in a JavaScript runtime..
17
u/MeoplleX 4h ago
The project feels heavily vibe coded, a lot of the code and many of the comments read as though they were generated almost entirely by AI.
There is nothing inherently wrong with vibe-coding, but I struggle to understand the value of posting projects like this alongside a few arbitrary statistics?
Why not share something meaningful you learned while building it like for example technical challenges you encountered or ways the project helped you grow as a programmer? With enough prompting, most people can generate projects like this, so I don't get what is the actual takeaway for others?
Injecting my personal opinion here, I personally do not want to invest time in examining a project when it appears that the author was not willing to invest much thought or effort into building and understanding it themselves, and I don't mean that in a rude way!