Blogs


The web app architecture: Backend

 July 13, 2021, 03:43 PM

 7 min read

web
application
architecture
backend
django
flask
nodejs
php
laravel
ruby

In my previous blog I wrote about the frontend world of a webpage. Today, I will write about the backend, why and when it is used and how is it implemented.


Backend

In broader terms, backend is essentially the part of any application which the end user or client can not or does not directly access. In a web application, backend refers to the server side aspect since the code or the "application" itself is not accessible by the end user. It is consisted of but not limited to database integration, user authentication, cloud storage, cloud functions, microservices, security protocols, and many more. It is responsible for more of the logic aspect of a web application rather than visual, layout, and interactivity.

Before we move on, one thing I should note is that in the contemporary world of web development, the line distinguishing backend from frontend is slightly blur. This is because of the prominent development of javascript outside of the browser (which I have covered in my other blogs) thanks to nodejs. Therefore, even though I will mention some conventional practices for backend development, it is imperative to understand them in order to build a solid foundation for server side web development.


When should backend be used? Is it necessary at all?

As mentioned, the backend is responsible for more complex aspects like database handling, authentication etc. Therefore you must understand that backend is not required for all types of web applications. Websites that simply display the work, project or portfolio of a person or a company often tend to be static with no need for backend application. Since no database or authentication is not required, the need for a backend server can also be "disregarded". However, if the website provides intricate features like searching databases for blogs (this very website as a matter of fact) or any product, user authentication etc, then a backend is undoubtedly required. Since the core of these features, like databases and authentication, cannot be compromised by releasing it to the frontend code, it is implemented in the backend. The usage of a backend also enables to divide the workload by having two separate teams working on each end of the application.

Note: In the aforementioned example, I have mentioned that a backend server is not required for static pages. This is not entirely true. You will still need a server to host the static HTML, CSS, and javascript files of the website and serve it to the public domain. In such cases, a complex backend can also be used to serve the static files. It is not so that a backend server is only compatible with highly functioning prominent features.


How is it connected to frontend

There are many ways to connect a backend to a frontend but the primary way to do it in the industry as of right now is to have a standalone frontend and connect it to the backend using APIs, a topic which I have covered in this blog. Essentially, API is a medium or channel through which a frontend can use to establish a connection and communicate information with the backend.

Almost every programming language can be used to set up a server, listen to a port and serve as a backend. Hence I will only talk about some of the notable backend languages and frameworks commonly used in the industry.


  • PHP

    PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994 (wikipedia). Personally, my very first backend experience was with PHP. It is not exactly easy to set up since you will need to set up an apache server, run some configurations, and set up a MySQL server as well (which is a topic for another time). The very basic version of PHP is also not that secure since the backend and frontend code is in the same .php file. However, once you have the environment and boilerplate set up, the development moving forward for slightly simple projects is quite easing. Which is why it is by far the most used in the world wide web, not exactly popular. Because of WordPress, almost 70%+ amateur websites are run on PHP.

PHP itself is not that "good" or "popular", but laravel on the other hand, which is a free, open-source PHP web framework is quite well received. It follows a model-view-controller architectural pattern, which makes it more systematic and organized and is a more suited option for scaling to larger projects.

  • Django

    Django is a Python-based free and open-source web framework that follows the model–template–views architectural pattern. It is maintained by the Django Software Foundation. (Wikipedia). Django is easy to set up but it can be incredibly difficult to get started with. It serves views, which are often the frontend aspect of the website, models, which are the database structures and rules, database migrations, and many more. It is very well maintained and tested so it has plenty of patches and security. It is widely supported by a strong community. This very website is actually being run on Django 3.0. It can be very complicated and confusing for starters hence why I would not recommend this to beginners despite all the advantages that come with it. However, for companies looking forward for rapid development, Django is highly recommended.

  • Node.js and Express.js

    Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. (wikipedia). I have written about nodejs in one of my previous blogs. Essentially, nodejs allows you to run javascript code in the backend. This is incredibly helpful since frontend developers who are already fluent with javascript can now work in the backend development as well, minimizing production costs. Nodejs is also really easy to set up and use unlike some of the other languages and frameworks, which require a lot of boilerplate and environment set up.


All in all, as an aspiring backend developer yourself, you must understand that a backend is not applicable for every type of webpages. Therefore, I recommend you to get started with whatever you are even slightly familiar or comfortable with. Chances are you are most likely familiar with python as it is the most popular programming language among upcoming programmers, so you can easily get started with django. However, you might prefer simplicity over quantity, so you might even go for nodejs. I hope this blog helps you to get a very basic idea of what you might be dealing it. Goodluck!


Arafat

Mohammad Arafat Zaman

"Technophile"


Go back

Mohammad Arafat Zaman © 2024


All rights reserved