Live data from Hacker News

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

localfirstweb.dev

81–90 of 136 posts

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

#81
Very cool. Coincidentally I just made a basic calculator with stored variables (https://calc.li/) with this philosophy in mind, though I didn't know there was a bigger movement around the idea! Mostly, I didn't want to bother with a backend or even cookies, so I just store everything in localStorage (which is criminally under-used IMHO).

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

#82
post #46
post #38

Earlier quoted context omitted.

Love this. What are computers for? Local first could be the file format that allows us to use devices without cloud services. Back to file first, vendors of software apps, pay for software once (or one year of updates or whatever). It's s new horizon.

I would still prefer to have my stuff synced between devices. Files are OK for data that doesn't change much (your music/photo/book library) - Syncthing works great there. CRDTs allow for conflict-free edits where raw files start falling short (calendars, TODOs, etc). I'd love to see something like Syncthing for CRDTs, so that local-first can take the next logical step forward and go cloud-free.

The other day I was riffing on ideas on what if Browsers had a third Storage called `roamingStorage`. Keep it the simple, stupid key/value store interface of localStorage and sessionStorage, but allow it to roam between your devices (like classic Windows %RoamingAppData% on a network/domain configured for it). It doesn't even "need" a full sync engine like CRDTs at the browser level, if it did something as simple and dumb as basic MVCC "last write wins, but you can pull previous versions" you can easily build CRDT library support on top of it.

The hardest trick to that would be securing it, in particular how you define an application boundary so that the same application has the same roamingStorage but bad actor applications can't spoof your app and exfiltrate data from it. My riffing hasn't found an easy/simple/dumb solution for that (if you want offline apps you maybe can't just rely on website URL as localStorage mostly does today, and that's maybe before you get into confusion about multiple users in the same browser instance using the app), but I assume it's a solvable problem if there was interest in it at the browser level.

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

#85
post #56

Earlier quoted context omitted.

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

If you load a file using the “file” protocol, it shouldn’t be able to load other resources (JS from the internet) with non-file protocols to protocols (http, https, etc.) to non null-string domains. because that would violate cross origin request sharing (CORS). I too like local HTML and would love to see it restored without requiring a local server. If I spin up a local Webrick to serve anything from my file system,…

People expect to be able to download an HTML file and for it still to be able to load an image with an external URL. If it can do that, it can exfiltrate (eg js can put data loaded from a local file in the src for an image on a external server).

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

#86
post #15
post #5

Earlier quoted context omitted.

What I said. Local embedded SQLite and React is not tiny, it's huge. And slow. And native JS only is adequate for tiny first web. Clients do care about ms vs 5s load-times.

how do you say, implement full-text search in a local first manner? How about vector search? (don't even know if it's a thing yet, sounds possible these days). Imagine saving a local copy of a docs site (a sizable set of pages) and have search and stuff working perfectly

stuff like https://lunrjs.com/ works

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

#87

Earlier quoted context omitted.

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`

It also bypasses firewall (ufw on ubuntu)

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

#88
post #87

Earlier quoted context omitted.

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`

It also bypasses firewall (ufw on ubuntu)

Yes and no, it's modifying the NAT table and so traffic will not be subjected to inbound rules where you would normally add an "allow HTTPS"-style rule: https://docs.docker.com/engine/network/packet-filtering-fire...

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

#89
From something I wrote in 2021 [0] and based on my experience working on a "browser-based OS" in 2013:

    What we need is to have a device-transparent way to see our *data*. We got so used to the idea that web applications let us work from "dumb terminals" that we failed to realize that *there is no such thing as a dumb terminal anymore*. With multi-core smartphones, many of them with 4, 8, 12, 16GB of RAM; it's not too hard to notice that the actual bottlenecks in mobile devices are battery life and (intermittent and still relatively expensive) network connectivity. These are problems that can be solved by appropriate data synchronization, not by removing the data from the edge. 

    One of the early jokes about web2.0 was that to have a successful company you should take an Unix utility and turn it into a web app. This generation of open source developers are reacting to this by looking at successful companies and building "self-hosted" versions of these web apps. What they didn't seem to realize is that **we don't need them**. The utlities and the applications still work just fine, we just need to manage the data and how to sync between our mobile/edge devices and our main data storage. 

    If you are an open source developer and you are thinking of creating a web app, do us all a favor and ask yourself first: do I need to create yet-another silo or can I solve this with Syncthing?
[0]: https://raphael.lullis.net/thinking-heads-are-not-in-the-clo...

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

#90
I’m working on a kanji learning app (shodoku.app) which some might say fulfills this ‘local first’ philosophy. Currently it is hosted on GitHub pages and relies on static assets (such as dictionary files, stroke order SVGs, etc.) which requires a web connection to fetch. However when I make this a PWA (which I’ll do very soon) these will all be stored in the browser cache, effectively making it work offline.

I store the user data (progress, etc.) in an indexedDB in the user’s browser and I have to say:

> No spinners: your work at your fingertips

is not true at all. indexedDB can be frustratingly slow on some devices. It also has a frustratingly bad DX (even if you use a wrapper library like idb or dexie) due to limitations of the database design, which forces you into making bad database designs which further slows things down for the user (as well as increases the total storage consumption on the user’s device).

I also wished browsers offered a standard way to sync data between each other, even though you can share your firefox tabs between your phone and computer, you can‘t get the data from indexedDB on the same site between your computer and phone. Instead you have to either use a server or download and drop the data between the two clients.

indexedDB feels like a broken promise of local first user experience which browser vendors (and web standard committees) have given up on.

Post reply on HN