Building textlog without JavaScript
When the author began developing textlog, they imposed a rule: no JavaScript in the browser. This meant the entire experience should be built using plain HTML and CSS. Interestingly, textlog is still a React app, but React never reaches the browser. Instead, a server renders the HTML and sends it to the client. The author found this approach fascinating and wanted to see how much of a modern web application could be built this way.
As the project progressed, the JavaScript-free constraint started influencing many decisions. The author realized how capable HTML already is. For interactions, instead of writing state and event handlers, they looked at what the browser could do natively. Links navigate, forms change data, URLs hold state, and radio buttons function as radio buttons.
Details open and close, and inputs validate themselves. Even a poll, which doesn't require JavaScript, can be a form with radio buttons. The filter for a feed can be part of the URL. Pagination is just links. Following someone is a form submission, and editing a post is another form.
The author acknowledges that initially, they thought certain interactions would be difficult without JavaScript, but soon realized that the HTML solution was perfectly fine. The challenge lay in changing their thought process. Instead of asking, "How can I recreate this SPA interaction without JavaScript?" they asked, "What would the web version of this interaction look like?"
This led to using forms for submission, redirecting for new state, and using the URL for filters. These changes made URLs meaningful again, allowing them to be copied, bookmarked, opened in new tabs, and allowing normal browser behavior like back and forward navigation. Refreshing a page became a safe operation without risking lost client state.
This constraint also shaped the personality of textlog, aiming to be a quiet place with no likes or reactions. The author questioned the need for certain interactions, such as popups, live updates, floating menus, or animations. They started considering if immediate notifications were necessary. The lack of JavaScript became an integral part of the design, rather than a workaround.
While the author wouldn't build everything this way, textlog has made them question the overuse of client-side applications for tasks that can be done more simply with standard web technologies.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.