Live data from Hacker News

I wrote a static web page and accidentally started a community (2023)

localfirstweb.dev

61–70 of 136 posts

Re: I wrote a static web page and accidentally started a community (2023)

#61
post #56

Earlier quoted context omitted.

Download HTML file (and dependencies), open local file, local JS requests from internet, and CORS error. Why can it not work like this?

> local JS requests from internet I really don't understand what this means.

[deleted]

Re: I wrote a static web page and accidentally started a community (2023)

#62
post #6

Hey browser makers, please allow file:// URLS to actually be able to load other files in the same directory without giving a CORS error. You can't even run a JS file from the same directory! That's what's really killing "local first".

Why not use data: or blob: URI's instead? That ought to allow you to load resources from the "same" file, obviating security concerns from loading external resources.

(Alternately you could bundle multiple files into a single ePub, though that requires a few adjustments compared to simple HTML. It's a widely supported format and allows for scripting.)

Re: I wrote a static web page and accidentally started a community (2023)

#63
post #57

Another aspect of local-first I'm exploring is trying to combine it with the ability to make the backend sync server available for local self-hosting as well. In our case we're building a local-first multiplayer "IDE for tasks and notes" [1] where the syncing or "cloud" component adds features like real-time collaboration, permission controls and so on. Local-first ensures the principles mentioned in the article like…

This looks like a great project and something that could be adapted into what I've been looking for unfruitfully (an OSS/self-hosted and cross platform version of Noteplan 3 for family use). Not expecting too much movement on your part into the crowded task management space but the screenshots and examples gave me the same feeling.

Signed up for early access and looking forward to it!

Re: I wrote a static web page and accidentally started a community (2023)

#64
post #44

Earlier quoted context omitted.

Luckily, starting a local HTTP server for development is more-or-less a one-liner for a long time, in most OSes (maybe even Windows might ship with Python nowadays?): python -m http.server 8080 If if you're stuck with python2 python -m SimpleHTTPServer 8080 At least this doesn't introduce the security issues you'd see with any file:// resource being able to load other file:// resources

It's not perfect either: https://docs.python.org/3/library/http.server.html#http-serv... You should also add a `--bind 127.0.0.1` so you don't expose the site to everyone on your network.

Only slightly related, but port binding in Docker also binds to 0.0.0.0 by default: `-p 8000:8000`

To be safe, this should be used instead: `-p 127.0.0.1:8000:8000`

Re: I wrote a static web page and accidentally started a community (2023)

#65
post #35

I never made anything fancy, but I never made anything for the web that I can't run locally. If I can't just sync the changed files to the web server and overwrite the DB (which for my use cases takes seconds), I'm not interested. If it needs to be in the domain root, I'm not interested. A bunch of files using relative paths and a config that checks for running on localhost and points to the local DB or the productio…

Nah I feel like this is the right approach. Apps got too complicated to maintain safely. Web development should be accessible and have good standards. It should be easier to build webapps over the years but its becoming harder and harder.

I say it's easier today, if you keep it simple. Everything I did 20 years go still works, or works better, or became simpler to do, or is now built into the browser or the language or what have you.

Like this little PHP script I had to spit out custom gradients before CSS had them, it's weird how fondly I remember that... it wasn't even special or complicated, but it was my grd.php and I used it everywhere :) And on some old pages I never got around to replacing it, I'm sure! Once it works, it just works.

Stay away from frameworks and pre-processors, but also study them (!) and make your own and you'll be fine (that is, you will have a lot less pointless churn). If in doubt, don't put sensitive info on it and don't allow visitors to. There is so much you can do where security really literally doesn't matter, because it's just something cool to make and show people.

Re: I wrote a static web page and accidentally started a community (2023)

#67
post #58
post #49

Earlier quoted context omitted.

Maybe this is an opportunity. Is there already a “DNS for ports” whereby the hosts file is propagated with application process identifiers that are mapped to localhost:port in hosts file?

Careening back to inetd and /etc/services …

It's amazing to me all of the fancy new ways eventually evolve into the thing they were trying not to be in the first place. We see this time and time again. I've been around long enough to have seen it in several situations to the point that at the start of the trend someone looks like the old dog refusing to learn a new trick, then eventually people realize they could have saved a lot of time/effort/money by taking the old's advice and experience.

Re: I wrote a static web page and accidentally started a community (2023)

#68
post #6

Hey browser makers, please allow file:// URLS to actually be able to load other files in the same directory without giving a CORS error. You can't even run a JS file from the same directory! That's what's really killing "local first".

That and, bring back the "new tab" custom URL, and, a way to securely host local servers without root but also without just praying that another app doesn't port-squat me

Localhost is an entire /8, so you have a few million possible addresses you can bind to if you want, all on whatever your preferred dev server port is.

Re: I wrote a static web page and accidentally started a community (2023)

#69
post #45

Well, it's always amusing how they discover that applications can run locally without depending on someone else's servers and maybe without pulling unverified code from 50 random repos. Next they'll discover native applications! Innovation! Maybe after that they'll even discover that you can give a shit about the user's battery/power consumption and ram consumption again!

This is unnecessarily combative. Local-first does not mean local-only, it means that the app should also work on the internet, meaning that you need to solve sync, which is why it took some time for the concept to gain traction. CRDTs for example are relatively new.

Re: I wrote a static web page and accidentally started a community (2023)

#70
post #6

Hey browser makers, please allow file:// URLS to actually be able to load other files in the same directory without giving a CORS error. You can't even run a JS file from the same directory! That's what's really killing "local first".

I'm mostly resorting to self-hosting tools on my tiny server these days, but I would love it if I could run local web apps on a synced folder (a la Dropbox), and access them on my computer and mobile phone alike. With the CORS bypasses, it would be so convenient to have your own personal kanban or finance apps running and synced across multiple platforms, and remove the barrier of entry for many.
Post reply on HN