News for hackers. Stuff that matters.
Re:Skip the API, Ship Your Database by EMM_386 on Wednesday September 13, 2023 @08:47PM (#37503534)
> User can open the application, get the database, the frontend does all the offline updates the user want to perform.

"get the database"

How small do you think these databases are?!

You're going to download the entire hotel booking platform's database?

For how many hotels? One at a time, and then get another databse? Or are you getting a Sqlite booking database for every hotel in the world? And you're going to send them to each user? For what date range?

And even if that were possible, you then have to commit your offline updates. What if someone else booked the date range prior to you? Now your Sqlite copy is stale. Download the entire thing again? There could have been countless changes from other users in the time since you last got your copy.

This explanation just leaves me even more confused. It's illogical.

Re:Skip the API, Ship Your Database by layoric on Wednesday September 13, 2023 @10:20PM (#37504164)
Web applications aren't going to get bigger just by themselves! /s

Jokes aside, this extreme optimization for development does have impacts on user experience. The amount of bandwidth/storage etc used by a "just ship the whole db" type applications would surely suck for most people outside of the 'I measure my bandwidth in Gbps' crowd?

Re:Skip the API, Ship Your Database by yyyk on Wednesday September 13, 2023 @11:38PM (#37504700)
I have some experience with a comparable platform. In a typical CouchDB/PouchDB design, syncs are common and easy and it's pretty close to database-based design if you get fancy with views and javascript-based logic.

For this project, I'd do:

* A database for each user (this is natural on CouchDB, a setting one can enable to create the DB automatically. The platform won't choke on many databases) - for some per-user data, like comments, if the user has already reserved a booking we can mirror booking data there + some info regarding the hotel.

* Common synced databases - some general info regarding the platform and hotels. Preferably not too large (IIRC there's no limit to attachments with 3.x, but it sounds risky). Anything too large we'd do online or use data provided with the application.

* A large booking database which isn't synced and must be modified online with a REST call - we don't have to allow every action offline. This obviously needs the online component for making sure bookings don't conflict. Could even be a regular relational database. (Something like allowing a provisional offline reservation to the user database followed by a possible rejection on the server when syncing is doable, but I'm don't think there's much value to the user here).

It sounds very doable, rather similar to a project I was involved with, but I miss SQL a lot with that platform. A sqlite-based approach is an interesting alternative.

Re:Skip the API, Ship Your Database by throwaway290 on Thursday September 14, 2023 @02:25AM (#37505627)
You did not read the use case. It's not equivalent of Booking. More like equivalent of Wix for hotels.
Re:Skip the API, Ship Your Database by jokethrowaway on Thursday September 14, 2023 @12:36PM (#37511221)
Not the entire database, just your own data for your own hotel.

It doesn't sound that unreasonable.

Even if you have 3-4 hotels your data won't be significant.