How does a website work? : A beginner's guide

How does a website work? : A beginner's guide

Everyone knows what a website is, right? We search for something on google, which provides us with a bunch of .coms and .ins, and in no time, we are scrolling through cat memes. In simplest terms, A website is a way to collect and display information.

How do websites work?

A user device is called a client whereas the device that stores software and raw data is called a web server.

The world wide web is about communication between web clients and servers.

Now this communication requires many more parts

  • Internet - Both, the server and the client are connected to the internet

  • TCP/IP - Transmission Control Protocol/Internet Protocol is a set of rules established to connect computer systems in a network.

  • HTTP - Hypertext transfer protocol is an application protocol that helps in communication by sending requests and responses back and forth between the client and the server. We shall understand this in detail in the next segment.

  • DNS - A domain name is a name assigned to a website by the website owner. Every website has an address in a machine-understandable form known as an IP address. The Domain Name System converts the domain name entered by the user into the IP address of that website.

  • Component files - These include code files, which form the building blocks of a website and asset files, which contain images, documents, music, videos etc.

How everything comes together

When the user types a web address into the browser, it goes to the DNS to find the IP address of the website.

Role of HTTP

Communication is done by sending HTTP requests and responses.

When the server receives a request, it looks for the requested document. It usually logs the client's IP address, the document requested, and the date and time it was requested. This information varies from server to server.

Following this, An HTTP response is sent by the server. The response includes status codes that indicate whether the request has been completed or not.

If the request is successful, the server then starts sending the website's files to the browser in small portions called data packets, which the browser assembles into a complete web page that we wished to see.