Hacker News new | past | comments | ask | show | jobs | submit login

The complexity of frontend development now makes me want to return to a “back to basics” approach. I just want a server side rendered platform, serving templated html pages to the client, with minimal JS for interactivity. Most projects don’t really require more than this, and the level of unnecessary complexity that has developed over the whole stack, from devops to backend to frontend, is staggering and obviously more a social artefact than a technical necessity.



You might be interested in Astro (https://astro.build/), I've build my first project with it, and it's great to somewhat go back to basics, but without needing to set up my own server with templating and tasks for static assets, etc...


upvoting astro :)

some basics and nothing else to start. then you can go as deep as you want down the rabbit hole :)

but it's completely on you


+1, Astro is absolute magic


As the number of replies to a React article rises, the chance of a subthread bemoaning SPAs increases to 1


TBF, React isn't exclusively for SPAs. I use it in my MPA.


If you need minimal js, there's no need to use frameworks. I don't understand why we came to think the opposite, but you absolutely don't need state managing, effects and a build chain if your goal is to merely show some content on the web.

If you need to write a web application, on the other hand, you absolutely need all these things, because your mutable state will become a mess after a short while, your event handlers will call your components in a thousand tangled ways and you will want to navigate your code and your types using your IDE. But, again, if you just want to show content with minimal javascript, you don't need to worry about that. Leave all that stuff to web application developers, instead of looking at that stuff, concluding it's too complex for you and ranting against it on the Internet. It's not made to solve your problem.


The problem is not that the tools exist, or that complexity exists. The problem is that the community view, enforced by various incentives and supported by the creators of these tools, creates a situation where technology choices are driven by what sounds good or is trendy rather than solving the problem at hand in the most effective way.

Technology choices are institutional decisions. They are reached largely via defensibility to non-technologists, to whom (and indeed to most technologists) boils down to appeals to authority rather than to reason.

Nobody is trying to stop this, and indeed many are trying to increase it so they can sell products with more features that virtually none of their customers need.

Blogs, influencers and educational platforms push what is new so that they have more content.

All of this is self reinforcing and we suffer because of it.


> I don't understand why we came to think the opposite

The DOM is scary.


Children learned how to use it in the 90s from basic web tutorials and reading source code, it isn't that scary.

The real reason is that the web started to become serious business, and that meant javascript had to become a serious language, which led to all of the nonsense it accreted over the years from startups and enterprise. Everyone uses frameworks and compilers and a package manager because a serious language uses frameworks and compilers and a package manager, and all of these look good on a resume.


Have you tried to write a really complex web app without router, state manager, type completion and declarative DOM? And no bundling, so you have tens of <script> tags in the right dependency order to support older browsers? It becomes quite fragile very soon.

But the good news is: you can do without all this. You can manipulate your mutable DOM manually, send and receive messages via native DOM events and mutate your state inside a big vanilla object. You can do without tooling, just Notepad or Vi and a browser. You don't even have to need type completion. You don't even need const or Promise, you can use var and callbacks, everything is still there. If you think tooling is startup-fueled scam (and probably some of it is), there's literally nobody in the world to force you use tooling. The web is entirely backwards compatible, you can do whatever you think is best!


>Have you tried to write a really complex web app without router, state manager, type completion and declarative DOM?

No, but only because I used other backend languages and frameworks for that, because there are much better languages suited to those tasks than JS. Especially in the browser. SPAs exist to serve a specific business case, they aren't qualitatively better than what came before.

>And no bundling, so you have tens of <script> tags in the right dependency order to support older browsers? It becomes quite fragile very soon.

Or just use JQuery and some modules.

You make it seem way more complicated than it was, it was never that complicated. It was never nearly as complicated as the current JS ecosystem. Talking about "tens of scripts" when the current status quo is a brittle dependency tree of hundreds, if not thousands, of scripts for even the simplest task is silly.

>The web is entirely backwards compatible, you can do whatever you think is best!

