How Does Internet Works for Developers - Must Know Basics
How Does Internet Works for Developers - Must Know Basics

Really often on interview you can hear such basic question like "How web works". And most people think that they know how it works but can't describe it from start to the end. So after this video you will be able to answer this question as full as possible.


Imagine that you are on interview and you get such question. "We type in our browser youtube.com and we see the website. How exactly does it work form start to the end"?

Step 1

The first this what is happening is that your browser asks DNS (Domain Name System) the IP address of the website. So DNS is just a huge list where for each domain we have a specific IP address. What has this IP address. It's the server where this project is hosted and running. Basically if we know IP address of the server we can type it directly in browser and it will work. But obviously it is difficult to remember IP adresses for each website. This is why we have domain names at all. So step #1 is to find the IP address so our browser knows where to send the request.

Step 2

So what is request. It's a package with some data what our server will get after browser get IP address from the DNS. Inside request browser write the data type, some specific browser information and so on. Our server waits for requests and returns for us some static files for example html with css and javascript or generates a page dynamically.

Step 3

After this server sends to our browser a response. It can be for example and html page or and API json response. It all depends on what was requested.
And after browser got a response back from server it interprets it. It checks the response and renders a page accordingly. If it's an html it parses it correctly and builds DOM tree which shows the website for user.

After this page is rendered for the user.

Important things

But here are some important things to remember. First of all if you type an IP address in browser in goes to 80 port. Which means when you type a domain it gets IP address from DNS and requests goes to 80 port. It is important as server must to know at what port should it listen to request and respond. And actually if you type an IP address and a port in browser your server can return something different because you requested another port.

Secondly an important thing that this request response communication is called HTTP (Hypertext Transfer Protocol). But we also have HTTPS in all modern websites. How does it fits into our schema? The problem with HTTP is that it is not encrypted. So anybody between your browser and a server can read your request and private information like credentials for example.

This is why HTTPS is a must. It's the protocol where the connection between browser and server is encrypted and nobody in between can read anything.

Server workflows

Now we have a schema of how everything work so let's talk about details. As I said server can respond with static data. It's the easiest variant as it means that it was already prepared and should just be send to browser and it is super fast.

Another case is that our website can be generated dynamically by backend language. For example node, php, ruby, python can generate dynamic pages based on the information provided or requested route.

But it's not all. The common usecase nowadays is to render applications completely in javascript. Why means backend do nothing except of rendering the same html page for every route with javascript inside and all logic is happening on frontend in javascript framework like React, Angular of Vue.

So this is what you need to answer if somebody ask your on interview how web is working.

And if you are interested in my 5 tips to be more productive as a developer make sure to check this video.

Also if you want to improve your programming skill I have lots of full courses regarding different web technologies.