8 ms·
I wrote a static web page and accidentally started a community (2023)
- rurban 2y agoThere really must be something less bloated for local static pages. Embedded SQLite and react just for a few nested table queries? Come on, js has maps and hashtables. React for displaying generated content? My DOM inserter is half a page, and loads instantly
- nosefurhairdo 2y agoThe "static page" is referring to https://localfirstweb.dev/ https://localfirstweb.dev/. TinyBase, the tool with embedded SQLite and React support (among other things) is for reactive (non-static) web applications. Native JavaScript language feature like maps are not an adequate replacement for the functionality offered by TinyBase.
- rurban 2y agoWhat 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.
- nosefurhairdo 2y agoThe react module for TinyBase is optional, and if you're just using their store module you only add 5.3kb gzipped to your final bundle, hence the name TinyBase. I also don't think you understand the complexity of the features that TinyBase is offering. It's possible you don't personally need these features, but critiquing the software for not being totally minimalistic is a bit silly.
- nsonha 2y agohow 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
- oneeyedpigeon 2y agoBuild the index as a static file and query it using js? This has been my approach so far — admittedly, this isn't with millions of pages, but I'll continue to use it for as long as it works. When hosted on the internet, the search is still blazingly fast, way better than most other sites I come across.
- VenturingVole 2y agoFor a very similar scenario I'm currently looking to use PGlite: https://pglite.dev/ https://pglite.dev/ which is a 3MB WASM build of Postgres which also includes pgvector.
- arccy 2y agostuff like https://lunrjs.com/ https://lunrjs.com/ works
- nsonha 2y agoCan it index images by semantic, that is what vector search can do
- dgb23 2y agoI agree on React, but not necessarily on SQLite. It's made for use cases like this and it can handle quite a lot of data with a humble footprint. Ironically, if you use something browser native indexeddb plus JS instead, you are also likely indirectly using SQLite as far as I know.
- computerthings 2y agoI 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 production one, respectively. That's it (okay plus the domain and a few other things so cookies etc. work, but describing it would take longer than making it), that's all I want out of the web kthxbai. I'm basically stuck in 2000 and I love it.
- zwnow 2y agoNah 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.
- computerthings 2y agoI 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.
- Dwedit 2y agoHey 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".
- tlarkworthy 2y agoI have made a notebook environment inside a single html file. You have to map dependencies in an importmap to blob URLs and it works. I have a single file website online. And you can click download to play with it locally https://tomlarkworthy.moldable.app/index.html https://tomlarkworthy.moldable.app/index.html You can turn off network and the download works.
- bsenftner 2y agoVery nice, written up anywhere?
- tlarkworthy 2y agostill a WIP but I will write it up properly soon.
- genewitch 2y agoCan this be a self-contained alarm and journaling app for cellphones? Because I can't think of a way to do that without serviceworkers. I mean a way that doesn't involve the end user reading a paragraph of instructions, based on their "OS". Anyhow, sorry, I just can't tell what it does from the confines of that demo and a cellphone browser...
- tlarkworthy 2y agoNo I think you need service workers for notifications. You could do journalling but it's emits a file when saving by default. Index dB works so maybe that's a possability
- ngcc_hk 2y agoSeems need pointer and example. What is this mobile at your fingertips tip local but share …
- deleted 2y ago[deleted]
- krishadi 2y ago> But I was equally surprised by how little this was being discussed, or (as far as I could tell) practiced in the real world. While there seemed to be endless threads on Twitter about server-side React (to get the UI generation closer to the data), no-one was talking about the opposite: moving the data to be closer to the UI, and onto the client! This, I've wondered for a while. There is plenty of talk about server side rendering, which I don't think is useful for many apps out there. SSR is quite wasteful of the resources on the client side that can be made useful. And, I've seen many apps being developed with "use cliënt" littered all over, and that begs to wonder why do you even want SSR in your app.
- zwnow 2y agoWasn't the reason for SSR to have more control over security and offload work from the client to the server? Let's not forget that the majority of the worlds population is using slow ass tech. We cant simply put huge workloads to the client.
- indymike 2y agoI think the main drive for the modern version SSR was SEO. The workload part? the whole point of SPAs was to move compute - especially fancy UI compute down to the client so the server only had to move data... so we're just completing the circle again.
- dplgk 2y agoFunny that bad SEO was a big strike against Flash and a reason to move to HTML5
- krishadi 2y agoIt was mainly for SEO, and to some extent protecting against website scrapers and crawlers.
- ZYbCRq22HbJ2y7 2y agoSSR just means you render on the server, it isn't whatever you are describing.
- dmwilcox 2y agoI love the localfirst idea but I don't love web browsers. They're the platform everyone has to have but shoehorning 40 years of UI development and products into them seems like a mistake. I can see why local UI development fell out of favor, but it is still better (faster, established tooling, computers already have it so you don't have to download it). I can't help but feel like a lighter weight VM (versus electron) is what we actually want. Or at least what _I_ want, something like UXN but just a little more fully featured. I'm writing some personal stuff for DOS now with the idea that every platform has an established DOS emulator and the development environment is decent. Don't get me wrong this is probably totally crazy and a dead end but it's fun for now. But a universally available emulator of a bare bones simple machine could solve many computing problems at once so the idea is tempting. To use DOS as that emulator is maybe crazy but it's widely available and self-hosting. But to make networked applications advancing the state of emulators like DOSBox would be critical. Actually local first, maybe the way forward is first to take a step back. What were we trying to accomplish again? What are computers for?
- raelmiu 2y agoLove 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.
- rollcat 2y agoI 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.
- WorldMaker 2y agoThe 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.
- shayansm1 2y agoI was introduced to Local First while watching this conference by Martin Kleppmann (the author of Designing Data-Intensive Applications book): https://martin.kleppmann.com/2023/06/29/goto-amsterdam.html https://martin.kleppmann.com/2023/06/29/goto-amsterdam.html. It's worth watching!
- oneeyedpigeon 2y agoThis ties in nicely with the bookmarking discussion about Pinboard. I particularly like the following quote from this article: > Now, of course, there are many advantages to this shift: collaboration, backups, multi-device access, and so on. But it’s a trade! In exchange, we’ve lost the ability to work offline, user experience and performance, and indeed true dominion over our own data. I’ve decided that the advantages of storing my bookmarks locally far outweigh the chance that I'll want to access them from a different device or collaborate with someone else on them. Yes, it means I've created something of a 'silo', but I'm starting to think that's not a bad thing.
- canadiantim 2y agoMay I ask what the bookmarking discussion about Pinboard is? I tried looking through all of the recent articles but find nothing about pinboard. What’s your current solution for local bookmarks?
- 0100101101001 2y ago[dead]
- oneeyedpigeon 2y agoThis one: https://news.ycombinator.com/item?id=43022098 https://news.ycombinator.com/item?id=43022098 I'm right in the middle of setting it up. Basically, curl and a bunch of bash scripts.
- julianeon 2y ago> I’ve decided that the advantages of storing my bookmarks locally far outweigh the chance that I'll want to access them from a different device or collaborate with someone else on them. Yes, it means I've created something of a 'silo', but I'm starting to think that's not a bad thing. Why don't you store those bookmarks as markdown files and then upload them to a private repo you can read on other devices and even your phone through the GitHub mobile app? If they're bookmarks, they'll work perfectly as links in markdown which you can click in the GitHub app. Note: I pay $4/mo for GitHub private repos and I absolutely defy anyone to show me a better deal in any SaaS company. I open the GitHub mobile app at least 10 times a day. This is the only subscription service that is inarguably worth it as far as I'm concerned.
- nottorp 2y agoWell, 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!
- paulgb 2y agoThe key in local-first is the _first_. The stated goal is to give people the benefits of local applications (no spinners, data outlives the app) with the benefits of cloud applications (low-friction collaboration).
- kridsdale1 2y agohttps://developer.apple.com/icloud/cloudkit/ https://developer.apple.com/icloud/cloudkit/
- satvikpendem 2y agoThis 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.
- kridsdale1 2y agoI mean, native apps have been cloud syncing for more than 20 years.
- gessha 2y agoAs satisfying as it is to point at local first software and say they forgotten history, it’s important to remember that a lot of development happens where the friction is lowest. The target platform for many local first apps is browser because you don’t have to mess with EXE/DMG/AppImages. The goal is to ship, not to ship the most efficient application possible.
- giancarlostoro 2y agoI built and offline friendly app, was not offline first, but it was my first PWA, the idea was that a pilot could have our web page open at high altitudes, potentially with bad service, and they could still interact with anything, once back online, it would push any changes they made. I implemented it with vanilla JS. The only annoying part was detecting when the browser was back online, I used some hacky solution since there was no native API for it for any browser at the time, but it worked.
- wim 2y agoAnother 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 guaranteed access to your data and no spinners. But that's just the _data_ part. To really add longevity to software, I think it would be cool if it would also be possible to guarantee the _service_ part also remains available. In our set up we'll allow users to "eject" at any time by saving a .zip of all their data and simply downloading a single executable (like "server.exe" or "server.bin"). The idea is you can then easily switch to the self-hosting backend hosted on your computer or a server if you want (or reverse the process and go back to the cloud version). [1] https://thymer.com/ https://thymer.com/
- nsriv 2y agoThis 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!
- pillefitz 2y agoIf I can host the backend myself, does it imply it's not a commercial offering?
- wim 2y agoI think it's not too different from downloadable software, so it doesn't rule out commercial services (we plan on both paid and free versions).
- cxr 2y ago> To really add longevity to software, I think it would be cool if it would also be possible to guarantee the _service_ part also remains available. In our set up we'll allow users to "eject" at any time by saving a .zip of all their data and simply downloading a single executable (like "server.exe" or "server.bin"). The idea is you can then easily switch to the self-hosting backend hosted on your computer or a server if you want Too few people are taking advantage of Redbean <https://redbean.dev/ https://redbean.dev/> and what it can do. Look into it.
- hidelooktropic 2y agoLove this. I had always referred to this concept with the rallying cry: "'offline' is not an error"
- physicles 2y agoReminds me of those “skateboarding is not a crime” stickers
- staticelf 2y agoLove the idea and the community aspect! The issue with local first web dev in my experience is two fold: 1. It's super hard. The problem of syncing data is super hard to solve and there is little support from modern tooling. Mostly because it differs vastly on how you should handle it from app to app. 2. Very few that live in the west or people who pay for software are offline in longer stretches. There is simply very little to no requests for making apps work offline. I would argue to opposite that it probably is mostly bad business because you will get stuck on technical details due to #1 being so hard to solve. Even people who say they will use the app offline are never offline in my experience (from working on a real app that worked offline). I work on an app that has clear offline benefits, although, pretty much no one will use it offline in practice and where I live, people have 5G access nowadays even at places that used to be offline, aka trains, tunnels etc. Even so, I plan to make my app offline supported but only after I have success with it.
- yaky 2y agoI don't understand, offline-capable software is now being pitched as something profound and genius? There was software before the widespread Internet access.
- armarr 2y agoThis is trying to give users all the benefits of being cloud connected (sync, collaboration, etc) without the requirement of always being connected.
- brianzelip 2y agoA couple podcast episodes featuring the author (mostly regarding his TinyBase project): - https://www.devtools.fm/episode/67 https://www.devtools.fm/episode/67 - https://www.localfirst.fm/12 https://www.localfirst.fm/12
- lubujackson 2y agoVery cool. Coincidentally I just made a basic calculator with stored variables (https://calc.li/ 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).
- sirjaz 2y agoThis gives me hope that we can get native apps back again, and collaborative work through them without the browser or a central authority
- kridsdale1 2y agoMany of us never stopped writing native apps. When I was at Apple (2010-2015) every app was Local First. In fact they legally had to be to be sold in Germany, where iCloud cannot be mandatory (they have a history of user data being abused). You’ll notice when the network goes down all your calendars email contacts and photos are still there. The source of truth is distributed. Client side apps writing to local db with background sync (application specific protocols) works excellently. You just don’t write your UI as a web page.
- pdyc 2y agolokijs and nedb were better candidates for local db's but sadly both are unmaintained.
- rglullis 2y agoFrom 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-clouds/ https://raphael.lullis.net/thinking-heads-are-not-in-the-clo...
- tommica 2y agoGoddammit, of course the closest edge/node to the user is their own damn device... I should have realized that long time ago
- AlienRobot 2y agoThat's a very interesting blog post and certainly the way I wish things headed.
- rssoconnor 2y ago> can I solve this with Syncthing? I recently found out that Syncthing is ending Android support. :(
- runarberg 2y agoI’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.
- jandrese 2y ago> You see, connectivity is generally good on a boat - wifi, cell coverage, and satellite options abound - so we survive. But when it isn’t good, it really isn’t good. And then suddenly, it dawns on you just how much of your life is beholden to the cloud. Your documents don’t load. Your photos don’t sync. Your messages don’t send. Without necessarily consciously realizing it, we have all moved most of our online existence to other people’s computers! Welcome to the world a huge chunk of the population lives in. It drives me crazy how quick people were to jump onto cloud computing without ever asking the question "how well does it work when my Internet connection sucks?"
- bzmrgonz 2y agoYou should know that the website localfirstweb.dev shows as blacklisted on avast and avg viruses. It doesn't like a site reference called strut.io. claiming it is a card stealer.
- yonz 2y agoThat's just nuts, I'll look into it. I know the guy that built strut and I run the lfw site.
- ddanieltan 2y agoRelated idea to local-first: https://stephango.com/file-over-app https://stephango.com/file-over-app
- tobilg 2y agoI created https://sql-workbench.com https://sql-workbench.com a while ago, mainly to let people analyze data that's available via http sources, or on their local machines, w/o having to install anything. A recent project is https://shrink.video https://shrink.video, which is using the WASM version of ffmpeg to shrink or convert video in the user's browser itself, for privacy and similar reasons mentioned before.
- yonz 2y agoNice