Yes. This is technically true, but unfortunately tech culture has years of ingrained social pressure leading people to believe javascript is a dangerous language that they don't dare approach without ten layers of abstraction protecting them, and the nonexistent business value in doing so, because the ecosystem is dominated by capitalists. The fact that "vanilla js" even exists as a term demonstrates how pernicious this fear has become - there is no "vanilla x" any other language. Only javascript needs a special term for just using the language because of the deep cultural taboo against doing so.


> No, but only because I used other backend languages and frameworks for that, because there are much better languages suited to those tasks than JS.

Good luck writing highly interactive apps backend-only! (Like Figma or Google Docs). Even with frameworks like Phoenix and runtimes like WebAssembly, you still need a lot of Javascript to get there.

> Or just use JQuery and some modules

This is incredibly ignorant :) jQuery solves maybe 10% of the problems I listed, and does that imperatively, so you get in the exact same issues, but with a marginally better interface to the DOM. Which is not even true nowadays, as the js DOM interface got a lot better.

> The fact that "vanilla js" even exists as a term demonstrates how pernicious this fear has become - there is no "vanilla x" any other language.

Wait, do you normally write Java with no frameworks? Handle request / responses / queues / threads from scratch?


>Good luck writing highly interactive apps backend-only! (Like Figma or Google Docs). Even with frameworks like Phoenix and runtimes like WebAssembly, you still need a lot of Javascript to get there.

That's exactly the point. 99% of websites don't need to be "highly interactive apps" like Figma or Google Docs. The modern JS pipeline and ecosystem exists for those applications, as it was developed by Facebook, Google and the like, but it's far more complex than most people actually need. The baseline for web development shouldn't be "install NPM and node and n frameworks, learn test suits a,b,c and this completely different language."

>jQuery solves maybe 10% of the problems I listed, and does that imperatively, so you get in the exact same issues, but with a marginally better interface to the DOM. Which is not even true nowadays, as the js DOM interface got a lot better.

I was specifically making a comparison between using JQuery and script tags versus NPM dependencies, but JQuery still solves far more than 10% of the problems most people actually have. Because again, most websites aren't startups trying to optimize to compete against FAANG.

>Wait, do you normally write Java with no frameworks? Handle request / responses / queues / threads from scratch?

I think you're being purposely obtuse here.

People write Java frameworks in Java. It's still programming in Java. You're still expected to understand the Java language to use Java frameworks.

Javascript is primarily compiled from other languages which use their own idioms, often imitating far more strictly typed languages. JS devs are primarily people who hate javascript and wish they were using another language, and much of the unnecessary complexity of the modern JS ecosystem exists to capture the labor market by catering to that desire.

Which is why "vanilla js" is a phenomenon unique to Javascript. Other ecosystems don't have the same culture of alienation and aversion to actually using their language.


> That's exactly the point. 99% of websites don't need to be "highly interactive apps" like Figma or Google Docs.

That's what I said n comments ago. If you don't need a highly interactive app, you can do with HTML and CSS only.

> People write Java frameworks in Java. It's still programming in Java. You're still expected to understand the Java language to use Java frameworks.

I hate to break it to you, but React is 100% written in javascript and you interact with it writing javascript. It's a library, not even a framework.


> 99% of websites don't need to be "highly interactive apps" like Figma or Google Docs.

That's highly conservative; of all the react apps I have come across professionally exactly zero needed React.


Anecdote for anectode, the majority of React apps I encountered needed React (or something equivalent). Lots of web replacements for corporate native applications, which of course are complex, highly interactive beasts with a lot of state and a lot of logic on the client (with the server being glorified CRUD)


> Javascript is primarily compiled from other languages which use their own idioms, often imitating far more strictly typed languages.

I'm not sure which languages are you referring to. Typescript? It's Javascript with types (minus enums, which are discouraged). Elm, Purescript, Clojurescript, Gleam? Great languages, but they represent a tiny fraction of the real world fronted applications

> JS devs are primarily people who hate javascript

