Idea: Distributable Web Apps

Published See discussion on Bluesky

I was recently reading this Twitter (X?) thread:

specifically this part:

and I got to thinking - what if you could distribute your application as a web server + a bundled web app?

One major benefit - you don't need to rebuild some web view framework (or leverage the existing ones that seem to be fairly heavy and hated also), and it also offers some flexibility to the user for how they want to load the application.

But Matt, how would this work??!?!?

You'd need to do the following:

  • Build your frontend web application (and server if you have one)
  • Package it up into a folder if you want (zip or what not)
  • Offer an entrypoint script (really only something to start up the web server - maybe some shenanigans for domains [see caveats below])
  • Share the "app" as a directory download for the user

Users would then download the folder of assets + web server and start script, run the start script, and load up your application in their favorite web browser!

Caveats:

AKA open questions!

What url would you host the app on?

localhost:3000 or similar is a bit funky - doesn't tell the user what is running there. If possible, would be nice to register something like local.<your-app-name>.app and tell the OS (via hosts file maybe) that the url should be resolved against localhost:<your-port>.

What does the start script look like?

Initially I was thinking that it would be a shell script, but I realized that it could also be a Deno script thats compiled to run as a binary - then it could package up the web server all in one file too!

Summary:

That's it - that's the whole idea! Has anyone tried this before? Anyone have success? I could see a simple native app that handles the host issue for folks, and then web apps "register" with the native app somehow...