I am working on a small web app that stores user data locally using indexedDB which can be imported/exported by making use of JSON files. Since I plan on adding updates to the site, I want to know what best practices I should follow to make sure my app can allow importing of user data from older versions. It could be related to how I should define the properties of my user data object to make it future proof, or any library or tool I could implement that would make this migration process easier.

Do keep these points in mind:

  1. I am using NextJS to build this application and Dexie to manage indexedDB
  2. Without going into details, the user data file makes use of heavily nested objects and arrays and most likely won’t fit in a cookie or even in the local storage API
  3. This web app acts as a proof of concept which must only make use of the aforementioned core technologies, regardless of whether more efficient alternatives exist or not.
You are viewing a single thread.
View all comments View context
2 points

Obligatory “JSON APIs are not REST because JSON is not hypermedia”.

GraphQL is a mess too as you throw out any ability to reason about query performance and it still requires thick clients with complicated/duplicated business logic.

If you’re doing RoR anyway, then go for https://htmx.org/. It’s much, much simpler and closer to how the web was originally designed. Highly recommend this book the author wrote on the subject (also provides tutorials walking through building an app): https://hypermedia.systems/book/contents/.

permalink
report
parent
reply
1 point
*

I’ll give that a look, thanks!

Edit: This looks like a JavaScript library rather than a serious API standard.

permalink
report
parent
reply
1 point

I don’t know what you mean by an API standard, but yes, it is technically a JavaScript library. But that’s only an implementation detail and the spirit of htmx is that you write very little JavaScript. Javascript is simply used to extend the HTML standard to support the full concept of hypermedia for interactive applications. An htmx-driven application embraces hypertext as the engine of application state, rather than the common thick client SPAs hitting data APIs. In such a model, clients are truly thin clients and very little logic of their own. Instead, view logic is driven by the server. It has been around for quite a long time and is very mature.

It’s fundamentally different than most JavaScript libraries out there, which are focused on thick clients by and large.

permalink
report
parent
reply
1 point

I’m discussing APIs that can be consumed by others, not something for my frontend to use.

My frontend uses Hotwire — I’m not using GraphQL as some Node.js guy writing the entire frontend in JavaScript.

I think you’re discussing PWA technologies where I’m trying to talk about web APIs.

permalink
report
parent
reply
2 points

HTMX is great by I don’t think it’s what OP needs since the input and desired output is not hypermedia in the first place.

permalink
report
parent
reply
2 points

I was replying to someone talking about GraphQL and Ruby on rails, not the OP of this post.

permalink
report
parent
reply
1 point

No but you are misunderstanding me — I’m talking about a web API for others to consume, not using GraphQL in the frontend of a website.

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 3.8K

    Monthly active users

  • 1.8K

    Posts

  • 29K

    Comments