← Back to Articles

Why you need a frontend framework

Featured Image

This is mainly targeted at backend devs who insist on ditching frontend frameworks and writing the frontend code in raw html/cs//js. I believe that modern frontend frameworks like Nuxt can help improve auditability, maintainability, and security in the long run. It will also help with attracting more contributors to the project from the frontend / designer community. Believe me, nobody wants to work with raw HTML, bootstrap in 2024 (I mean frontend devs). To frontend devs it sounds like wanting to write it in assembly.

Attracting frontend talent

By using modern frontend frameworks, we can attract more frontend developers to the project. Like I said, no frontend dev wants to work with raw HTML and Bootstrap in 2024. If the frontend part is tightly coupled with backend then no frontend dev will want to touch that. There are many talented frontend developers out there who can contribute AND maintain the frontend part of the project. The frontend community is one of the largest. It also hugely contributes to developer happiness, it is a joy to work with modern frameworks. Why alienate the frontend community?

Auditability

I agree that not everyone will be able to understand the frontend code. But not everyone will be able to understand Python either. Does that mean we should write in assembly? We need to think long-term about the project. As the project grows and gets larger, not everyone will be able to understand every language, every tool, every framework used in the project. If the project attracts frontend developers, they will be able to audit and maintain it. And we can (and should) always write good documentation to help with that.

Best Practices

Working with raw HTML, JavaScript, Bootstrap, jQuery is no fun (ask any frontend dev). It’s error prone, hard to maintain, and doesn’t follow best practices. Without TypeScript it is very difficult to read the code because you don’t know what type of data you are working with. Without Tailwind it is very difficult to work with and maintain the CSS in the long run. Frontend frameworks introduce structure and best practices that make the codebase easier to understand and maintain. How is one ball of html/css/js mess more maintainable than a well structured, strongly typed, modular codebase with good architecture following best programming practices (SOLID, DRY etc.?) You will end up creating your own framework anyway, so why not use a well established, documented and supported one?

Maintainability

If we go with a proper framework, the project will actually be more maintainable. I have fallen into this trap multiple times in the past myself. I have started projects with just raw html/js thinking it will be enough and quickly realized that my code was getting out of hand and impossible to maintain. I wasn’t able to understand my own code anymore. That is the whole reason why frameworks exist – they make the project maintainable in the long run (and they are a joy to work with). If you need some common components – you can easily grab a component lib that has everything you need. No need to reinvent the wheel.

Also, consider the speed of development. Modern frontend frameworks have HMR (hot module replacement). As soon as you make one change in your source code, the result is immediately reflected in the browser. You see your changes on the screen immediately instead of having to rebuild / refresh / restart anything. If you need some functionality – just install a module and you’re done. To implement the same things from scratch takes much more time and effort. A frontend dev with proper tooling can move 10x faster. Why wouldn’t we want that?

Security

The npm ecosystem has matured a lot since the early days and has tools to audit packages for security vulnerabilities so I don’t think this is much of a concern. Also all frontend code runs in a sandboxed environment so there is no real risk for the end user.

Conclusion

I can imagine in the early days when high-level languages like C, C++, Python started to appear people probably wanted to keep writing in assembly to keep the code simple and easy to understand. But nowadays nobody writes in assembly anymore because it is not maintainable. People have realized that high-level languages and frameworks are the way to go. Nobody creates raw PHP apps today, instead everyone uses frameworks like Laravel, Symfony etc. I think the same applies to frontend development. We should use modern frontend frameworks to make the project maintainable and attractive to frontend developers.

Listen to Deep Dive

Download