Live data from Hacker News

Don't rely on LocalStorage

blog.jacobweisz.com

1–10 of 71 posts

Re: Don't rely on LocalStorage

#3
Regarding Wordle specifically, this allowed Josh Wardle to make the app a simple webpage with no backend necessary beyond serving the page itself. Is there something that allows someone like him to do that aside from LocalStorage?

Re: Don't rely on LocalStorage

#4
The author makes some decent points about localStorage generally, but I think really misses the point on what makes Wordle so successful and endearing. It was built as a side project for a very small audience and just happened to have massive, organic growth. If Josh Wardle had thought about all of these described use cases in advance, there's a much higher chance that it never would have gotten off the ground as a side project. Additionally, the massive growth would have presented much harder (or at least much more expensive) scaling challenges, whereas with it being entirely client-side it is much easier and cheaper to scale to millions of users.

Re: Don't rely on LocalStorage

#5
I can't agree with this take. It's not lazy, it's a set of tradeoffs that didn't land the way OP would prefer, but that doesn't make it universally wrong.

Re: Don't rely on LocalStorage

#7

How can they migrate it to server without requiring login? The best part is that you don't need to create any user for playing. Accessing data between devices requires some form of auth.

Many auth providers allow anonymous auth, which creates a UID that can be used to store and secure data. Only later the customer can link that account with another identity provider (e.g. socail, email/password). This gives the low-friction benefits of local storage and the flexibility of cloud storage.

Re: Don't rely on LocalStorage

#8

How can they migrate it to server without requiring login? The best part is that you don't need to create any user for playing. Accessing data between devices requires some form of auth.

I would assume almost all daily users of Wordle would consider having to have an account in exchange for persistent, cross-device statistics a worthy trade-off. And presumably a well-designed app could even abuse LocalStorage for anonymous play, and include a mechanism to hand off and save your data, should you wish to, via a login.

Social OAuth and passwordless email login (essentially one-time codes) are both pretty low-effort ways of managing auth without storing a lot of sensitive data or having to manage passwords.

Re: Don't rely on LocalStorage

#9
> LocalStorage is popular for web apps because it is lazy

No... localStorage is popular because it allows you to persist state without requiring a server, opening up a whole lot of use cases that would normally require a login. With the tradeoff that you can't easily sync between machines and it can be cleared readily.

Calling it "lazy" seems bit unnecessarily confrontational. Of all the times I have used localStorage on my apps I can't say the reason was even once "laziness."

With that said, it would be nice to keep stats across instances on multiple devices. It adds either a lot of complicated edge cases or a lot of server calls (or both), though and it would need login or some other way to tell the server that Device A and Device B are the same person.

You also lose offline play.

A Progressive Web App would be nice. The best of both worlds. But guess what PWAs often use... localStorage, which I guess is lazy ;)

But I for one think an app that doesn't constantly send my every move to the server is actually a breath of fresh air.

Edit: fixed typo

Re: Don't rely on LocalStorage

#10

How can they migrate it to server without requiring login? The best part is that you don't need to create any user for playing. Accessing data between devices requires some form of auth.

I would assume almost all daily users of Wordle would consider having to have an account in exchange for persistent, cross-device statistics a worthy trade-off. And presumably a well-designed app could even abuse LocalStorage for anonymous play, and include a mechanism to hand off and save your data, should you wish to, via a login. Social OAuth and passwordless email login (essentially one-time codes) are both prett…

Are those statistics actually interesting to many users? I barely noticed the move to NYTimes because I'm mostly just interested in playing the game once a day, sometimes sharing the result.
Post reply on HN