A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Closing the gap between browser and NodeJS as a server


Existing technology like Cloudflare Workers, browser-functions and Vercel edge function arising and having Service Worker start acting as an server for your APIs is interesting none the less.

It have benfits like zero cold startup, it automatically stop the worker when it’s not needed. and it could have the potential for also scaling up more workers when it’s busting the as of by lot of heavy work.

Not only dose it also comes with lots of cool features like a scoped browser storages for different purposes. it also has caching, push notification and now a whatwg/fs for handling files as well. it also feels more secure in a way, that no way could it have access to any secret directories

I also like it cuz it’s well battle tested and also follows a standard specifications and comes with fetch natively built in, you can with some flags turn off some security issues when dealing with cross site requests.

Another potential useful feature could be to use Clients to open up a page and reder stuff on a webpage or canvases and then use transferable Streams to write and RespondWith some data. if you depend on some web DOM api’s

The more and more Deno and NodeJS keep re-implementing all of browsers native features the more i start asking myself, why don’t we just build a server in the browser. i start to dislike NodeJS & Deno more and more the more i realize this, that everything is just re-written in javascript as a kind of polyfill, nothing really truly feels native anymore. it feels like some stuff runs more slowly in node then what it dose in the browser. it’s also sometimes scare to think of what’s truly going on in your node_module folder sometimes.

the direct socket proposal is also a cool feature, but i’m unsure if it could fit the need to be acting as a server.

if we could make it somewhat easier for browser to take over the role as a server then that would be pretty cool! I’m not really expecting anything like this to be directly available without a flag of some sort. I’m imagine being able to run some Node/Deno-like commands but with browsers instead, something like: /path/google\ chrome.app install-worker ./sw.js --origin=localhost:3000 or maybe there could be some sort of api to install a service worker on a randomly assigned port using something from the direct socket api that spins up a new server


This article is quite informative on Closing the gap between browser and NodeJS as a server. Keep posting such useful articles buddy! You are doing great.