16 ms·
Offline First
- tdeck 5y ago> This can be either done with complex caching strategies, or by using an offline first database (like RxDB) that stores the data inside of IndexedDb and replicates it from and to the backend in the background. This skips completely over the simpler options of not having a server at all. I guess because this is an ad for RxDB. Edit: to be clear, I'm sure this paradigm is useful in many applications. But it strikes me as odd that something called "offline first" doesn't seem to include the possibility of software that runs entirely on one's own computer.
- blondin 5y agono, i am with you. i couldn't tell if they are being serious or not. they probably are, which is kinda depressing. "offline-first is a software paradigm where the software must work as well offline as it does online."
- aidos 5y agoThat’s one type of software, but a lot of software these says is collaborative, with the need to share that data around. Even software for personal use is expected to be able to sync your content between the multitude of devices people now use.
- supermatt 5y agoIt doesnt have to replicate. Thats optional. Can work 100% offline. The RX here means it is reactive - i.e. you can subscribe to state and react to it. This is how it updates the display across independent tabs when the data changes, for example. THATS the main point of RxDB, the sync is just another feature (which you dont have to use and isnt even a default). EDIT: Im nothing to do with RxDB, and dont use it - but i have investigated it previously.
- xg15 5y agoI agree it sounds weird, but isn't "offline first" a term specific to web apps? It's practically impossible to make one of those without a server.
- deleted 5y ago[deleted]
- tdeck 5y agoI'm not sure, this article is my first introduction to the term and it doesn't say the term is specific to web apps.
- dspillett 5y agoNot specific to web apps, but usually only used with respect to them. “Traditional” applications on desktops/laptops/similar where offline-only, some later getting online sync as optional features, so offline-first doesn't need to be stated as it is the assumed default when something isn't offline-only. Web based applications started out online-only, only later in their evolution sometimes getting the ability to work properly offline. Offline-first is still an unusual property, and may forever be, so gets mentioned where it is relevant. Many are simply “works offline” where offline operation is bolted on as an afterthought and may not be at all optimal (for instance in the case of two edits to the same object the last to sync automatically wins, clobbering the other with no attempt to merge or branch and no notice that this has happened or is about to happen, and no care given to the consistency of compound entities when this happens). Apps for phone & tables fall between, so the matter is more vague. I have heard offline-first in reference to them but usually they are either online-only or “works offline” (offering little or nothing more than buffering changes until a connection is available). Some, particularly games, are like traditional apps (offline only or offline with some sort of online sync/backup).
- cblconfederate 5y ago> Single page applications are opened once and then used over the whole day. oh if only that were true. everyting is SPA now. imgur is a place where you go to see an image, then close. how many megabytes of javascript is it today
- SilverRed 5y agoThey have two use cases. You can use it to just click a link and close but the use case they go for is a full social media like reddit where the full features of an SPA make sense. Drive by viewers are probably lowest priority as they do not generate much revenue. They were forced to go down this path as it was clear reddit would add their own image hosting and remove the need for imgur so the site would have to be self sustaining.
- cblconfederate 5y agoI just think that path is lack of imagination
- BatteryMountain 5y agoIf I have to count the number of hard-refreshes I do per day to get a SPA unstuck...
- lmm 5y agoOK, you've compressed all your problems down into one problem - unfortunately that problem is bigger and more complex. How do you safely merge divergent changes to this shared uber-datastore? By breaking down all the operations my system supports into a set of simple REST endpoints, I (hopefully) simplify the space of things that could happen and get a good sense of which combination of requests I might have to support. If the space of user operations is instead "any database query", that sounds simpler but it's actually much harder to deal with.
- d3nj4l 5y agoYeah, and how would you perform validations that shouldn't be client side?
- chii 5y agoYou perform those in bulk, as a batch job when the client side pushes the state up when back online. After all, if a client is offline, nothing they do can affect anyone else until they go back online.
- cies 5y agoAnd now one needs UI to show that all the forms one thought were saved are merely sent, and come back a "tasks" that still need user attention. What was simple form validation is in "offline first" something akin to a mandatory content moderation step.
- cies 5y agoExactly. State management is the hard part. There are huge merits to having it all in one central data storage layer, where some smart backend code can choose the storage method best fit for the type of data (SQL/ACID, or KV-store, or ...). Having a datastore in every device, that now need to sync is giving me headaches already. Syncing is potentially very hard.
- smackeyacky 5y agoI do this for my mobile app, because the users are often working in remote areas without cell coverage or any network at all. I have a pretty simple strategy though: I use SQLite on the mobile devices and when the device is back within network coverage, take a copy of the SQLite database, zip it up and throw it up to the server. It ends up in an S3 bucket (all the device database backups end up with a UUID as their name), kick off an automatic process via a Lambda (triggered by S3) that imports the SQLite database into the bigger DB, job is done. It works pretty well, SQLite databases compress REALLY well. The only tricky bit is having to check the version code of the database in case I have an old version of the app floating around in the wild (it happens).
- firloop 5y agoWhat do you do with the backups?
- smackeyacky 5y agoKeep them for a while, do an s3 sync to a local machine once a week for a good old tape backup, and use an s3 policy that sends older backups to s3 glacier. They are relatively small so this is manageable.
- yjftsjthsd-h 5y agoIs that safe? That sounds like intentional SQL injection
- vbitz 5y agoIt sounds pretty safe. Your only copying rows from one database into another database. Unless you accept arbitrary SQL strings from the user it's not a significant security risk. It does open up some possible vulnerabilities like can the user overwrite other people's information but mitigating that requires the same validation layer you should have anyway.
- smackeyacky 5y ago
- cstrat 5y agoMeteor uses `minimongo` on the client which sync's with the server; effectively doing the same thing. It's actually amazing how much better the UX is when you have spotty coverage.
- bjarneh 5y ago> On offline first applications, there is always exactly one state of the data across all tabs. Perhaps between tabs, but what about multiple devices/browsers?
- cies 5y agoThis article has a lot of good points, but the UX is in my opinion terrible: UI elements are moving across the screen without the user of that screen doing any action. We've all experienced this: you want to click a button (or select an input field, ...), but right before you do it moves away. Maybe something finally loaded which pushed the content down. Maybe some content was synced in (as is the case in the UX examples of this article). The solution is, afaik, well known: add a UI element (that obviously does not move other elements) that informs the user that "new information is available". For instance GMail's yellow drawer informing users (a) new message(s) is available in the thread.
- ashdev 5y ago> Offline-First is a software paradigm where the software must work as well offline as it does online. I've been building offline-first apps[0] for quite a while in both desktop and mobile space. I have a different definition[1] of what an offline-first app is: Offline-first apps are apps which can run and function completely offline or without needing the internet for an indefinite amount of time. To offline-first apps, providing all functionality offline is the "primary objective" and any online functionality such as syncing to cloud is secondary. Also, I personally don't consider an app using temporary cache to store data to be an offline-first app. It must use a local database. Sometimes the "offline-tolerant" apps are confused with offline-first apps. Offline-tolerant apps often provide partial functionality and eventually need an internet connection to sync data. [0]https://brisqi.com https://brisqi.com [1]https://dev.to/ash_grover/how-i-designed-an-offline-first-app-an-outline-45c https://dev.to/ash_grover/how-i-designed-an-offline-first-ap...
- fao_ 5y ago> Also, I personally don't consider an app using temporary cache to store data to be an offline-first app. It must use a local database. From the website (https://rxdb.info/adapters.html https://rxdb.info/adapters.html) > react-native-sqlite > Uses ReactNative SQLite as storage. Claims to be much faster than the asyncstorage adapter. To use it, you have to do some steps from this tutorial.
- nicbou 5y ago> We now have better mobile networks and having no internet becomes a rare case even in remote locations. That's simply not true. There is no internet on many parts of a train journey. There is no internet in parts of the underground rail network. There is no internet on the plane. There is no internet in nature. There is no mobile internet outside the EU, until you get a new SIM card. There is no usable internet in some hotels. If you travel a bit, you know that internet is far from guaranteed.
- glanzwulf 5y agoAnd even within the EU, it's not guaranteed. I'm currently in Berlin and the internet here is ass. My current provider dies on me at least once a day and the speeds are atrocious. Mobile network is also weird. Every time I go into a store for shopping I lose my connection. Once I come out I get a cute text message saying "Welcome to Germany, don't forget to get tested"
- nicbou 5y agoI'm also in Berlin. I know what you mean. It became a personal joke to note that the most remote corners of the world have better internet than parts of the Ring.
- pvtmert 5y agoA fellow Berliner here. Never understood this. I live inside the A ring, yet if I am not standing close to window, even the regular call doesn't work.
- masklinn 5y agoSounds like the building is well shielded. My flat is the same, essentially no signal inside, just open the window and I immediately get full strength LTE. Ask your provider for a microcell, if you want to change the situation (and often waste less battery, unless cellular is disabled smartphones tend to dislike not having signal or having poor signal quite a lot).
- 5y ago
- samwillis 5y agoI played with rxdb about a year ago, it’s really clever and has some great ideas. It’s built on the incredible PouchDB (the original offline first db) which is a truly feet of engineering. However I feel it is somewhat neglected (not implying that the original maintainers have any responsibility to the users, this is free Open-source, the fact they gave it away in the first place is brilliant). When I last used it about 6 months ago there had been very little activity in years on the github and I am concerned about their use of automatically marking inactive issues stale after 60 days. There is so little activity the only issues that are open are ones from the last 60 days. I found a sync conflict[1] (basically a hash collision, the attachments are unintentionally stripped from the document before hashing) and submitted a ticket, unfortunately as there is so little activity the issues was marked as stale and closed automatically. It’s not a bug that many people will come across but is a legitimate issue for anyone using binary attachments. So, rxdb is really great but I would be cautious about using it when the underlying platform is looking a little neglected. I truly hope someone has the time to take it on as it is an incredible toolkit. 1: https://github.com/pouchdb/pouchdb/issues/8257 https://github.com/pouchdb/pouchdb/issues/8257
- alice-i-cecile 5y agoStalebot is awful. Issues don't stop being real if you neglect them! Use a voting system or explicitly prioritize work instead.
- KronisLV 5y ago> Issues don't stop being real if you neglect them! Debatable. Issues don't stop being real if someone out there runs into them and can't find a solution because the issue has been closed. Issues very much stop being real if the only person in the world who cares about them decides that they don't care or solves it themselves without sharing their wisdom. The former hurts the people whose problems are considered unimportant, while the latter hurts the developers of the project who now have an essentially dead issue in their tracker. The solution? Close stale issues, but with the possibility of letting people say: "Hey, this is closed but is now relevant to me, so let's reopen it." That way, there are never open issues that no one cares about, while the ones that someone starts caring about can be reopened, until they're either fixed or no one cares about them yet again.
- tekkk 5y ago> With them you write all this lasagna code to wrap the mutation of data and to make the UI react to all these changes. Yeah, and allowing developers to just access state from anywhere and mutate it doesn't generate lasagna code at all. The issue so far with RxDB I see is how silly complex the syncing gets. You just see it doing its thing and hope whatever payloads it sends are optimal for your use case. And while offline-first seems neat in theory, it's not necessary for most web apps IMO. For desktop or mobile apps it's a different thing, but they have other options too that browsers don't allow.
- teekert 5y agoAnd local second? So my Nest app doesn’t take forever to load if it can just access an API on my Lan?
- pandatigox 5y agoOffline first is interesting, but what's a good solution for syncing with the main database after the device goes back online?
- random_savv 5y agoGet all entities whose updated_at is larger than the max updated_at in your local database.
- BatteryMountain 5y agoThen what if the schema changed? Columns renamed, dropped or new columns added that is non-nullable, or new foreign keys with non-null constraints? The only place I've seen "offline sync" work is where MongoDB was used server-side for the sync, which then gets synced with postgres - in this case the models are forced to be the same. But then you still have the problem of which side to sync first: postgres to mongo or mongo to postgres? What if a conflict arises? And having a device turned on after being off for a month WILL cause issues. I don't think there is a real solution here yet. At least not one that is perfectly automatable.
- renke1 5y agoAt least for my pet project I am considering to add a version field to my documents so that I can migrate the document to the most recent version before persisting in to the server's database. When sending documents to the client you may have to force it to update to the latest application version though.
- BatteryMountain 5y agoTrue. For simple apps with not much logic, you can get away with different front-ends/offline-syncs adding their own rows, and then only respecting the latest row in the main db, usually based on timestamp. But if you have something more complex where multiple workflows get triggered as side effects, then you may run into trouble when the latest row is in fact not the truth of the reality that we wanted, so there is still some risk ending up with states or workflows based on a false reality. This can become a nightmare if you a have few scheduled events/tasks/crons that does things periodically, thus the only way to mitigate that is to fully embrace eventual consistency and idempotency, and the "easiest" way to get there is to embrace the actor model paradigm (see erlang, akka/akka.net, Orleans framework, F# mailboxes, go-routines, etc). Point being, comparing two versions of applications against each other is not enough - you may need to version your data too and use timestamps to make a final decision on which version is truth. You may also need to set or build a tolerance system to say it will only sync "old" data if within x amount of days, lets say less than 7 days old. And so on.
- a3w 5y agoTabbed examples work great - but how do I multi-tab the browser on my phone? Okay, it is possible, but the use case seems improbable as it is hard to share that limited screen estate and my finger and a soft-keyboard with splitscreen browser tabs.
- janandonly 5y agoI think Oracle APEX works on the same premise? Store locally in indexdDB and sync up when the connection is back on-line. No need for difficult programming, APEX does this out of the box . Anyhow, a way to force this behaviour in APEX is to make every user interaction a write action on the DB. This way you either save locally or to the backend (but you don't have to worry about the sync between the two).
- arvindrajnaidu 5y agoSo communicate with server exclusively with database sync instead of explicit requests to change server state?
- ecmascript 5y agoRxDB seems very cool and perfect use case for my dayjob.
- pictur 5y ago> To manage this complexity it is common to use state management libraries like Redux or MobX. With them you write all this lasagna code to wrap the mutation of data and to make the UI react to all these changes. ignorance is wisdom.
- djm_ 5y agoThere is a lot of movement in the offline-first/multiplayer space at the moment, after apps like Linear [1] & Figma [2] have pushed the paradigms. [1]: https://linear.app https://linear.app [2]: https://figma.com https://figma.com Some other projects which will help you implement the pattern that are worth checking out: Replicache [3] - real-time sync for any backend. Works via simple push and pull end points and is built by a small team of 3 devs with decent browser xp (Greasemonkey, Chrome, etc) Logux [4] - a client/server framework for collaborative apps. From Evil Martians, well known for: postcss, autoprefixer, browserlist etc. [3]: https://replicache.dev https://replicache.dev [4]: https://logux.io https://logux.io RoomService also used to be in the space but recently left it to pivot to something else. The largest problem you’ll end up solving is conflict resolution so having a good understanding of the tradeoffs involved with your (or the underlying) implementation is key.
- faizshah 5y agoI haven’t used linear can you expand on what they do that pushes the paradigm? Gonna try it this weekend.
- Kinrany 5y agoThe creator of Logux etc. is also known for forking a package and erasing git history: https://news.ycombinator.com/item?id=28659838 https://news.ycombinator.com/item?id=28659838
- 10us 5y agoI use Pouchdb local and Couchdb on server and it automagically keeps all clients in sync.
- prox 5y agoSo basically the browser has become a sandbox environment :)
- jmnicolas 5y agoGive me a free solution to replicate a SQL database between mobile, web and server and I'm in. Something like Couch / Pouch DB but SQL. IMHO reliable replication is one of the hardest thing to code right.
- thunderbong 5y agoA bit offtrack - does anybody know how rxdb differs from PouchDB? https://pouchdb.com https://pouchdb.com
- scns 5y agoIt does not, it builds upon it.
- tr33house 5y agoOne worry I have is with sensitive data e.g. HIPAA protected information. How do you guarantee that the data is safe at rest. Are there encryption at rest options? With online-first applications, you can just expire the sessions after x minutes and lock users out once their permissions change. How hard is it to do something like this in practice for an offline-capable web-app?
- upofadown 5y agoEncryption at rest is generally easier and more secure than encryption in flight. It eliminates whole classes of oracle and downgrade type attacks.
- lytefm 5y ago- You can do the encryption at rest on the OS level, e.g. with LUKS. Cloudant does that. - You can also lock out users in Offline-first apps when a session expires or permissions are removed. Not difficult with CouchDB and certain libraries.
- zorr 5y agoI still haven't found the "holy grail architecture" for offline-first with backend sync where the backend isn't just a simple data store but also has business logic and interacts with external systems. Doing offline-first well implies that the app has a (sqlite or similar) local database, does work on that database and periodically syncs the changes to the backend. This means you have N+1 databases to keep in sync (with N=number of clients). Essentially distributed database replication where clients can go offline at any time. Potentially with different tech (for example sqlite on the client and postgres on the backend). When the backend isn't very smart it's not too hard, you can just encapsulate any state-changing action into an event, when offline process the events locally + cache the chain of events, when online send the chain to the backend and have the backend apply the events one by one. Periodically sync new events from the backend and apply them locally to stay in sync. This is what classic Todo apps like OmniFocus do. The problems start when the backend is smarter and also applies business logic that generates new events (for example enriching new entities with data from external systems, or adding new tasks to a timeline etc). Obviously the new server-generated events are only available later when the client comes back online. When trying to make the offline experience as feature-rich as possible I always end up duplicating almost all of the backend logic into the clients as well. And in that case, what is even the point of having a smart backend.
- aboodman 5y agoYou should take a look at my project, Replicache: replicache.dev. While it is true that you have to duplicate the mutations in the basic setup, you do not have to share the querying/reading code as it lives primarily on the client. Also, if your backend happens to be javascript/typescript, then you can share the majority of the mutation code between client and server and the result is quite sweet.
- zorr 5y agoWhen implementing something like this I indeed prefer to share as much code as possible between client/server. My daily environment is mostly JVM-based (desktop/android/server) so your project is probably not a great fit for me but I'm definitely going to look into it for some inspiration.
- scns 5y agoHas anyone used ObjectBox in anger and can share their experience? https://objectbox.io/ https://objectbox.io/ https://github.com/objectbox/ https://github.com/objectbox/ (addition) Some benchmarks https://greenrobot.org/android/benchmarking-on-android/ https://greenrobot.org/android/benchmarking-on-android/ https://greenrobot.org/android/android-orm-performance-2016/ https://greenrobot.org/android/android-orm-performance-2016/ (edit) You can even measure it yourself https://github.com/objectbox/objectbox-performance https://github.com/objectbox/objectbox-performance
- hoytech 5y agoI experimented with ObjectBox a bit, but I decided against using it because it isn't open source. The language wrappers are apache2 but the core library is only provided as a binary blob. I think this is bad because you can't inspect how it works, fix bugs, port it to new archs, integrate it fully into your build system, etc. Also, every cursor operation must call into their function entry points (as opposed to being inlined in your code for example). Instead, I've been working on my own library which also uses LMDB and flatbuffers. It's C++ only and still a WIP, but in case anyone else is interested, it's here: https://github.com/hoytech/rasgueadb https://github.com/hoytech/rasgueadb
- scns 5y agoThanks for sharing your experience with it, makes me wary.
- dadior 5y agoOffline first is a dream to me, I build a big note-taking app (midinote.me) which is 100% offline, but now the biggest pain point is the full text search, yes, we can use DB like this and PouchDB to store data, but currently, there isn't a good solution for full text search in javascript, I tried lunr.js the performance is poor, and researched FTS by sqlite, it don't support Chinese, I ever considered pack the lucene (on JVM) with Electron.js( the desktop wrap on JS) on desktop, I'm not sure it is a good idea, now I am going to re-think all these things, and considering give up offline and switch to server side full text search, it will save huge effort comparing to client-side search!
- dadior 5y agoYes, I am on javascript stack, maybe using other language client side FTS is easier? I don't know
- 727564797069706 5y agoKudos on building offline first software! Just spitballing here: maybe there’s a way to use Redis (and RediSearch) compiled to WebAssembly and then use it on client side?
- dadior 5y agoThanks, this solution might be better than mine, it don't need JVM
- knubie 5y agoI’m in the same boat with my app. Have you tried Elasticlunr? It claims to be significantly faster than Lunr.
- dadior 5y agoI ever researched this lib, I haven't any data to support my opinion, but I don't have too much confidence on it. Also, this repo didn't update for a while.
- 5y ago
- WallyFunk 5y agoI can't access my Bitwarden account without an Internet connection. What if their servers got wiped or hacked? I need a local store of the passwords so I can export them in that scenario.
- the_gipsy 5y agoI guess on iPhones (safari engine, so all browsers) it doesn’t work at all or it the aggressive storage deletion makes it unusable. Of course, because Apple wants to make the user “want” an app.
- fxtentacle 5y agoTrue "Offline First" would be an app that I can install, and not just yet another JavaScript framework ~_~
- asadkn 5y agoThere are a lot of apps that would benefit from being offline first. Apps like Notion feels quite sluggish to me on a higher latency 15mbps. And Figma is pretty bad on a decent 3g when loading files on a fresh load. Building a proper syncing solution isn't that simple especially when it's for multidevice and requires conflict handling. Replicache looks quite good to me but I haven't found any similar solution that's opensource with MIT/GPL license.
- rexreed 5y agoCan't you use SQLite in the way that's proposed here? Or Firebase (Firestore / Firebase Realtime) with persistence enabled? [0] [0] https://stackoverflow.com/questions/61315478/what-is-the-best-way-to-store-data-from-firebase-to-sqlite-or-offline-in-flutter https://stackoverflow.com/questions/61315478/what-is-the-bes...
- ronyfadel 5y agoDoes anyone know of something similar for native Swift (iOS/macOS), that can work with a standalone backend (not CloudKit/Firebase)? Last time I did something similar I had to roll my own Rails API and client-side cache.
- crabmusket 5y agoSurprised this article hasn't been shared in these comments yet as a corollary: https://www.inkandswitch.com/local-first.html#crdts https://www.inkandswitch.com/local-first.html#crdts I regard it as the definitive exploration of local or offline first software. They end up building an offline-first Trello clone which can sync with peers locally or on the internet.
- GrumpyNl 5y agoThis is a common problem in utility work, like meter readings and replacements. lots of times there is no good internet, basements and cages. We solved this years ago by, all business logic has to be at the front end. Load all workorders upfront. Exchange data when possible.
- faizshah 5y agoI have noticed that what we are missing in the Frontend space is some common solution for caching and reshaping data from the api. In every codebase I have worked on we just implement this ad hoc. We have agreed upon solutions for: Api client (fetch, axios, react query, etc.) Ui state management (redux, mobx, xstate etc.) Ui frameworks (vue, react etc.) But theres an intermediate piece between the api layer and the ui state that is always implemented ad hoc. We need some common solution to caching the api data, reshaping or querying it, and managing multi api workflows (for example a synchronous process where the frontend calls multiple microservices). Most answers to this end up being something like “get ur backend team to implement better apis” but thats not realistic in many cases.
- giancarlostoro 5y agoIndexedDB technically does this rather well unless I’m crazy, what a WebWorker really needs is a “am I even online” mode, the event handlers are one thing but browsers dont convey online state very well is what I run into. If you build a PWA though you get up to a gig of caching you wouldn't get with normal frontend DOM APIs.
- musingsole 5y agoGraphQL (coupled with get ur backend team to build it well) addresses these points. If you're a real zealot, you can use GraphQL to access and modify app state so all data operations across the stack have the same shape
- sj3k 5y agoYes! Every. Single. Time. Apollo Client is the closest thing I have used with that works decent out of the box.
- awinter-py 5y agoyes to 'reshaping' frontend schemas differ from backend schemas because they need to support sync, but it should still be possible to inherit the backend schema, transform it in predictable ways, save a lot of work 'full stack schemas' would be a 'pit of success' change IMO
- 5y ago
- JamesSwift 5y agoJake Archibald (who is an amazing presenter and you should definitely seek out) has a great PWA-oriented offline-first presentation [1]. It uses service workers but the underlying strategies are universal. Highly recommended if you are just getting started with offline-first. [1] - https://www.youtube.com/watch?v=cmGr0RszHc8 https://www.youtube.com/watch?v=cmGr0RszHc8
- HWR_14 5y agoI agree that handling offline devices is important. I've tried before an "offline first" database before, and it ended up really difficult to feel like an online and synced app. So I think I'm going to have to go with some caching system. I'm hoping this thread produces some good choices. Ideally, other than account creation (which seems like requiring internet is fine), everything caches automatically and syncs magically. Offline account creation would be great, until you want to verify people's email addresses or use OAuth
- lytefm 5y ago> Ideally, other than account creation (which seems like requiring internet is fine), everything caches automatically and syncs magically. This is pretty much how an offline-first app using rxdb (or just PouchDB) together with PouchDB works. Offline account creation? Just let the user use the app locally without creating an account. I only have two pain points with a CouchDB/PouchDB setup: 1. Technically, a user could post some garbage into his database after obtaining a session token. Design docs can help, but still cause overhead. 2. Only the "one database per user" approach properly ensures that each user can only access his private stuff. But then, querying information across users always requires to write some script that fetches the info from each database and aggregates them - instead of making one simple query.
- password4321 5y agoThis is the opposite of Elixir's Phoenix LiveView...
- inetknght 5y agoI just bought a home in "rural" Texas only 1 hour outside of downtown Houston. Cell service is definitely spotty out here. The final selling point on this home was that it's serviced by AT&T Fiber. So I have gigabit internet. If AT&T goes dark for some reason -- I lose power, they lose power, someone cuts the line, whatever -- then I can't access the internet and can't call anyone unless I drive for a few minutes. Offline first is a good thing to have but we do not have "better mobile networks" and "no internet" is only a rare case if you've stuck your head in a city. At my folks' place on the other side of Houston there's zero bars of cell service sitting on their couch. But if I stand up then I get full voice and data cell service.
- midrus 5y agoAfter having used RxJS, redux-rxjs, and some other "Rx" related libraries I don't remember their names anymore, I'm not touching Rx[anything] ever again. I still have nightmares.
- mamcx 5y agoI work in ecommerce/erp space and I need something like this, but not JS (I using Rust now). I tried in the past build my own but is truly hard!. I make a "event log" database but it sometimes could become so big that fill the server disk, and most events become uselles after a while. So figuring what is truly an "event is not as obvious. Exist a paradigm that could work here? I using sqlite + postgresql (and can't move to any fancy nosql).
- awinter-py 5y ago'lasagna code' as a description of writing redux is a good one
- oblib 5y agoYou can do offline first by installing CouchDB on the client side and using that to store user data. This only works on a desktop PC right now but for some apps that's a much better approach. My own testing had my web browsers choking up when I had a few thousand documents stored in the browser's IndexedDB. This is on a 10 year old Mac Mini with 8gb ram. Could be that newer PCs do better but I doubt they'll do much better. Using CouchDB with PouchDB.js provides a "Live Sync" option that syncs data both ways and that feature works very well with the apps I've made which do not have 1000s of users accessing the same DB. In my case there are probably not more than a dozen users accessing the same DB. And in my case there is not much chance more than one user is modifying a document at any given time. Also, in my case, there is no "backend logic" being processed. That's all done in the user's web browser.
- dadior 5y agoDid you try CouchDB's full text search? I red the doc it's using Lucene underlying.
- macawfish 5y agoThis is cool, I hadn't seen it until now. For those interested in a similar but more distributed option, hypercore-protocol will soon have multiwriter primitives! https://www.youtube.com/watch?v=7S-D4yY1H48 https://www.youtube.com/watch?v=7S-D4yY1H48
- ho_schi 5y agogit --local-is-everything The job of the server is syncing clients and not keeping the data way from the clients. Good examples are Git or any reasonable mail-client like Evolution or K-9. Bad examples? The GMAIL-Website and especially the GMAIL App, if you scroll too far you have to wait and hope that the servers are reachable and working. Old school programmers know how to read- and write files on the local file-system and load it into the free store. Things work fast, stand-alone and reliable. But this people are more expensive.
- y3sh 5y agoHey i'm all for doing away with loading spinners, but indexbd is not a catch all solution -- terribly slow for frequent simultaneous read/writes, better suited for other types of data access