Top
Best
New

Posted by thm 2 days ago

URLs are state containers(alfy.blog)
490 points | 211 commentspage 6
alansaber 2 days ago|
This is something you learn to appreciate when you do web scraping. I do overlook it for frontend webdev though
jwpapi 2 days ago||
As an application developer I think this is very good advice and I wish I wouldve be more strict about it earlier.
jcparkyn 2 days ago||
One of my previous side projects used this idea in the extreme: It's a two-player online word game (scrabble with some twists) but all the state is stored in the URL so it doesn't need a backend.

https://scrobburl.com/ https://github.com/Jcparkyn/scrobburl

simonhamp 2 days ago||
React kid discovers the web
game_the0ry 2 days ago|
Holding the snark aside for second, I think there is some harsh truth here.

Url query params are not popular in the front end developer world for some reason, probably bc the fundamentals of web dev are often skipped in favor of learning leetcode and all the react hooks. Same could be sade for SQL and CSS.

I also don't think its a good look that the author is a CTO and is just discovering how useful url query params are. that being said, its a pretty good and well-written blog post.

simonhamp 2 days ago||
No snark. Genuinely happy. This is progress
yubblegum 2 days ago||
Sure and file names are state & attribute containers too. A URL is a uniform resource locator. You can hack it, of course, but this is no less kludgy than overloading filename. It is never ceases to amaze me seeing the recylcing of good and bad idea in this field.
croes 2 days ago|
Urls have extra parts like the parameters to store that data. It’s not a hack
zkmon 2 days ago||
You are either changing the meaning of "state", or probably unaware of what it means. To start with, state of what? app (http server) or the http client?
yoavm 2 days ago|
I think the author is referring to the state of the form.
zkmon 2 days ago||
State of the form is it's data.
jongjong 1 day ago||
I loke to keep state in the URL. It's nive when you can bookmark any section in an app and it brings you back to the exact same place, all the menus exactly the same. Also it's amazing for debugging. Any bug, I tell the user to send me the URL. I reproduce the issue instantly, fixed in 5 minutes. I wrote some very complex frontends without any tests thanks to this approach... Also it's great during development; when I make a change anywhere in the app, I just refreshed the page... I never have to click through menus to get back to the part of the code I want to test. Really brings down my iteration time... Also I use Vanilla JavaScript Web Components so I don't have to wait for transpiler or bundler. Then I use Claude Code. It's crazy how fast I can code these days when it's my own project.
zkmon 2 days ago||
Not quite. As the L in URL says, it is the locator or address of the state. The S in REST implies the same, indicating states as the content, not path to it.
Scarblac 2 days ago||
But from the viewpoint of a web app where you navigate between different (versions of) pages, the state of that app can be the address of the currently displayed page.
zkmon 2 days ago||
It's the state of your browser, not the app. App could be serving different pages to different clients at the same time.
layer8 2 days ago||
State is just your location in state space.
zkmon 2 days ago||
An address book is not "state space". The country, land and things are the state.
layer8 2 days ago||
Not every location represents a state, but every state can be considered a location.

If you want to argue against the use of URLs to represent state, I would concentrate on the “R” (resource) aspect.

zkmon 2 days ago||
I think you are talking about client's navigational state. The original title of this post was "app state ...". Still it is not clear about state of what.

Navigational state need not be confused with app state. Also talking about "state" as in "state machine" etc used to sound pretty academic with obscure meaning of the word "state". When someone says "state machine" they are basically saying "I'm a PhD and you are not". There are simpler and more crisp ways to convey things rather than via obscurity.

layer8 1 day ago||
My point was a linguistic-conceptual one, that a location fully describing a state is not a contradiction in terms, and hence it’s not necessarily a misuse of the “URL” concept regarding the “locator” aspect. Navigational versus application state is irrelevant to that argument.
sixhobbits 2 days ago||
More good content with a bunch of GPT noise added, obvious from patterns like

No database. No cookies. No localStorage

Themes chosen. Languages selected. Plugins enabled.

Which have the pattern of rhetoric but no substance. Clearly the author put significant effort it so why get an LLM to add noise?

ahmadalfy 2 days ago||
Hello, I am the author of the article and I can explain a few things.

First of all thank you for your words about the content.

I get why you might feel that way. English isn’t my first language, so I sometimes use GPT to help me polish phrasing or find a smoother rhythm for certain lines.

But the ideas, structure, and all the writing direction are mine. I don’t ask it to write articles for me. It just help me express things more clearly. I treat it more like an editor than a writer.

tliltocatl 2 days ago||
Is it really an LMM? It's not like real humans can't write the same style, LLMs have picked up on an existing stylistic tendency. I hate these patterns as much as anyone, and I have noticed them since long before transformers were a thing.
alex_duf 2 days ago|
Any blob of byte is a state container
More comments...