Web technologies are growing so fast that we now have tons of modern tools and frameworks. Be it a choice of frontend, backend or database. Many developers have this big question - Which tech stack I should begin with?🤔
Sometimes we end up choosing the one we worked on before or language we are comfortable in. As human nature, we always stick to our comfort zone and that's where things start going wrong. This may include choosing a framework being overkill. Or, even worse, we pivot from our existing tech stack in the middle of a project and end up re-writing the code in a different language.🤦♂️
So, it's important to choose the right tech stack before starting a new project. With this post, I will help you with a thought process so that you could choose the best tech stack.
1. Getting the content
This is a three-part series. In this post, I will talk about various backend technologies such as Node.js, Java - Spring, Laravel - PHP and Python - Django. We will compare them on different aspects such as reliability, scalability, performance, security, developer's experience and most importantly cost of hosting. In the later posts, we will compare different frontend technologies and various databases. So, let's get going!
2. What is a backend?
In a nutshell, the backend has the code which runs on the server-side and is responsible for handling and managing storage, database and other resources. The backend is also called the data access layer of software.
One should always start with choosing the right backend. Because it acts as the backbone of your application. We have so many alternatives out there, we will cover some popular backend frameworks in this article and will see which one is appropriate for a given scenario.
3. Node.js
Node.js uses asynchronous programming! Meaning, it is non-blocking. In other words, It does not wait for a resource to finish the job. It is immediately ready to take up the next request and gives a callback when it's done. Node.js runs like a rocket and it is very scalable.
When to use Node.js?
When your application is highly event-driven and performs lots of I/O operations. Also, when you have to make various API calls from the backend itself. Here in this scenario, you can leverage its non-blocking feature.
When NOT to use Node.js?
When you have a heavy algorithm or a job that consumes lots of CPU cycles. Because Node.js runs on a single thread just like client-side js, your application will be very inefficient for CPU intensive jobs.
4. Java - Spring Boot
Spring is a powerful, lightweight, and most popular framework which makes Java quicker, easier and safer to use. Spring boot helps you to build production-ready Spring-based applications. It serves 80% of everyone's needs for a modern web application. It is highly useful for creating stand-alone, production-grade applications with minimum effort.
When to use Spring Boot?
When your primary focus is security, maybe you want to write banking or financial applications. Where you cannot compromise with security, Spring boot will be the best option. As Java supports multithreading out of the box, it becomes a great choice for building complex and highly concurrent web applications.
When NOT to use Spring Boot?
Although, there are no limitations to the spring framework, it can serve all your needs. But, sometimes trivial apps which do not need heavy computation, spring as a backend will be an overkill. The only thing for saying no to Spring boot is that it's a bit complex and requires a lot of expertise.
5. PHP - Laravel
PHP is an old friend who introduced me to web development.🥺
Laravel is an open-source PHP framework. It follows an MVC (Model-View-Controller) architecture. Laravel makes life easier as it has so many developer-friendly features, one of them is query builder or ORM (Object-Relational Mapping). Before Laravel, it seemed like PHP is dying but now it is one of the competitive frameworks.
When to use Laravel?
When the time to market is the key, then Laravel is the best choice. Because it has so many salient features that make web development very fast as compared to other frameworks out there. Also, Laravel can be hosted on a shared hosting thus making it cheapest amongst all, so when time and cost is the key you should go with Laravel.
When NOT to use Laravel?
PHP is not considered much secure as compared to Spring and Node.js, however, Laravel prevents some of the basic attacks such as SQL injection and cross-site scripting attacks and adds an extra layer of security to it. But still, PHP is never recommended for applications where security is a must.
6. Python - Django
Django is a fast, secure and scalable high-level Python web framework. Django encourages rapid and clean application development. It takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel.
When to use Django?
Since, Django is based on python it supports powerful machine learning libraries like PyTorch, NumPy, etc. Its computational and statistical capabilities make it the ideal platform for machine learning applications.
When NOT to use Django?
Django is not suitable for smaller projects with only a few features and requirements. Because it's a "Batteries included" framework, it has so much boilerplate code which small projects don't need. As a result, consuming unnecessary server processing time and bandwidth.
7. Conclusion
I hope you found the article insightful! We have discussed the four most popular backend frameworks and how to make the right choice.
And stay tuned for the next article of this series. In that, I will compare the most popular front-end frameworks so that you can make the right decision.
Please give your valuable feedback in the comment section, tell me what I missed about these frameworks.
Latest comments (48)
Do you know which framework DEV is using? Popular and extremely productive... DEV, GitHub, GitLab, Shopify, Codecademy, Exercism, CodePen, ... :)
The first article that says the truth about Spring, I love Java in the backend, Spring is the best but for things very big but I developed an small project based in the sales using Spring but I didn't think in the CPU... Thanks a lot... Great Article.
Glad you liked!
Fun fact: Your non-PHP code may not secured compared to well-secured PHP code.
Choosing the right framework is all about experience.
I agree :)
Just kidding, Nice article
So, in summary: Node if you want fast & simple operations, Spring if you need security, Laravel if you want a fast developement and Django if you want to add machine learning features (?)
Laravel actually has a slow deployment, I considered Laravel for cheap shared hosting, however it is recommended to host Laravel on VPS, but it he hosted on shared hosting with some patch.
Loved it. I didn't see asp.net or C#. I want to learn C# for web dev but don't know if it's worth learning. So if you can include that in this post too then it will be very helpful.
Although it's an amazing post! ❤️
Very helpful
Sure, I will do my research and try to include.
As some people mentioned in the comments, we need to talk more about ASP .NET 6 and Go. ASP is cross platform, running on Linux, and C# is getting much easier to write, I'd say it's as good as Kotlin. Go is relatively easy to write, I'd say as easy as Python, and you can get so much performance out of it. If you use Node.js, look up Fiber, an Express.js inspired framework that's among the top ranks of TechEmpower bench marks, right along with ASP .NET. We don't need to conform to using interpreted languages. We can build more powerful apps with newer languages.
That's great! I will check out ASP.net and Go surely.
Favorite part of this article 'cause 💯 relatable
Yes🥺
Call me stupid but for me ASP MVC is my go to for backends. Since most of our customers are hosting their stuff on Azure I find this approach much easier. At least the Authentication and Authorization part is a no brainer. What do you think about it and what was the reason to not include it? :)
Not stupid at all. Maybe a bit of extra effort bc of the bloat of ASP/MVC environment but functionality speaking, I'd say your in a best spot
Yes I agree! I missed this, maybe in future articles I will mention
how come no love for .net? it's one of the most performant and easy to work with backend technologies in the industry 😁
Tbh, I have no hands on .net, that's why I didn't mentioned it, maybe surely in future articles I will mention after trying on
Happy Coding!
thought as much. i have a
dotnet noob
friendly article on dev if you're interested in trying new things ;-)Thanks for sharing, I will checkout definitely.