Modern javascript? Are you sure you're not projecting the fact that you hate it?


By "modern javascript" I refer to both the language and the ecosystem of Node, NPM, Typescript, and related technologies that have become so ubiquitous as to be inseparable from the language to most people. I don't hate javascript, I'm not one of those "javascript delenda est[0]" people who go off on rants about the language whenever it comes up. However, I don't like what the language and ecosystem have turned into, and I don't like many of the incentives that brought those changes about. What used to be a community driven ecosystem has been captured by VC and corporate interests.

Admittedly, I also don't like a lot of the more recent features added to the language like classes and templates, because I'd prefer javascript remain simple and avoid feature creep.

[0]https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...


> ”Good luck writing highly interactive apps backend-only! (Like Figma or Google Docs). Even with frameworks like Phoenix and runtimes like WebAssembly, you still need a lot of Javascript to get there.”

You really don’t need to write JS directly to make a UI like Google Docs with Phoenix LiveView. You can write the whole thing in Elixir. Thanks LiveView.JS, there hasn’t been a need to write custom JS or hooks to avoid a round trip to the server for UI-only interactions for quite a while, either.


Isn't it a small subset of commands to interact with the DOM though? What if you need to write on canvas, spawn a thread or set up an observer?


For a canvas-based app, which to be fair none of my professional work has been, you’d need to write some JS or hooks to interface with external JS libraries.

Can you give me an example of when you would need a LiveView app to spawn a thread or set up an observer via JS?

Spawning a thread sounds particularly odd given that JS isn’t running on the server. Are you speaking of web workers? Or do you mean doing something from JS code to send a message to the Phoenix server to get it to spawn a process (i.e., a green thread) on the server?


Yeah, I meant web workers. It's easy to find canvas and web workers in any sufficiently complex highly interactive web app. I'm not saying you always find them, but if you're doing some form of graphics you most probably use canvas at some point, if you do non-trivial computation you spawn workers, if you need sound you use the Web Audio API, if you have a complex layout you're better off with DOM Observers, and so on...


The DOM scares the shit out of most developers. Those developers then twist themselves into knots with all kinds of nonsense to justify their aversion. Take the framework away and they panic, like stripping a person of their clothes before they are to give a big talk in front of upper management. You can call that autism, trend chasing, resume padding, cognitive conservatism, or whatever. The result is the same.

Whether or not writing to the DOM directly is easy is entirely beside the point. Their professional existence is tied to an unnecessary process and removing that process leaves them embarrassed, exposed, and extremely insecure.


It is, and, worse, it's mutable. But nobody needs to manipulate it just to put some content on the Web.


Yes. 80% of a modern frontend developer is just putting text on screen. All the steps and frameworks involved just tend to be resume padding.

That’s unfortunate because back in the day when I started doing this work frontend developers were expected to do more than this.


I really like React as a server-side templating language.


Same. I replaced handlebars with server-side generated JSX (not Next or anything like that, just renderToStaticMarkup) and it’s an infinitely better dev experience than any other templating language I’ve used before (hbs, jinja, django…).

I’m getting more and more jaded about React and would rather stick with server side rendered html, but I’d definitely stick with JSX at least.


I don't like JSX but I enjoy how React/Svelte/Vue/etc do code colocation and composition compared to traditional templating systems with partials etc.

I've found dotnet with Razor and Blazor to be the exact SSR experience I was looking for. And the performance vs JS is so much better. I did a benchmark recently and got about 7x improvement.


Thats what I switched for all personal projects: Go + a-h/templ + htmx


If that's all you need then React was never the right solution. What makes you realise this now?

If you're used to React/JSX you'll hate templates, though. Look for a HTML component rendering library instead.


He's hardly alone in this, half the SPAs I see could have been pure HTML/CSS.


I disagree with hating templates. I am used to both, I find templates are much easier to deal with depending on the templating language.


So, like using vue/alpine with a script tag?


Honestly, that why I use Blazor. It just keeps simple.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: