Change language

Backend web development – a complete overview (2021)

Backend web development - a complete overview (2021)

Every website can be split up into two parts, the front end and the back end. The front end is all the visual stuff you see on the web page, and the back end is what saves and manages your data, for example, if you are on the backend would store your order history, your profile, it would load search results, and much more. In this video were going to take a look at the technologies that are used in the back end of a website and in another video we explore the front end technologies.

As an example, lets say that were on, and we do some shopping, and now were ready to make an order.

When I click place order what happens? Were going to start from the ground up.

Any computer thats connected to the internet, including your computer and my computer, can send a message across the internet to another computer, thats also connected to the internet. So to simplify things, amazon has a computer in their office building somewhere, and our computer is going to send a message containing our order to that amazon computer.

In this scenario the computer that is sending the message is called the client, and the computer that is receiving the message is called the server, but before this happens, computers they cant receive messages from the internet by default. We have to program them to be able to receive messages. To do that we need a back end programming language.

Almost every programming language has a feature that turns a computer into a server and allows it to receive messages.

Popular backend programming languages are javascript, sometimes called node.js, python, ruby, and java.

However, using a backend programming language by itself is actually really difficult, and requires a huge amount of code. So there are two tools that we use to help with this.

A back-end framework and a package manager.

A back-end framework helps us create a server much easier and with a lot less code.

Each backend programming language has a few different frameworks to choose from, but the most popular ones are express js for javascript, python django, ruby on rails, and java spring.

In the back end we also use a lot of code that other people have written, called packages, to do common tasks like doing calculations, talking to a database, and setting up user login and authentication. We typically use a lot of packages in our back end and in order to install and manage all these packages we use something called a package manager.

Each language has its own package manager, the most popular ones are npm for javascript, pip for python, bundler for ruby, and maven for java.

These are all the technologies we need to create our backend server.

The next problem we have is we need somewhere to save the data for our website. Going back to our amazon example, data could mean our user data like the login information, order history, as well as data for all the products that are being sold on amazon, the descriptions, the ratings, and the reviews.

To do this we use a database. A database helps us store and manage data, its just a piece of software that usually runs on a different computer, and we have to do some setup so that our backend can communicate with the database.

The most popular databases are mysql, postgres, and mongodb. Alright so if youre just starting out this is basically all you need for the back end.

You can build most of your projects with just a server and a database. For example, heres how our amazon scenario could work.

When the customer places an order in the front end, the front end sends a message containing the order to the back end, the backend then saves the order to a database, and sends back a message to the front end confirming that the order was created. The message at the front end sends to the back end is known as a request, and the message that the backend sends back, is known as a response.

This is called a request response cycle and this is generally how web applications work.

Heres another example, lets say that youre in the amazon warehouse. The warehouse might have a different front end that sends a request to the back end to get our order. The back end then gets our order from the database, and sends it back to the warehouse front end, and then they go ahead and prepare our order.

Now that weve seen the overall flow, were going to dive deeper and take a look at whats inside a request.

Heres a simplified example of a request to create an amazon order.

Ff we read over it we can see that its actually really easy to understand. We have the items that we ordered, the quantities, and some other information about our amazon order.

At the top we have the type of the request, the domain name, and the url path.

This describes where this request is going, and what type of request this is.

First of all amazon the company has bought the domain name, and they configured it so that any requests going to will be redirected to that server in their office building.

So thats why were sending this request to

The type and the url path identify what kind of requests this is.

So in this example this is a post request to /orders.

In the back end we use our programming language and back-end framework to define what types of requests are allowed and how we should handle these requests. For example we can allow a post slash orders request and whenever we get a post slash orders request, we will create an order using our programming language, and save it to our database. We can also allow a get slash order request and in this case we will retrieve the order history from the database, and send it back as a response. Another example is a delete slash order request where we will cancel the order. So this list of all the different types of requests that the backend allows is called an api, application programming interface. The api is one of the most important concepts in back-end programming. If you send a request that is not allowed by the api, the backend will respond with an error.

So we mentioned earlier that we can identify requests using a type and a url path. There are several types we can choose from such as post, get, put, and delete, and the url path can be anything we want.

So why in this example do we choose post slash orders? This is just a naming convention for our requests, and this naming convention is called rest. Representational state transfer.

In rest the type of request has a special mean ing, so post mean s to create something, in this case post orders mean s to create an order, get mean s to get something, and delete mean s to delete something, and so on. An api that uses the rest naming convention is called a rest api.

Rest is the most common convention that we use for our apis, but there are several other conventions that we could use.

One of them is called graphql which uses post slash graphql for all of our requests and another one is called rpc which uses post and a more detailed url path like post slash create order or post slash get order history.

So that is what a request is, what an api is, and what rest mean s. Now lets talk about infrastructure.

Nowadays, instead of companies purchasing their own computers to run their websites, they rent computers from a cloud computing company. The biggest cloud computing companies are aws, amazon web services, gcp, google cloud platform, and microsoft azure. The basic idea of cloud computing is youre renting a bunch of computers. This is also known as iaas infrastructure as a service. Behind the scenes, aws has a giant, powerful computer and inside its software its running many smaller computers and were actually renting one of these smaller computers.

And these smaller computers only exist in the software so we call them virtual machines, or vms. So to run our website, we rent a vm from aws to run our back end, and we also rent another vm to run our database.

Another problem we have to solve is what if our website gets really popular during the holiday season, and we start getting a lot of requests and internet traffic that our server cant handle? With cloud computing, we can set up multiple vms running the same back-end code, and then set up a special vm in front of these called a load balancer, and the load balancer will distribute requests evenly across our vms. Once the holiday season is over, we can just shut off our vms when we dont need them. This is a lot easier than having to buy physical computers, where if the holiday season is over you still have the physical computers that you paid for. But we still have another problem, we now have a lot of vms that we need to create and set up, and it takes a lot of time and effort.

Cloud computing companies offer another service called a paas a platform as a service.

A paas just lets us upload our backend code, it will set up all the vms including the load balancer and integrate everything for us. The three most popular paas are elastic bean stalk for aws, app engine for gcp, and app service for microsoft azure. The next concept were going to look at is micro services.

For our amazon example, lets say that our backend contains code that saves an order to the database, charges the users credit card, and sends an email confirmation.

In the real world this back end can be millions of lines of code, so we split this up into three code bases. Then each of these code bases will have their own backend, each with the load balancer, and sometimes their own database. Then when we need to send an email, our orders backend will send a request to the email backend, which will send the email. So splitting up our back end into separate backends like this is called microservices, and it helps keep our code base smaller and more focused. Each microservice does not have to use the same programming language and database.

One microservice can be using javascript and mongodb, while another microservice can be using python and mysql.

Now to make this even easier, there are companies out there like twilio who have already created an email service. So twilio provides a backend and an api for sending emails so instead of us creating our own email microservice, our backend can just send requests to twilios back-end. When a company provides a back-end and an api that outside applications can use, this is called a saas software as a service. Pretty much everything you do in the back end thats complicated theres probably a saas company out there that already provides that service and you just use that service instead of building your own microservice.

So these three concepts we just looked at infrastructure as a service, platform as a service, and software as a service, are the three foundations of cloud computing.

These days most companies use cloud computing to run the backend for their websites instead of buying and managing physical servers themselves.

In this last section I want to introduce some additional technologies you might see in the back end. Previously we mentioned the databases mysql, postgres, and mongodb.

These are sometimes called primary databases because theyre the main database that our website uses.

Generally we start our backend with a server and a primary database and then bring in these additional technologies if we need to.

If we allow our users to upload images, a primary database is not good for storing images, so we would use a blob store like aws s3, and a cdn like cloudfront to store and load user uploaded images.

If we want to allow text search primary databases are very slow at text search so we would bring in a search database like elasticsearch.

If our website is getting a lot of traffic and we need to take some stress off our primary database, we would add a cache like redis to improve performance.

If we want to do data science we dont want to do the data analysis using our primary database, its busy running our website. So we would copy all of our data into an analytical database like snowflake, which is really good for doing data science on the side.

If you want to schedule a task for later, for example, amazon might want to email their users before their amazon prime subscription renews, we would use a job queue like rabbitmq to schedule this task for the future, and theres a bunch more technologies like these out there that are made to solve specific problems. So these are all the backend technologies that we covered in this video, if youre just starting out you mostly just need to know how to use cloud computing, a backend framework, and a primary database.

These other technologies are things that you may or may not use. You would add them to your backend depending on what kind of website and features youre trying to make.

Thanks for watching my name is Simon from I want to make a tech career possible for anyone. If you have any questions or comments please leave them down below and Ill see you in the next one.