Live data from Hacker News

WebContainers: Run Node.js natively in the browser

blog.stackblitz.com

21–30 of 238 posts

Re: WebContainers: Run Node.js natively in the browser

#21
Alright, so you can create an IDE in the browser, but, what else? I'm just not seeing the value in running servers in your browser. Presumably, most sites will still need to connect to a remote back-end services to get at data and whatnot, and that back-end isn't going to be running locally on a customer's web browser.

Re: WebContainers: Run Node.js natively in the browser

#23

Hi all- CEO of StackBlitz/author of this blog post here. Happy to answer any questions! (Also, thanks for posting this bpierre!)

Could you point us to an introduction to how operating system concepts get mapped to browser concepts?

It sounds like each native binary gets compiled to a WebAssembly binary, but how do they communicate? How are the network and file system implemented? Are parts of the file system persistent? How does a system call work?

Re: WebContainers: Run Node.js natively in the browser

#27

I'm trying to get my head around how the networking of it works. Is local.webcontainer.io being overridden somehow on the browser like a hosts file might do? Trying to figure out how I'm hitting that URL from another tab

There is a service worker registered on the domain name, for example https://nextjs-agaw8i--3000.local.webcontainer.io/, then when you visit this URL in another tab it basically shares the service worker from the stackblitz tab.

Re: WebContainers: Run Node.js natively in the browser

#28

What about this is "native"? The page says it is "running natively" but also says "All code execution happens inside the browser's security sandbox". Is wasm in a browser somehow considered native now?

I interpreted it as “native to the browser”, which is a bit silly when you think about it, but makes sense when opposed to “running remotely”.

Re: WebContainers: Run Node.js natively in the browser

#29
post #22

Someday, I'd like to see Wasi-based webassembly containers. It'd be awesome to spin up a sandboxed shell with file access in a webpage.

why do you want to spin up a shell with file access in a webpage?

So you can open up your local project directory in your browser-based IDE and have it work like you expect.

Re: WebContainers: Run Node.js natively in the browser

#30

Alright, so you can create an IDE in the browser, but, what else? I'm just not seeing the value in running servers in your browser. Presumably, most sites will still need to connect to a remote back-end services to get at data and whatnot, and that back-end isn't going to be running locally on a customer's web browser.

I don't know about your dev environment, but in mine we run server code separate from web code. So you could toggle your local WebContainer to access either localhost:3001 or a remote branch, staging or prod environment for whatever server you wanted to test against.
Post reply on HN