I'm Syrus, from Wasmer. We built Edge.js in a few weeks after different trials trying to bring Node.js to the Edge. We used AI and Codex heavily for this project, as otherwise the timeline would have spanned to a year plus to develop.
The summary of this announcement is that Edge.js:
* Runs using WebAssembly when in `--safe` mode
* It's fully compatible with Node.js (passing all their spec tests for non-VM modules)
* It has a pluggable JS engine architecture: can work with V8, Javascript, SpiderMonkey, QuickJS, Hermes, etc.
Super happy to answer any questions you may have!
Onavo 45 seconds ago [-]
What's the Next.js compatibility like?
jonny_eh 1 hours ago [-]
> * Runs using WebAssembly when in `--safe` mode
Why is safe mode opt-in?
larsnystrom 2 hours ago [-]
Maybe I’m just dense, but it says the fs module is fully supported, so what happens when I try to read a file from disk if the app is fully sandboxed?
syrusakbary 2 hours ago [-]
Only the current working directory will be exposed/mounted to the runtime (we do this to facilitate the DX when running local files without requiring the user to add extra flags).
As a fun exercise, you can try reading process.cwd() from edge in --safe mode and without it.
pscanf 27 minutes ago [-]
Very cool project!
Question regarding the pluggable js engine: I have an electron app where I'm currently using QuickJS to run LLM-generated code. Would edge.js be able (theoretically) to use electron's v8 to get a "sanboxed within electron" execution environment?
cyanydeez 13 minutes ago [-]
naively, based on their install.sh script, you'd pick the correct edge.js executable and shell out to that. I'm sure there's some more integral means, but if you wanted a quick test, that should be easily setup.
MillionOClock 28 minutes ago [-]
Very interesting! On what platforms can this run? If it can run on iOS, how would you handle attempts to access to the file system or networking, is this already wired in somehow? If not is it easy to add custom handlers to handle these actions?
willquack 1 hours ago [-]
Awesome project!
Dumb question: could you run this in frontend js using the browser's js engine and wasm environment similar to WebContainers? Maybe `fs` is just in-memory, and some things like forking are disabled. It'd be cool to have "nodejs" in the web!
Ah and kudos to Syrus and his team for this release. Edge.js's architecture seems to have many similarities with BrowserPod. I see it as proof that we are both going in the right direction!
syrusakbary 56 minutes ago [-]
It’s not a dumb question at all.
And yes, it will allow running Node.js apps fully on the browser, in a way that’s more compatible than any other alternative!
Stay tuned!
apignotti 37 minutes ago [-]
Do you have any specific test case that you would consider "very challenging" on the compatibility side? I'd be curious to check if BrowserPod can support that already.
moralestapia 42 minutes ago [-]
>in a way that’s more compatible than any other alternative
I can see where that's going.
Awesome. I want to msg. you on LinkedIn but can't.
alex_reg 2 hours ago [-]
It's a bit confusing.
Roughly:
* a refactor of Node.js, but using a standardized API for JS engine interop
* Integration with the Wasmer CLI so it will run JS with v8 but, everything else in Webassembly
Interesting idea.
Could be a much lighter weight way to sandbox JS...
syrusakbary 1 hours ago [-]
We are so deep into the weeds that sometimes is hard for us to realize that maybe we are not explaining in the best terms.
What was the most confusing thing in the blogpost? I'd like to polish a bit more to make it clearer! Thanks a lot!
giankam 19 minutes ago [-]
Hi Syrusakbary, I have to admit I still do not fully understand what this is.
First, I could not find usage examples on the edgejs.org page and the docs link points to the node docs, why?
If I head to github, there are some usage examples, but they confuse me more.
The first example: $ edge server.js
led me to think that this is a node replacement that runs in a webassembly sandbox, so completely isolated. But why the need of --safe then? What's the difference between using it and not using it?
But the next examples creates more confusion to me: $ edge node myfile.js
$ edge npm install
$ edge pnpm run dev
What is this doing? I thought that edge was a node replacement, interpreting and running javascript files, but it's now running executables (node, npm)... what is that? What happens when I run npm install... where does it install files? What's the difference between running edge node myfile.js and edge myfile.js?
Hope this helps.
benatkin 36 minutes ago [-]
The graphs that show Node.js compatibility high and above that of Deno and Bun are misleading. Nominally supporting APIs and being proven to run entire Node.js applications and libraries in production are different things. Also, Deno and Bun have been listening to user demand, whereas this is implementing everything regardless of user demand. It's more of a decision than it is a great achievement, like it's framed as.
I'm Syrus, from Wasmer. We built Edge.js in a few weeks after different trials trying to bring Node.js to the Edge. We used AI and Codex heavily for this project, as otherwise the timeline would have spanned to a year plus to develop.
The summary of this announcement is that Edge.js:
Super happy to answer any questions you may have!Why is safe mode opt-in?
As a fun exercise, you can try reading process.cwd() from edge in --safe mode and without it.
Question regarding the pluggable js engine: I have an electron app where I'm currently using QuickJS to run LLM-generated code. Would edge.js be able (theoretically) to use electron's v8 to get a "sanboxed within electron" execution environment?
Dumb question: could you run this in frontend js using the browser's js engine and wasm environment similar to WebContainers? Maybe `fs` is just in-memory, and some things like forking are disabled. It'd be cool to have "nodejs" in the web!
Currently it supports Node, but we plan to add Python, Ruby, git, and more.
You can see it in action in this demo: https://vitedemo.browserpod.io
More info here: https://labs.leaningtech.com/blog/browserpod-10
Ah and kudos to Syrus and his team for this release. Edge.js's architecture seems to have many similarities with BrowserPod. I see it as proof that we are both going in the right direction!
And yes, it will allow running Node.js apps fully on the browser, in a way that’s more compatible than any other alternative!
Stay tuned!
I can see where that's going.
Awesome. I want to msg. you on LinkedIn but can't.
Roughly:
* a refactor of Node.js, but using a standardized API for JS engine interop * Integration with the Wasmer CLI so it will run JS with v8 but, everything else in Webassembly
Interesting idea.
Could be a much lighter weight way to sandbox JS...
What was the most confusing thing in the blogpost? I'd like to polish a bit more to make it clearer! Thanks a lot!
First, I could not find usage examples on the edgejs.org page and the docs link points to the node docs, why?
If I head to github, there are some usage examples, but they confuse me more.
The first example: $ edge server.js led me to think that this is a node replacement that runs in a webassembly sandbox, so completely isolated. But why the need of --safe then? What's the difference between using it and not using it?
But the next examples creates more confusion to me: $ edge node myfile.js $ edge npm install $ edge pnpm run dev
What is this doing? I thought that edge was a node replacement, interpreting and running javascript files, but it's now running executables (node, npm)... what is that? What happens when I run npm install... where does it install files? What's the difference between running edge node myfile.js and edge myfile.js?
Hope this helps.