I’ve been writing software for nearly 20 years now. When I started I was just goofing around with batch files on windows. One day I installed the LAMP (Linux, Apache, MySQL and PHP) stack and I was on my way to writing websites. I wanted to make a forum back in the day, figuring out how to do authentication with cookies, loading user data from from a mysql database and splitting up different parts of the page into their own files.
Fast forward to today and I’ve been writing React apps for 9 years. It felt so amazing having the server render JSON, it makes the server so simple, pull the data from the database and have some paginated JSON. I used to run little benchmarks and be amazed by the super high requests per second. Once the backend glue code is done I can focus all my time on the frontend, all the application needs to do is load the initial bundle JS and some minified CSS - so slick. Each component can asynchronously pull the data it needs, display a spinner or skeleton, it feels so interactive to use. It felt good for a long time to do this busy work, I’d be writing so much code to do this DB -> JSON -> React Component -> DOM dance.
However as time goes on I see how much more work it is to develop this way. And for what reward? a bunch of janky skeletons? Pages that navigate and don’t scroll back to the top? Sometimes I do wonder if this split of front and backend was done to duplicate work and extract more money out of silicon valley investors. It’s such a monumental waste of time and energy, not only is it more code, to do a feature you need two teams to collaborate, backend goes off to make the API, and frontend makes the UI. However frontend is always at the mercy of backend to do the final testing before it can be shipped, and this only gets worse if you need a third team to make an infrastructure change. You end up doing this dance for forms too, I remember how quickly I could write a form with PHP 20 years ago and how much longer it takes today. I now envy the people that are writing forms in PHP and other server side rendered technologies. Occasionally I’ll come across a React app that could easily have just been HTML and CSS and wonder if I would have done the same. On the odd occasion I’ll load up facebook on my computer and it’s honestly the slowest buggiest website that I use, and these guys should be the best in the biz.
Recently I’ve been enlightened by HTMX. For my a job I work on a react app that’s quite dynamic, real time audio coming in, components changing based on the state of the session, information popping up conditionally. I’ve started to dismantle the application in my head and consider whether it’s possible to build it server side with some HTMX sprinkled here and there. To me I don’t see anything that would be hard to do with that model and everything would be way easier to build and maintain. Getting rid of the frontend build tools, dependencies and separate code base would be such a productivity boost.
I feel like I’ve basically gone full circle, I want to develop software with the same architecture that I started with. A database with server side rendering. Everything lives in one code base. There’s no context switching between ‘frontend’ and ‘backend’ code. There’s no frontend caching to prevent refetching of frequently used data. I want to embrace more of the grug brained developer principles.