Building Modern Web Applications: Understanding Backend Solutions

Python and NodeJS as back-end solutions

Kamen Zhekov
5 min readDec 16, 2022

In a previous article, we already explained the difference between front-end and back-end frameworks. If you’ve missed it, be sure to check it out before diving into what follows!

Developing a maintainable and performant web application

Python (with Flask or FastAPI) and NodeJS are both great back-end solutions for building modern web applications. But which of the two should you use? In this blog, we explain their most important traits, allowing you to choose what is best for your project and team.

Purely from a developer and architect’s perspective, going for a front-end framework in combination with a well-built, separate back-end API is a no-brainer. Since logic of the program is properly segmented between front-end and back-end, and responsibility is well-divided, the development, the maintenance and adding new features to the application becomes way easier, more maintainable and encourages a good collaboration between team members working on the project.

It also comes with the (huge) advantage of using solutions for what they were built — the back-end API for processing information and requests, and the front-end framework for interacting with the user!

If you have ever developed a large application using plain JavaScript or jQuery and AJAX, there is an inherent messiness that comes with such a scale in that context. Using front-end frameworks keeps your code structured and clean on the front-end side and speeds up your application development, given that you are familiar with the framework you are using.

Since, React or VueJS or any front-end framework requires a RESTful API to interact with in order to make a web application dynamic and personalised, creating the backend API with something like FastAPI or Flask if you’re Python-versed, or NodeJS if you’re a JavaScript fan, is a great way of approaching that separation of concerns we’ve talked about, and ensuring the development team is happy with the tech stack.

Then should I go for Python or NodeJS ?

The server-side or backend of an application is the very backbone of the project, and the client-side runs on it. However beautiful, performant and responsive your frontend is, the application will fall flat on its face without a robust backend to hold it up.

This leads to an inevitable choice for every architect to pick one between the two titans of backend technology — NodeJS vs Python. Choosing between those two can be a daunting task, especially not knowing what specific scenarios they are tailored for.

I would argue that, depending on the scale of the project and what team you have at hand, choosing the “ideal” backend technology is not essential. Just choose what is ideal for your development team that will encourage collaboration, maintainability, code quality and speed of development. If you have a great Python team, leverage their skills by making them build the backend in combination with a frontend framework or a templating engine (such as Jinja2) if the frontend is simple enough! However, if you have a team of great full stack developers, leverage their experience and knowledge of JavaScript and have a unified code stack with NodeJS.

But if you are still considering both options and want to choose what is best for your project, then below are some of the things Python is great at, and some that NodeJS is great at.

Python

Python is good for business apps, complex backend logic, big data, ML and AI applications.
  • Python is a tried and tested programming language that has existed for a long time. It has been heavily optimised in the last few years and is now in a very good spot performance-wise
  • Inherent code clarity makes for an easily maintainable codebase and facilitates collaboration between team members
  • Debugging is simpler than in JavaScript, further encouraging productivity
  • Tons of existing libraries, integrations, and well-written documentation to supplement backend functionality without reinventing the wheel
  • It is THE programming language for Big Data, Machine Learning, AI and many research-based or scientific processing tasks that would be harder to implement using JS
  • Some backend solutions like FastAPI come with cloud-native solutions like Jina

NodeJS

NodeJS is good for interaction-heavy apps, when there is a lot of input and output, and when there is data streaming necessary.
  • A unified stack project is usually a good idea if you have experienced developers in the stack you are targeting. A Python-only web application has drawbacks and doesn’t scale well without a lot of hand-crafted optimisations. So if you’re going for a single stack, a JavaScript frontend framework + NodeJS is the better choice
  • While code maintainability can be an issue for larger-scale projects, smaller projects or proof-of-concepts can be developed faster than with Python
  • It is inherently event-driven and has a non-blocking I/O model which makes it an ideal option for developing for data-streaming real-time applications such as messaging applications or snappy e-commerce websites
  • NodeJS handles input and output streams more gracefully than Python, and is great at displaying and reacting to streams of data
  • When dealing with a lot of user interactions and “snappy” or near-instantaneous responses from the UI are desirable, NodeJS is a better bet than Python

Conclusion

You now understand the not-so-subtle differences between backend and frontend frameworks. One of the important choices you need to make when designing the architecture of a web app or a website is what technologies to use to create it.

Python offers an amazing solution for backend services built on a mature programming language. Using it as a full-stack, Python-only, solution with templating is nonetheless restrictive. Leveraging Python through FastAPI or Flask for example as a backend web-server and combining it with a frontend framework such as React JS or Vue JS is a very good option for building a modern web application.

It comes with all the necessary tools for building great applications that need to leverage machine learning, AI, data analysis and is overall a great choice if you need to take into account complex business rules that are applied to backend logic.

NodeJS is also fantastic and getting better by the day. It uses an event-driven, non-blocking I/O model which makes it an ideal option for developing for data-intensive real-time applications.

In general, it offers greater performance and speed than Python-based apps, but implementing complex business logic is harder than in Python.

It is an ideal solution for developing messaging or chatting applications, or any sort of data-streaming applications. It is also great for e-commerce apps and websites that depend on the speed of processing user requests and responding in a “snappy” manner.

--

--

Kamen Zhekov

I am a Python Engineer with experience in ML Engineering, full stack and API architectures. Currently, I am working with ACA Group's amazing Python team!