<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Darshan R</title>
    <description>The latest articles on DEV Community by Darshan R (@darshan_dev).</description>
    <link>https://dev.to/darshan_dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4059016%2Ff22c0aba-59e3-456b-b4d6-a9aeb8e146d4.jpg</url>
      <title>DEV Community: Darshan R</title>
      <link>https://dev.to/darshan_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darshan_dev"/>
    <language>en</language>
    <item>
      <title>One Click. Multiple Systems. One Order.</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 25 Oct 2026 06:55:56 +0000</pubDate>
      <link>https://dev.to/darshan_dev/one-click-multiple-systems-one-order-1nf4</link>
      <guid>https://dev.to/darshan_dev/one-click-multiple-systems-one-order-1nf4</guid>
      <description>&lt;p&gt;Imagine you're ordering a pair of shoes for ₹999.&lt;/p&gt;

&lt;p&gt;You click &lt;strong&gt;Place Order&lt;/strong&gt;, complete the payment, and wait for confirmation.&lt;/p&gt;

&lt;p&gt;A few seconds later, the website shows that your order is confirmed.&lt;/p&gt;

&lt;p&gt;Everything looks simple. But what if your payment succeeds and the website never receives the confirmation? What if you click Pay again because the page appears stuck? Could the system charge you twice?&lt;/p&gt;

&lt;p&gt;Behind that single click, multiple systems must coordinate to make sure your order is processed correctly.&lt;/p&gt;

&lt;p&gt;Let's explore what happens behind the scenes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens Behind That One Click?
&lt;/h2&gt;

&lt;p&gt;An online purchase involves a website, a backend, a database, and a payment provider.&lt;/p&gt;

&lt;p&gt;Here's a simplified view of how the process might work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer Clicks "Place Order"
             ↓
      Backend Processes Request
             ↓
        Order Is Created
             ↓
      Payment Is Requested
             ↓
       Payment Provider
             ↓
        Payment Result
             ↓
      Backend Verifies It
             ↓
       Database Is Updated
             ↓
       Order Is Confirmed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact sequence depends on how the application is designed. Payment processing and order confirmation may involve additional steps.&lt;/p&gt;

&lt;p&gt;The important part is that a successful payment request doesn't guarantee that every other step will succeed.&lt;/p&gt;

&lt;p&gt;Let's look at the problems developers need to solve.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Idempotency — What If We Retry?
&lt;/h2&gt;

&lt;p&gt;Imagine you click Pay for your ₹999 shoes.&lt;/p&gt;

&lt;p&gt;The payment provider processes your payment successfully, but a network problem prevents your website from receiving the response.&lt;/p&gt;

&lt;p&gt;Your website doesn't know whether the payment succeeded or failed.&lt;/p&gt;

&lt;p&gt;If it blindly sends another payment request, you could be charged twice.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;idempotency&lt;/strong&gt; becomes important.&lt;/p&gt;

&lt;p&gt;Idempotency means that repeating the same operation doesn't repeat its effect.&lt;/p&gt;

&lt;p&gt;A payment request can include a unique identifier called an &lt;em&gt;idempotency key&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pay_order_8472_attempt_1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If the response gets lost, the application can retry the same operation using the same key. A payment provider that supports idempotency can recognize the repeated request and return the original result instead of processing another charge.&lt;/p&gt;

&lt;p&gt;The key should be reused for retries of the same operation, not for a genuinely new payment attempt.&lt;/p&gt;

&lt;p&gt;The main idea is simple: &lt;strong&gt;a missing response doesn't necessarily mean the operation failed.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Webhooks — How Does the Website Know?
&lt;/h2&gt;

&lt;p&gt;Now imagine your payment succeeds, but you close the browser before the confirmation appears.&lt;/p&gt;

&lt;p&gt;How does your website learn what happened?&lt;/p&gt;

&lt;p&gt;Many payment providers support something called a &lt;strong&gt;webhook&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A webhook is an HTTP request sent by one system to another when a particular event occurs.&lt;/p&gt;

&lt;p&gt;For example, when your payment succeeds, the payment provider can send a notification to your backend.&lt;/p&gt;

&lt;p&gt;The backend verifies the notification, identifies the corresponding payment, and processes the necessary updates.&lt;/p&gt;

&lt;p&gt;The flow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payment Succeeds
       ↓
Provider Sends Webhook
       ↓
Backend Receives Event
       ↓
Event Is Verified
       ↓
Payment and Order Records Updated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But there's a catch.&lt;/p&gt;

&lt;p&gt;A webhook might arrive more than once, arrive late, or fail during processing. That's why the backend needs to verify incoming events and handle repeated notifications safely.&lt;/p&gt;

&lt;p&gt;Receiving a notification is only one part of the process. The application must also make sure the event is processed correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What If the Payment Succeeds but the Order Doesn't Update?
&lt;/h2&gt;

&lt;p&gt;Let's return to our shoe order.&lt;/p&gt;

&lt;p&gt;Your payment provider confirms that your ₹999 payment succeeded. However, the shopping website encounters a database error before updating your order.&lt;/p&gt;

&lt;p&gt;The records might now look like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Payment provider: &lt;code&gt;SUCCESS&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Order database: &lt;code&gt;PENDING&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You've paid, but the website still shows your order as pending.&lt;/p&gt;

&lt;p&gt;Why does this happen?&lt;/p&gt;

&lt;p&gt;The payment provider and the shopping website's database are separate systems. A database transaction can protect related changes inside that database, but it cannot automatically reverse a payment already processed by an external provider.&lt;/p&gt;

&lt;p&gt;This connects to the ACID properties we explored in our earlier article about database transactions.&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;keeping one database consistent is different from coordinating multiple independent systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So how can the application discover and fix the mismatch?&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Reconciliation — Finding What Went Wrong
&lt;/h2&gt;

&lt;p&gt;This is where &lt;strong&gt;reconciliation&lt;/strong&gt; becomes useful.&lt;/p&gt;

&lt;p&gt;Reconciliation means comparing records from different systems to identify discrepancies.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;System&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Payment provider&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SUCCESS&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Order database&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PENDING&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A reconciliation process can identify this mismatch, check the payment provider's records, and safely retry the missing order update.&lt;/p&gt;

&lt;p&gt;If the payment status is uncertain, the application should verify it instead of assuming that the payment succeeded or failed.&lt;/p&gt;

&lt;p&gt;Reconciliation can run periodically or be triggered by particular failures.&lt;/p&gt;

&lt;p&gt;In simple terms, it helps the application discover when its records don't match what actually happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  What If Something Goes Wrong?
&lt;/h2&gt;

&lt;p&gt;Let's put everything together.&lt;/p&gt;

&lt;p&gt;You order your ₹999 shoes. The payment succeeds, but the website temporarily loses the response.&lt;/p&gt;

&lt;p&gt;Here's how the application might recover:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payment Succeeds
       ↓
Response Gets Lost
       ↓
Website Doesn't Know the Result
       ↓
Retry or Check Payment Status
       ↓
Verify the Original Payment
       ↓
Update the Order Safely
       ↓
Confirm the Order
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During this process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Idempotency&lt;/strong&gt; helps prevent duplicate payment processing when the same operation is retried.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhooks&lt;/strong&gt; communicate payment events to the backend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconciliation&lt;/strong&gt; helps detect and resolve mismatches when an update fails.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each mechanism solves a different problem. Together, they help the application handle network failures, duplicate requests, delayed notifications, and database errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;A single click on a shopping website can trigger operations across several independent systems.&lt;/p&gt;

&lt;p&gt;Making those systems work together reliably is more complicated than simply sending a request and receiving a response.&lt;/p&gt;

&lt;p&gt;A payment can succeed while the order remains pending. A notification can arrive more than once. A request can time out even though the operation completed successfully.&lt;/p&gt;

&lt;p&gt;That's why developers need to think beyond the normal, successful path.&lt;/p&gt;

&lt;p&gt;Idempotency helps manage retries. Webhooks communicate events. Reconciliation helps identify and resolve mismatches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The biggest lesson is that reliable software isn't just about making things work when everything goes right. It's also about handling what happens when things go wrong.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next time you place an online order, remember that behind that one click, multiple systems must coordinate to make sure the result is correct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>backend</category>
    </item>
    <item>
      <title>Why Do So Many People Use WhatsApp? Understanding the Technology and Network Effect</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 13 Sep 2026 10:19:44 +0000</pubDate>
      <link>https://dev.to/darshan_dev/why-do-so-many-people-use-whatsapp-understanding-the-technology-and-network-effect-3312</link>
      <guid>https://dev.to/darshan_dev/why-do-so-many-people-use-whatsapp-understanding-the-technology-and-network-effect-3312</guid>
      <description>&lt;p&gt;Have you ever wondered why so many people use &lt;strong&gt;WhatsApp&lt;/strong&gt; instead of Telegram, Signal, or other messaging apps?&lt;/p&gt;

&lt;p&gt;Most people use WhatsApp to send messages, make voice and video calls, share photos, send documents, and communicate through groups.&lt;/p&gt;

&lt;p&gt;But WhatsApp became popular for more than just its features. Its success is strongly connected to an important technology and business concept called the &lt;strong&gt;network effect&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Why Do People Use WhatsApp?
&lt;/h2&gt;

&lt;p&gt;Imagine that you install a new messaging app.&lt;/p&gt;

&lt;p&gt;The app has excellent features, beautiful design, and strong privacy. However, none of your friends or family members use it.&lt;/p&gt;

&lt;p&gt;What is the use of that app if you cannot communicate with the people you know?&lt;/p&gt;

&lt;p&gt;This is one of the main reasons people use WhatsApp.&lt;/p&gt;

&lt;p&gt;Many people already use WhatsApp for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Family conversations&lt;/li&gt;
&lt;li&gt;Friends’ groups&lt;/li&gt;
&lt;li&gt;College announcements&lt;/li&gt;
&lt;li&gt;Office communication&lt;/li&gt;
&lt;li&gt;School groups&lt;/li&gt;
&lt;li&gt;Business communication&lt;/li&gt;
&lt;li&gt;Customer support&lt;/li&gt;
&lt;li&gt;Sharing photos, videos, and documents&lt;/li&gt;
&lt;li&gt;Voice and video calls&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a person wants to contact someone, they usually choose the app that the other person already uses.&lt;/p&gt;

&lt;p&gt;This creates a powerful cycle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;More people use WhatsApp
          ↓
More people can be contacted through WhatsApp
          ↓
More people install WhatsApp
          ↓
Even more people start using WhatsApp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is called the &lt;strong&gt;network effect&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. What Is the Network Effect?
&lt;/h2&gt;

&lt;p&gt;The network effect means that a product or service becomes more useful when more people use it.&lt;/p&gt;

&lt;p&gt;A telephone is a simple example.&lt;/p&gt;

&lt;p&gt;If only one person owns a telephone, it is not very useful because there is nobody else to call.&lt;/p&gt;

&lt;p&gt;If thousands or millions of people own telephones, the telephone becomes much more valuable.&lt;/p&gt;

&lt;p&gt;Messaging apps work in a similar way.&lt;/p&gt;

&lt;p&gt;A messaging app becomes more useful when your:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parents use it&lt;/li&gt;
&lt;li&gt;Friends use it&lt;/li&gt;
&lt;li&gt;Teachers use it&lt;/li&gt;
&lt;li&gt;Colleagues use it&lt;/li&gt;
&lt;li&gt;Customers use it&lt;/li&gt;
&lt;li&gt;Communities use it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The value of the app is not only in its technical features. Its value also comes from the people available on the platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Simple Example
&lt;/h3&gt;

&lt;p&gt;Suppose you are using WhatsApp and all your friends are also using WhatsApp.&lt;/p&gt;

&lt;p&gt;Now, someone recommends Telegram to you.&lt;/p&gt;

&lt;p&gt;You install Telegram, but your friends are still using WhatsApp.&lt;/p&gt;

&lt;p&gt;You may think:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Why should I move to Telegram if everyone I want to contact is already on WhatsApp?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is why users often stay with a popular messaging app.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Why Is It Difficult to Switch Messaging Apps?
&lt;/h2&gt;

&lt;p&gt;Switching to another messaging app is not always technically difficult.&lt;/p&gt;

&lt;p&gt;You can download Telegram or Signal in a few minutes.&lt;/p&gt;

&lt;p&gt;The real difficulty is convincing everyone else to move with you.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You install a new messaging app
          ↓
You ask your friends to install it
          ↓
Some friends install it
          ↓
Others continue using WhatsApp
          ↓
You still need WhatsApp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is sometimes called the &lt;strong&gt;network effect problem&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A messaging app is useful only when the people you want to communicate with are also available there.&lt;/p&gt;

&lt;p&gt;Therefore, people may continue using WhatsApp even if another app offers different or better features.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Is WhatsApp Better Than Telegram or Signal?
&lt;/h2&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;Different messaging apps focus on different needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  WhatsApp
&lt;/h3&gt;

&lt;p&gt;WhatsApp is widely used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Personal messaging&lt;/li&gt;
&lt;li&gt;Family and friends’ groups&lt;/li&gt;
&lt;li&gt;Voice and video calls&lt;/li&gt;
&lt;li&gt;Business communication&lt;/li&gt;
&lt;li&gt;Sharing media and documents&lt;/li&gt;
&lt;li&gt;Everyday communication&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Its biggest advantage is its large user base.&lt;/p&gt;

&lt;h3&gt;
  
  
  Telegram
&lt;/h3&gt;

&lt;p&gt;Telegram is known for features such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Large groups&lt;/li&gt;
&lt;li&gt;Public channels&lt;/li&gt;
&lt;li&gt;Bots&lt;/li&gt;
&lt;li&gt;Cloud-based message access&lt;/li&gt;
&lt;li&gt;Communities and broadcasting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is useful for people who want to follow channels, communities, and large groups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Signal
&lt;/h3&gt;

&lt;p&gt;Signal is known for its strong focus on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Privacy&lt;/li&gt;
&lt;li&gt;Secure communication&lt;/li&gt;
&lt;li&gt;End-to-end encryption&lt;/li&gt;
&lt;li&gt;Minimal data collection compared with many other messaging services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is useful for people who give high importance to privacy.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Main Difference
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WhatsApp → Large user base and everyday communication

Telegram → Channels, communities, bots, and large groups

Signal → Privacy-focused communication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The best app depends on the user’s needs.&lt;/p&gt;

&lt;p&gt;However, WhatsApp benefits from the fact that many people already use it.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. What Happens When You Send a WhatsApp Message?
&lt;/h2&gt;

&lt;p&gt;Now let’s look at the technical side.&lt;/p&gt;

&lt;p&gt;Suppose you send this message to your friend:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Hey, are you free today?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The message does not travel directly from your phone to your friend’s phone in a simple straight line.&lt;/p&gt;

&lt;p&gt;It passes through a communication system involving networks, servers, and routing.&lt;/p&gt;

&lt;p&gt;A simplified flow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Phone
    ↓
Message Encryption
    ↓
Internet Connection
    ↓
Messaging Service Servers
    ↓
Network Routers
    ↓
Recipient’s Device
    ↓
Message Delivered
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s understand each step.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Step 1: You Type and Send the Message
&lt;/h2&gt;

&lt;p&gt;You open WhatsApp, select your friend, type a message, and press the &lt;strong&gt;Send&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;Your phone prepares the message for transmission.&lt;/p&gt;

&lt;p&gt;The application also identifies the intended recipient.&lt;/p&gt;

&lt;p&gt;At this stage, the message is still inside your device.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Step 2: The Message Is Encrypted
&lt;/h2&gt;

&lt;p&gt;WhatsApp uses &lt;strong&gt;end-to-end encryption&lt;/strong&gt; for personal messages and calls.&lt;/p&gt;

&lt;p&gt;End-to-end encryption means that the message is protected while travelling between the sender and the recipient.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Phone → Encrypted Message → Recipient’s Phone
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The purpose is to prevent unauthorized people from reading the content of the message while it is being transmitted.&lt;/p&gt;

&lt;p&gt;The message is encrypted on the sender’s device and is designed to be decrypted by the intended recipient’s device.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Encryption helps protect the content of the communication. It does not mean that every part of the communication system is invisible.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  8. Step 3: The Message Travels Through the Internet
&lt;/h2&gt;

&lt;p&gt;After the message is prepared, it travels through your internet connection.&lt;/p&gt;

&lt;p&gt;Your internet connection may be provided by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wi-Fi&lt;/li&gt;
&lt;li&gt;Mobile data&lt;/li&gt;
&lt;li&gt;A broadband connection&lt;/li&gt;
&lt;li&gt;Another internet service&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The data is divided into small units called &lt;strong&gt;packets&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These packets travel through different network devices, including routers.&lt;/p&gt;

&lt;p&gt;A router helps forward data towards its destination.&lt;/p&gt;

&lt;p&gt;A simplified path looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Phone
    ↓
Wi-Fi Router or Mobile Network
    ↓
Internet Routers
    ↓
Messaging Service Infrastructure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact route can change depending on the network conditions.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Step 4: Messaging Servers Help Deliver the Message
&lt;/h2&gt;

&lt;p&gt;Messaging services use servers and other backend systems to manage communication between users.&lt;/p&gt;

&lt;p&gt;These systems may handle tasks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identifying the recipient&lt;/li&gt;
&lt;li&gt;Managing connections&lt;/li&gt;
&lt;li&gt;Temporarily storing messages when necessary&lt;/li&gt;
&lt;li&gt;Delivering messages&lt;/li&gt;
&lt;li&gt;Handling delivery status&lt;/li&gt;
&lt;li&gt;Managing group communication&lt;/li&gt;
&lt;li&gt;Supporting media and file transfers&lt;/li&gt;
&lt;li&gt;Managing large numbers of users&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, if your friend is temporarily offline, the service may keep the message available until it can be delivered, depending on the service’s delivery system and policies.&lt;/p&gt;

&lt;p&gt;The server does not simply act like a single computer. Large messaging services use distributed systems made up of many machines and services.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Step 5: The Message Reaches the Recipient
&lt;/h2&gt;

&lt;p&gt;When your friend’s phone is connected and ready to receive the message, the messaging service attempts to deliver it.&lt;/p&gt;

&lt;p&gt;The message reaches your friend’s device, where it can be displayed in the chat.&lt;/p&gt;

&lt;p&gt;The overall flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sender
  ↓
Encrypted Message
  ↓
Internet
  ↓
Messaging Infrastructure
  ↓
Recipient’s Device
  ↓
Message Displayed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This entire process usually happens very quickly.&lt;/p&gt;

&lt;p&gt;That is why messaging feels almost instant.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. What Do the Tick Marks Mean?
&lt;/h2&gt;

&lt;p&gt;WhatsApp uses tick marks to show message status.&lt;/p&gt;

&lt;p&gt;In a simplified explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One grey tick:&lt;/strong&gt; The message has been sent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two grey ticks:&lt;/strong&gt; The message has been delivered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two blue ticks:&lt;/strong&gt; The message has been read, depending on the user’s settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These indicators help users understand what happened to their message.&lt;/p&gt;

&lt;p&gt;However, message status can depend on settings, network conditions, and the type of conversation.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. How Can WhatsApp Handle So Many Messages?
&lt;/h2&gt;

&lt;p&gt;A messaging platform must be designed to handle a large number of users and messages.&lt;/p&gt;

&lt;p&gt;Imagine millions of people sending messages at the same time.&lt;/p&gt;

&lt;p&gt;A single server would not be enough to handle all that traffic.&lt;/p&gt;

&lt;p&gt;Large messaging systems use several techniques to improve performance and reliability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Distributed Servers
&lt;/h3&gt;

&lt;p&gt;Instead of using only one machine, the service can use many servers.&lt;/p&gt;

&lt;p&gt;The workload is distributed among these servers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Many Users
    ↓
Multiple Servers
    ↓
Messages Processed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Load Balancing
&lt;/h3&gt;

&lt;p&gt;Load balancing helps distribute incoming requests across different servers.&lt;/p&gt;

&lt;p&gt;This prevents one server from receiving all the traffic while other servers remain unused.&lt;/p&gt;

&lt;h3&gt;
  
  
  Queues
&lt;/h3&gt;

&lt;p&gt;A queue temporarily holds tasks or messages that need to be processed.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Incoming Messages
        ↓
Message Queue
        ↓
Processing System
        ↓
Delivery
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Queues can help systems manage sudden increases in traffic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage
&lt;/h3&gt;

&lt;p&gt;Messaging services need storage systems to manage information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User accounts&lt;/li&gt;
&lt;li&gt;Message-related data&lt;/li&gt;
&lt;li&gt;Delivery information&lt;/li&gt;
&lt;li&gt;Group information&lt;/li&gt;
&lt;li&gt;Media-related information&lt;/li&gt;
&lt;li&gt;Settings and preferences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The exact storage design depends on the service and the type of data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reliability
&lt;/h3&gt;

&lt;p&gt;Messaging systems must continue working even if some servers or network connections fail.&lt;/p&gt;

&lt;p&gt;To achieve this, large systems may use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Backup systems&lt;/li&gt;
&lt;li&gt;Replication&lt;/li&gt;
&lt;li&gt;Monitoring&lt;/li&gt;
&lt;li&gt;Automatic recovery&lt;/li&gt;
&lt;li&gt;Multiple servers&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to make communication reliable and available.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Why Is Simplicity Important?
&lt;/h2&gt;

&lt;p&gt;Another reason for WhatsApp’s popularity is its simple user experience.&lt;/p&gt;

&lt;p&gt;A new user can usually understand the basic process quickly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install the App
      ↓
Register Your Number
      ↓
Find Contacts
      ↓
Send a Message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Users do not need to understand servers, routers, encryption, or databases to use the application.&lt;/p&gt;

&lt;p&gt;The complicated technology works behind the scenes.&lt;/p&gt;

&lt;p&gt;This is an important lesson in software development:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A product can use complex technology internally while providing a simple experience to users.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  14. The Real-World Example
&lt;/h2&gt;

&lt;p&gt;Imagine that your college creates a WhatsApp group for students.&lt;/p&gt;

&lt;p&gt;The group is used to share:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exam timetables&lt;/li&gt;
&lt;li&gt;Assignment announcements&lt;/li&gt;
&lt;li&gt;Important notices&lt;/li&gt;
&lt;li&gt;Event details&lt;/li&gt;
&lt;li&gt;Class updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Almost every student joins the group because important information is shared there.&lt;/p&gt;

&lt;p&gt;Now, suppose someone creates another messaging group on a different platform.&lt;/p&gt;

&lt;p&gt;Students may not join immediately because the important announcements are already available on WhatsApp.&lt;/p&gt;

&lt;p&gt;This example shows how the network effect works in real life.&lt;/p&gt;

&lt;p&gt;People join a platform because other people and useful information are already there.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. The Main Lesson
&lt;/h2&gt;

&lt;p&gt;WhatsApp’s popularity is not based on one feature alone.&lt;/p&gt;

&lt;p&gt;Its success is connected to several factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A large existing user base&lt;/li&gt;
&lt;li&gt;Simple communication features&lt;/li&gt;
&lt;li&gt;Easy access across devices&lt;/li&gt;
&lt;li&gt;Family, college, office, and business usage&lt;/li&gt;
&lt;li&gt;Group communication&lt;/li&gt;
&lt;li&gt;Media and document sharing&lt;/li&gt;
&lt;li&gt;Reliable messaging infrastructure&lt;/li&gt;
&lt;li&gt;The network effect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most important factor is the network effect.&lt;/p&gt;

&lt;p&gt;People often choose WhatsApp because the people they want to communicate with are already using it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;WhatsApp is more than a simple messaging application.&lt;/p&gt;

&lt;p&gt;From a user’s point of view, sending a message looks easy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Type → Send → Delivered
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind the scenes, the process involves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Encryption
    ↓
Internet Networks
    ↓
Routers
    ↓
Servers
    ↓
Message Processing
    ↓
Recipient’s Device
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Its widespread adoption also demonstrates the power of the &lt;strong&gt;network effect&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Telegram, Signal, and other messaging apps may offer valuable features, but users often stay with WhatsApp because their friends, families, colleges, offices, and communities are already there.&lt;/p&gt;

&lt;p&gt;The biggest lesson is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A product becomes more useful when more people use it. This is the power of the network effect.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>networking</category>
      <category>technology</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What Happens When You Refresh a Web Page? Understanding Browser Cache for Beginners</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 30 Aug 2026 11:07:55 +0000</pubDate>
      <link>https://dev.to/darshan_dev/what-happens-when-you-refresh-a-web-page-understanding-browser-cache-for-beginners-56p</link>
      <guid>https://dev.to/darshan_dev/what-happens-when-you-refresh-a-web-page-understanding-browser-cache-for-beginners-56p</guid>
      <description>&lt;p&gt;Have you ever noticed that a website sometimes loads slowly the first time, but much faster when you visit it again?&lt;/p&gt;

&lt;p&gt;For example, imagine you open an online shopping website for the first time.&lt;/p&gt;

&lt;p&gt;The browser needs to download things like HTML, CSS, JavaScript, images, and fonts.&lt;/p&gt;

&lt;p&gt;After the page loads, you refresh it.&lt;/p&gt;

&lt;p&gt;Suddenly, the page may load much faster.&lt;/p&gt;

&lt;p&gt;So what happened?&lt;/p&gt;

&lt;p&gt;The answer is &lt;strong&gt;browser caching&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Browser Cache?
&lt;/h2&gt;

&lt;p&gt;A browser cache is temporary storage used by your browser to keep copies of certain resources from websites.&lt;/p&gt;

&lt;p&gt;Think of it like keeping frequently used things at home instead of going to the store every time you need them.&lt;/p&gt;

&lt;p&gt;For example, a website might contain:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;style.css&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;code&gt;app.js&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;code&gt;logo.png&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;code&gt;font.woff2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The browser can store some of these resources in its cache.&lt;/p&gt;

&lt;p&gt;So when you visit the website again, the browser may be able to reuse them instead of downloading everything again.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens When You Visit a Website for the First Time?
&lt;/h2&gt;

&lt;p&gt;Let's say you visit &lt;code&gt;example.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The browser requests the resources needed to display the page.&lt;/p&gt;

&lt;p&gt;The simplified flow is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser → Server → HTML, CSS, JavaScript, Images → Browser → Display Page&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While receiving these resources, the browser may store some cacheable resources locally.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser Cache → &lt;code&gt;style.css&lt;/code&gt;, &lt;code&gt;app.js&lt;/code&gt;, &lt;code&gt;logo.png&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now the browser has some resources available for future use.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens When You Refresh?
&lt;/h2&gt;

&lt;p&gt;Now you press &lt;strong&gt;Refresh 🔄&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The browser doesn't always download everything again.&lt;/p&gt;

&lt;p&gt;Instead, it can check whether cached resources can still be used.&lt;/p&gt;

&lt;p&gt;The simplified process is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refresh Page → Browser Checks Cache → Can Cached Resource Be Reused?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If yes, the browser may use the cached resource.&lt;/p&gt;

&lt;p&gt;If not, it may request the resource again from the server.&lt;/p&gt;

&lt;p&gt;This can make websites feel much faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does Refresh Always Use the Cache?
&lt;/h2&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;The browser follows caching rules provided by the website.&lt;/p&gt;

&lt;p&gt;The server can tell the browser how a resource should be cached using HTTP response headers.&lt;/p&gt;

&lt;p&gt;One important header is &lt;code&gt;Cache-Control&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Cache-Control: max-age=3600&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This tells the browser that the resource can generally be considered fresh for a certain amount of time.&lt;/p&gt;

&lt;p&gt;So caching isn't simply:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If I downloaded it once, always use it."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The browser follows rules to decide whether a cached resource can be reused or needs to be checked again.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is ETag?
&lt;/h2&gt;

&lt;p&gt;Another useful concept is &lt;strong&gt;ETag&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An ETag is a value that helps the browser and server determine whether a resource has changed.&lt;/p&gt;

&lt;p&gt;Imagine the browser previously downloaded &lt;code&gt;app.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The server provided an ETag for that version.&lt;/p&gt;

&lt;p&gt;Later, the browser can ask the server whether that version is still current.&lt;/p&gt;

&lt;p&gt;If the resource hasn't changed, the server can respond with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;304 Not Modified&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This means the browser can continue using its cached copy.&lt;/p&gt;

&lt;p&gt;If the resource has changed, the server can send the newer version.&lt;/p&gt;

&lt;p&gt;The basic idea is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser has cached file → Checks with server → Has it changed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No → Use cached copy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Yes → Download the new version&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens When You Press Ctrl + R?
&lt;/h2&gt;

&lt;p&gt;When you press &lt;strong&gt;Ctrl + R&lt;/strong&gt;, you're performing a normal reload.&lt;/p&gt;

&lt;p&gt;The browser still follows the relevant caching rules while loading the page.&lt;/p&gt;

&lt;p&gt;It doesn't necessarily mean:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Delete everything and download everything again."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's an important distinction.&lt;/p&gt;

&lt;h2&gt;
  
  
  What About Ctrl + Shift + R?
&lt;/h2&gt;

&lt;p&gt;You may have noticed another shortcut:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ctrl + Shift + R&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is commonly used for a &lt;strong&gt;hard reload&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It asks the browser to reload the page while being more aggressive about bypassing cached resources.&lt;/p&gt;

&lt;p&gt;Developers often use it when they've changed CSS or JavaScript but the browser appears to be showing an older version.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You update &lt;code&gt;style.css&lt;/code&gt; → Refresh → Old CSS may still appear → Hard Reload → Browser fetches the latest resources&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The exact behavior can vary by browser and situation, but the main idea is that a hard reload is useful when you want to avoid relying on cached resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Is Browser Caching Useful?
&lt;/h2&gt;

&lt;p&gt;Caching provides several benefits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Faster Loading
&lt;/h3&gt;

&lt;p&gt;Previously cached resources may not need to be downloaded again.&lt;/p&gt;

&lt;h3&gt;
  
  
  Less Network Usage
&lt;/h3&gt;

&lt;p&gt;The browser may reuse local resources instead of downloading them repeatedly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Better User Experience
&lt;/h3&gt;

&lt;p&gt;Pages can feel faster, especially when returning to a website.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Visit → Download Resources → Cache Them&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second Visit → Reuse Available Resources → Page May Load Faster&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  But Caching Can Cause Problems Too
&lt;/h2&gt;

&lt;p&gt;Imagine you're a developer.&lt;/p&gt;

&lt;p&gt;You update your website's CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Old CSS → New CSS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But a user still sees the old design.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Their browser might still have an older cached version of the CSS.&lt;/p&gt;

&lt;p&gt;This is one reason developers sometimes use techniques such as &lt;strong&gt;cache busting&lt;/strong&gt; or &lt;strong&gt;versioned filenames&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app.v1.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Later:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app.v2.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Because the filename changed, the browser treats it as a different resource and requests the new file.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Simple Real-World Example
&lt;/h2&gt;

&lt;p&gt;Imagine you visit a news website for the first time.&lt;/p&gt;

&lt;p&gt;The browser downloads the HTML, CSS, JavaScript, images, and other resources needed to display the page.&lt;/p&gt;

&lt;p&gt;Some of these resources may be stored in the browser cache.&lt;/p&gt;

&lt;p&gt;Later, you refresh the page.&lt;/p&gt;

&lt;p&gt;The browser checks its cache and the website's caching rules.&lt;/p&gt;

&lt;p&gt;If a resource can still be reused, the browser may use the cached copy.&lt;/p&gt;

&lt;p&gt;If a resource needs to be updated, the browser requests it again.&lt;/p&gt;

&lt;p&gt;So the simplified flow is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Visit → Download Resources → Store Cacheable Resources&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refresh → Check Cache → Reuse What Can Be Reused → Fetch What Needs Updating → Display Page&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's why a page can sometimes load faster after the first visit.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Complete Picture
&lt;/h2&gt;

&lt;p&gt;So what happens when you refresh a web page?&lt;/p&gt;

&lt;p&gt;The simplified process is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You click Refresh → Browser starts loading the page → Browser checks cached resources → Caching rules are considered → Reusable resources may come from cache → Changed or expired resources may be requested → Server sends responses when needed → Browser combines the resources → Page is displayed&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A Simple Mental Model
&lt;/h2&gt;

&lt;p&gt;You don't need to memorize every caching term.&lt;/p&gt;

&lt;p&gt;Just remember:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First visit:&lt;/strong&gt; The browser downloads resources and may store some of them in the cache.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refresh:&lt;/strong&gt; The browser checks whether cached resources can still be reused.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If reusable:&lt;/strong&gt; The browser may use the cached copy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If outdated:&lt;/strong&gt; The browser may request an updated version.&lt;/p&gt;

&lt;p&gt;That's the basic idea behind browser caching.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Takeaway
&lt;/h2&gt;

&lt;p&gt;Browser caching is one of those things we use every day without thinking about it.&lt;/p&gt;

&lt;p&gt;When you visit a website, your browser may store resources such as CSS, JavaScript, images, and fonts.&lt;/p&gt;

&lt;p&gt;When you return or refresh the page, the browser can reuse those resources when the caching rules allow it.&lt;/p&gt;

&lt;p&gt;This helps websites load faster and can reduce unnecessary network requests.&lt;/p&gt;

&lt;p&gt;The next time you press &lt;strong&gt;Refresh&lt;/strong&gt;, remember:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The browser isn't necessarily starting from zero. It may already have some of the resources the page needs.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And that's the basic idea behind &lt;strong&gt;browser caching&lt;/strong&gt;. 🚀&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're learning web development, understanding what happens behind everyday browser actions can help you build a much stronger foundation.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>What Happens When You Upload a File to a Website? Understanding File Uploads</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 23 Aug 2026 09:01:02 +0000</pubDate>
      <link>https://dev.to/darshan_dev/what-happens-when-you-upload-a-file-to-a-website-understanding-file-uploads-2ejm</link>
      <guid>https://dev.to/darshan_dev/what-happens-when-you-upload-a-file-to-a-website-understanding-file-uploads-2ejm</guid>
      <description>&lt;p&gt;Have you ever uploaded a resume, profile picture, assignment, or PDF to a website?&lt;/p&gt;

&lt;p&gt;You choose a file, click &lt;strong&gt;Upload&lt;/strong&gt;, and after a few seconds you see:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✅ Upload successful!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It looks simple from the user's side.&lt;/p&gt;

&lt;p&gt;But behind that simple button, the browser, backend, file storage, and database are working together.&lt;/p&gt;

&lt;p&gt;So what actually happens when you upload a file?&lt;/p&gt;

&lt;p&gt;Let's understand it using a simple example: &lt;strong&gt;uploading a &lt;code&gt;resume.pdf&lt;/code&gt; to a job website.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;The basic flow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Select File
    ↓
Browser
    ↓
FormData
    ↓
HTTP POST Request
    ↓
Backend
    ↓
Validate File
    ↓
Store File
    ↓
Save File Information
    ↓
HTTP Response
    ↓
Upload Complete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's understand each step.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. You Select the File
&lt;/h2&gt;

&lt;p&gt;Suppose a job website asks you to upload your resume.&lt;/p&gt;

&lt;p&gt;You select:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;resume.pdf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The browser gives JavaScript a &lt;strong&gt;File object&lt;/strong&gt; representing the selected file.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fileInput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You might get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resume.pdf
245000
application/pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;File object&lt;/strong&gt; is simply JavaScript's representation of the file selected by the user.&lt;/p&gt;

&lt;p&gt;At this point, the file has only been selected. It hasn't been uploaded yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The File Is Put Into FormData
&lt;/h2&gt;

&lt;p&gt;Now we need to prepare the file to send to the backend.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;FormData&lt;/strong&gt; is useful.&lt;/p&gt;

&lt;p&gt;Think of FormData like a package containing the information we want to send.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;FormData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;file&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;userId&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;42&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our package now contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;file   → resume.pdf
userId → 42
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So FormData helps us package the file and other form information before sending it.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The Browser Sends an HTTP Request
&lt;/h2&gt;

&lt;p&gt;Now JavaScript sends the FormData to the backend.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/upload&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;formData&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser sends a &lt;strong&gt;POST request&lt;/strong&gt; to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/api/upload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file is sent using a format called:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;multipart/form-data&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. What Is multipart/form-data?
&lt;/h2&gt;

&lt;p&gt;Normally, an HTTP request might contain simple information like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = Darshan
email = darshan@example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But a file upload contains actual file data along with other fields.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;multipart/form-data&lt;/code&gt; allows different pieces of data to be sent together in one HTTP request.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP Request

userId → 42
file   → resume.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So remember:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;multipart/form-data is a format used to send files and other form data together in an HTTP request.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  5. The Backend Receives the File
&lt;/h2&gt;

&lt;p&gt;The request now reaches the backend.&lt;/p&gt;

&lt;p&gt;For example, in a Node.js and Express application, a library such as &lt;strong&gt;Multer&lt;/strong&gt; can process the uploaded file.&lt;/p&gt;

&lt;p&gt;A simplified example looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/upload&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;single&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;file&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend can now access information about the uploaded file.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;filename → resume.pdf
size     → 245 KB
type     → application/pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the backend shouldn't immediately trust the file.&lt;/p&gt;

&lt;p&gt;It should validate it first.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. The Backend Validates the File
&lt;/h2&gt;

&lt;p&gt;The backend should never blindly trust files coming from the browser.&lt;/p&gt;

&lt;p&gt;For example, our job website might allow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF
DOCX
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But someone might try to upload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;virus.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend should reject it.&lt;/p&gt;

&lt;p&gt;It can check things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File type&lt;/li&gt;
&lt;li&gt;File size&lt;/li&gt;
&lt;li&gt;File name&lt;/li&gt;
&lt;li&gt;Other application-specific rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resume.pdf
Size: 2 MB
Type: PDF

      ↓

✅ Valid → Continue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resume.exe
      ↓
❌ File type not allowed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;File size limits are also important.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Maximum allowed size: 5 MB

resume.pdf → 2 MB
      ↓
     ✅
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;large-video.mp4 → 500 MB
      ↓
     ❌
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The backend validates the file before processing or storing it.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  7. Where Is the Actual File Stored?
&lt;/h2&gt;

&lt;p&gt;After validation, the application needs to store the actual file.&lt;/p&gt;

&lt;p&gt;There are different ways to do this.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local server storage&lt;/li&gt;
&lt;li&gt;Cloud/object storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For many modern applications, files such as images, videos, and PDFs are stored in object storage.&lt;/p&gt;

&lt;p&gt;The simplified flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resume.pdf
    ↓
Backend
    ↓
File/Object Storage
    ↓
Actual file stored
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important point is that the &lt;strong&gt;actual file and its information don't necessarily need to be stored in the same place.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. What Does the Database Store?
&lt;/h2&gt;

&lt;p&gt;A common beginner question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If the PDF isn't stored directly in the database, how does the application know where it is?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The database can store &lt;strong&gt;metadata&lt;/strong&gt; about the file.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;files table

id          → 101
user_id     → 42
filename    → resume.pdf
size        → 2 MB
file_url    → /uploads/resume.pdf
uploaded_at → ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So we can think of it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Actual file
    ↓
File/Object Storage

File information
    ↓
Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database stores information that helps the application manage and find the file.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. The Server Sends a Response
&lt;/h2&gt;

&lt;p&gt;Once the file has been successfully stored and the required information has been saved, the backend sends a response to the browser.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;201&lt;/span&gt; &lt;span class="ne"&gt;Created&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The response might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"File uploaded successfully"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"fileUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/uploads/resume.pdf"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser receives the response.&lt;/p&gt;

&lt;p&gt;The website can now show:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✅ Resume uploaded successfully!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's when the user knows the upload is complete.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. What If Something Goes Wrong?
&lt;/h2&gt;

&lt;p&gt;Uploads don't always succeed.&lt;/p&gt;

&lt;p&gt;For example, imagine you upload a 15 MB file while the website allows only 5 MB.&lt;/p&gt;

&lt;p&gt;The process might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resume.pdf
   ↓
File size = 15 MB
   ↓
Maximum allowed = 5 MB
   ↓
❌ Upload rejected
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend might send:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"File size exceeds the limit"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The frontend can then show:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;❌ Upload failed: File is too large.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The same idea applies if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The file type isn't allowed.&lt;/li&gt;
&lt;li&gt;The request is invalid.&lt;/li&gt;
&lt;li&gt;Storage fails.&lt;/li&gt;
&lt;li&gt;The server encounters an error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the browser needs to handle both &lt;strong&gt;success and failure&lt;/strong&gt; responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Complete File Upload Journey
&lt;/h2&gt;

&lt;p&gt;Let's put everything together.&lt;/p&gt;

&lt;p&gt;Imagine you upload:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;resume.pdf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The complete journey is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User selects resume.pdf
          ↓
Browser creates File object
          ↓
File added to FormData
          ↓
POST /api/upload
          ↓
multipart/form-data
          ↓
Backend receives file
          ↓
Backend validates file
          ↓
Actual file stored
          ↓
File metadata saved in database
          ↓
Backend sends response
          ↓
Browser shows upload result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a real application, the architecture might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 Browser
                    │
                    │ POST /api/upload
                    ↓
              Backend API
                    │
             ┌──────┴──────┐
             ↓             ↓
       File Storage     Database
       actual file      metadata
             │             │
             └──────┬──────┘
                    ↓
                 Response
                    ↓
                 Browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A Simple Mental Model
&lt;/h2&gt;

&lt;p&gt;You don't need to memorize every technical term.&lt;/p&gt;

&lt;p&gt;Just remember this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;I select a file → the browser creates a File object → puts it into FormData → sends it using an HTTP request → the backend receives and validates it → the actual file is stored → file information is saved in the database → the server sends a response → the browser shows the result.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Select
  ↓
Package
  ↓
Send
  ↓
Validate
  ↓
Store
  ↓
Save Metadata
  ↓
Respond
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Takeaway
&lt;/h2&gt;

&lt;p&gt;A file upload may look like a single action to the user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Choose File → Upload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But behind that simple button, several components work together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
HTTP
   ↓
Backend
   ↓
File Storage
   ↓
Database
   ↓
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser handles the file selection and sends the request.&lt;/p&gt;

&lt;p&gt;The backend validates and processes the file.&lt;/p&gt;

&lt;p&gt;The actual file can be stored in file/object storage, while the database can store information about that file.&lt;/p&gt;

&lt;p&gt;Finally, the backend tells the browser whether the upload succeeded or failed.&lt;/p&gt;

&lt;p&gt;The next time you upload a resume, profile picture, or assignment, remember that there's a lot happening behind that simple &lt;strong&gt;Upload&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;And that's the basic idea of how file uploads work on the web.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're learning web development, don't just use the Upload button.&lt;/p&gt;

&lt;p&gt;Try to understand what happens behind it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>What Happens When You Click “Login”? Understanding Authentication for Beginners</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 16 Aug 2026 10:05:31 +0000</pubDate>
      <link>https://dev.to/darshan_dev/what-happens-when-you-click-login-understanding-authentication-for-beginners-3311</link>
      <guid>https://dev.to/darshan_dev/what-happens-when-you-click-login-understanding-authentication-for-beginners-3311</guid>
      <description>&lt;p&gt;You enter your email and password on a website, click &lt;strong&gt;Login&lt;/strong&gt;, and suddenly you're inside your account.&lt;/p&gt;

&lt;p&gt;It feels like a simple action.&lt;/p&gt;

&lt;p&gt;But what actually happens after you click that button?&lt;/p&gt;

&lt;p&gt;How does the website know that the email and password belong to you?&lt;/p&gt;

&lt;p&gt;Where does the password go?&lt;/p&gt;

&lt;p&gt;How does the server remember that you've logged in?&lt;/p&gt;

&lt;p&gt;And how does it know what you're allowed to access?&lt;/p&gt;

&lt;p&gt;Let's follow the journey of a login request from the browser to the backend and back.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;Imagine a website with a login form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Email:    user@example.com
Password: ********

        [ Login ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You enter your credentials and click &lt;strong&gt;Login&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A simplified version of what happens is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Login Form
    ↓
Browser / JavaScript
    ↓
HTTP Request
    ↓
Backend API
    ↓
Database
    ↓
Password Verification
    ↓
Session / Token
    ↓
HTTP Response
    ↓
User Logged In
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break this down using a simple example.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. You Enter Your Credentials
&lt;/h2&gt;

&lt;p&gt;Suppose you enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Email:    sam@example.com
Password: MyPassword123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and click &lt;strong&gt;Login&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The browser now has the information that you entered.&lt;/p&gt;

&lt;p&gt;But the browser doesn't decide whether the credentials are correct.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;backend&lt;/strong&gt; needs to verify them.&lt;/p&gt;

&lt;p&gt;So the browser sends the login information to a backend endpoint.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. The Browser Sends a Request
&lt;/h2&gt;

&lt;p&gt;A frontend application might send a request using JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sam@example.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;MyPassword123&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part here is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser is basically saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Here are the credentials the user entered. Please process this login request."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The request body might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sam@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MyPassword123"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This request should be sent over &lt;strong&gt;HTTPS&lt;/strong&gt;, so the credentials are protected while traveling between the browser and server.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. What Is an API Endpoint?
&lt;/h2&gt;

&lt;p&gt;You may have seen URLs such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/api/login
/api/users
/api/products
/api/orders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These can be &lt;strong&gt;API endpoints&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An API endpoint is a specific location where a client can communicate with a backend operation.&lt;/p&gt;

&lt;p&gt;For our login example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is the endpoint responsible for handling the login request.&lt;/p&gt;

&lt;p&gt;The browser communicates with the backend through this API instead of directly accessing the database.&lt;/p&gt;

&lt;p&gt;The architecture can look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
API
   ↓
Backend
   ↓
Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The frontend should not directly connect to your database.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. The Backend Receives the Request
&lt;/h2&gt;

&lt;p&gt;Now the request reaches the backend.&lt;/p&gt;

&lt;p&gt;For example, an Express.js application might have something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Login logic goes here&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend receives the email and password.&lt;/p&gt;

&lt;p&gt;But it should &lt;strong&gt;not blindly trust the data coming from the browser&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The server needs to validate it.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. The Backend Validates the Input
&lt;/h2&gt;

&lt;p&gt;The backend might check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Is an email provided?
Is a password provided?
Is the email valid?
Are the values in the expected format?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, if the user submits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the server can reject the request.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;input validation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Validation is important because data coming from the client can never be assumed to be trustworthy.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. The Backend Looks for the User
&lt;/h2&gt;

&lt;p&gt;Suppose the email is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sam@example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend needs to find out whether an account with that email exists.&lt;/p&gt;

&lt;p&gt;It might query the database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password_hash&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'sam@example.com'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database might return something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id: 42
email: sam@example.com
password_hash: $2b$12$...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice something important.&lt;/p&gt;

&lt;p&gt;The database does &lt;strong&gt;not&lt;/strong&gt; contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;password: MyPassword123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, it contains a &lt;strong&gt;password hash&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Passwords Should Not Be Stored as Plain Text
&lt;/h2&gt;

&lt;p&gt;Imagine a database storing passwords like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sam@example.com → MyPassword123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the database were compromised, attackers could immediately see the users' passwords.&lt;/p&gt;

&lt;p&gt;That's why applications should not store user passwords as plain text.&lt;/p&gt;

&lt;p&gt;Instead, passwords are processed using dedicated &lt;strong&gt;password-hashing algorithms&lt;/strong&gt; such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;bcrypt&lt;/li&gt;
&lt;li&gt;scrypt&lt;/li&gt;
&lt;li&gt;Argon2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The basic idea is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Password
   ↓
Password Hashing
   ↓
Password Hash
   ↓
Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database stores the hash rather than the original password.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. How Does Password Verification Work?
&lt;/h2&gt;

&lt;p&gt;Now you might wonder:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If the original password isn't stored, how can the server check whether my password is correct?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Good question.&lt;/p&gt;

&lt;p&gt;When you log in, the server takes the password you entered and uses the password-hashing algorithm to verify it against the stored password hash.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Password entered by user
          ↓
   Password verification
          ↓
Stored password hash
          ↓
     Match or not?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the password doesn't match:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication Failed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it matches:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication Successful
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server does not need to retrieve the original password from the database.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Authentication — Who Are You?
&lt;/h2&gt;

&lt;p&gt;This brings us to the main concept of the article:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Authentication means &lt;strong&gt;verifying the identity of a user&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you enter your email and password, the application is essentially asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Are you really the user associated with these credentials?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If the credentials are correct:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication → Successful
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If they aren't:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication → Failed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But authentication is not the same as authorization.&lt;/p&gt;




&lt;h2&gt;
  
  
  Authentication vs Authorization
&lt;/h2&gt;

&lt;p&gt;These two words are easy to confuse.&lt;/p&gt;

&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Who are you?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Login successful
       ↓
You are Sam
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Authorization
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What are you allowed to do?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are Sam
     ↓
Are you allowed to access /admin?
     ↓
No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication → Who are you?
Authorization  → What can you access?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can be successfully authenticated but still not have permission to access certain resources.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. The Server Needs to Remember Your Login
&lt;/h2&gt;

&lt;p&gt;Here's another interesting problem.&lt;/p&gt;

&lt;p&gt;HTTP is largely &lt;strong&gt;stateless&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That means one request doesn't automatically mean the server remembers everything about previous requests.&lt;/p&gt;

&lt;p&gt;Imagine you successfully log in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How does the server know that the &lt;code&gt;/profile&lt;/code&gt; request belongs to the user who just logged in?&lt;/p&gt;

&lt;p&gt;The application needs some way to maintain &lt;strong&gt;authentication state&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Two common approaches are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Session-based authentication
            OR
Token-based authentication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's understand both at a high level.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Session-Based Authentication
&lt;/h2&gt;

&lt;p&gt;In session-based authentication, the server creates a session after successful login.&lt;/p&gt;

&lt;p&gt;The simplified flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User logs in
     ↓
Credentials verified
     ↓
Server creates a session
     ↓
Session ID sent to browser
     ↓
Browser sends session ID with future requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser commonly stores the session identifier in a cookie.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;session_id=abc123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Later, when you request your profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /profile
Cookie: session_id=abc123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server can use that session ID to identify the authenticated user.&lt;/p&gt;

&lt;p&gt;So the flow becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
Session Cookie
   ↓
Server
   ↓
Session
   ↓
User identified
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  12. What Is a Cookie?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;cookie&lt;/strong&gt; is a small piece of data that a website can ask the browser to store and send with relevant requests.&lt;/p&gt;

&lt;p&gt;Cookies can be used for many things, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login sessions&lt;/li&gt;
&lt;li&gt;User preferences&lt;/li&gt;
&lt;li&gt;Shopping carts&lt;/li&gt;
&lt;li&gt;Other application state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For authentication, a cookie can contain a session identifier.&lt;/p&gt;

&lt;p&gt;Security-sensitive cookies are commonly configured with attributes such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Secure
HttpOnly
SameSite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These attributes help protect authentication cookies against certain attacks and misuse.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Token-Based Authentication
&lt;/h2&gt;

&lt;p&gt;Another approach is &lt;strong&gt;token-based authentication&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After a successful login, the server issues a token.&lt;/p&gt;

&lt;p&gt;One commonly used token format is &lt;strong&gt;JWT (JSON Web Token)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The simplified flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User logs in
     ↓
Credentials verified
     ↓
Server creates token
     ↓
Browser receives token
     ↓
Future requests include token
     ↓
Server validates token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A request might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Authorization: Bearer &amp;lt;token&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server can validate the token and determine whether the request is authenticated.&lt;/p&gt;

&lt;p&gt;One important point:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;JWT is a token format, not a synonym for authentication.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Authentication is the overall process of verifying identity.&lt;/p&gt;

&lt;p&gt;JWT is simply one technology that can be used to carry authentication-related information.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. The Server Sends a Response
&lt;/h2&gt;

&lt;p&gt;Once authentication succeeds, the backend sends an HTTP response to the browser.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="ne"&gt;OK&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The response might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Login successful"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The response can also establish authentication state, such as setting a session cookie.&lt;/p&gt;

&lt;p&gt;If authentication fails, the server sends an appropriate error response instead.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invalid credentials
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The frontend can then display an error message to the user.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. The User Is Now Logged In
&lt;/h2&gt;

&lt;p&gt;After successful authentication, the browser has the information required to make authenticated requests.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Login
  ↓
Authentication successful
  ↓
Session / Token
  ↓
GET /profile
  ↓
Server identifies user
  ↓
Profile returned
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's why after logging in, you can move between pages without entering your password every time.&lt;/p&gt;

&lt;p&gt;The browser keeps sending the relevant authentication information, and the server uses it to recognize the user.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Happens If the Login Fails?
&lt;/h1&gt;

&lt;p&gt;Let's say Sam enters the wrong password.&lt;/p&gt;

&lt;p&gt;The flow becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User enters credentials
        ↓
POST /api/login
        ↓
Backend
        ↓
Find user
        ↓
Verify password
        ↓
Password doesn't match
        ↓
Authentication failed
        ↓
HTTP response
        ↓
Browser shows error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The user might see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invalid email or password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application should also avoid revealing unnecessary information about whether a particular account exists.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Complete Login Journey
&lt;/h1&gt;

&lt;p&gt;Now let's put everything together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User enters email + password
            ↓
       Clicks Login
            ↓
     Browser / JavaScript
            ↓
      POST /api/login
            ↓
        Backend API
            ↓
      Validate input
            ↓
     Find user in database
            ↓
    Retrieve password hash
            ↓
     Verify password
            ↓
       ┌───────────────┐
       │               │
     Failed         Successful
       │               │
       ↓               ↓
 Error response    Create session
                       or token
                        ↓
                  HTTP response
                        ↓
                     Browser
                        ↓
               Authenticated user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple login button can trigger all of this behind the scenes.&lt;/p&gt;




&lt;h1&gt;
  
  
  A Simple Mental Model
&lt;/h1&gt;

&lt;p&gt;You don't need to memorize every technical term.&lt;/p&gt;

&lt;p&gt;Think of the process as a story:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;I enter my credentials → the browser sends them to the backend → the backend validates the request → finds my account → verifies my password → creates authentication state → sends a response → the browser uses that state for future requests.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Login Form
    ↓
POST Request
    ↓
Backend
    ↓
Database
    ↓
Password Verification
    ↓
Session / Token
    ↓
Response
    ↓
Authenticated User
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Final Takeaway
&lt;/h1&gt;

&lt;p&gt;The next time you click a &lt;strong&gt;Login&lt;/strong&gt; button, remember that the button itself isn't doing the authentication.&lt;/p&gt;

&lt;p&gt;It starts a conversation between several parts of the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
API
   ↓
Backend
   ↓
Database
   ↓
Authentication
   ↓
Session / Token
   ↓
Browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser collects the credentials and sends a request.&lt;/p&gt;

&lt;p&gt;The backend validates the request and checks the user's account.&lt;/p&gt;

&lt;p&gt;The password is verified against a stored password hash.&lt;/p&gt;

&lt;p&gt;If everything is correct, the application creates some form of authentication state, such as a session or token.&lt;/p&gt;

&lt;p&gt;That authentication state allows the server to recognize the user on future requests.&lt;/p&gt;

&lt;p&gt;And that's the basic idea behind what happens when you click &lt;strong&gt;Login&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're learning full-stack development, the next time you click &lt;strong&gt;Login&lt;/strong&gt;, don't just think about the button.&lt;/p&gt;

&lt;p&gt;Think about the entire conversation happening behind it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>authentication</category>
      <category>backend</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What Happens When You Type a URL in the Browser?</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 09 Aug 2026 11:12:38 +0000</pubDate>
      <link>https://dev.to/darshan_dev/what-happens-when-you-type-a-url-in-the-browser-4epo</link>
      <guid>https://dev.to/darshan_dev/what-happens-when-you-type-a-url-in-the-browser-4epo</guid>
      <description>&lt;p&gt;You type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;into your browser and press &lt;strong&gt;Enter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A few seconds later, the webpage appears.&lt;/p&gt;

&lt;p&gt;It feels like the browser simply opened the website.&lt;/p&gt;

&lt;p&gt;But behind that simple action, several things happened involving the &lt;strong&gt;browser, DNS, IP addresses, HTTP, servers, and browser rendering&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So what actually happens between pressing &lt;strong&gt;Enter&lt;/strong&gt; and seeing the webpage?&lt;/p&gt;

&lt;p&gt;Let's follow the journey.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;At a high level, the journey looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You type a URL
      ↓
    Browser
      ↓
     DNS
      ↓
  IP Address
      ↓
  Connection
      ↓
 HTTP Request
      ↓
    Server
      ↓
HTTP Response
      ↓
 HTML / CSS / JS
      ↓
Browser Rendering
      ↓
  Web Page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's understand what happens at each step.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Browser Starts With the URL
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;URL (Uniform Resource Locator)&lt;/strong&gt; is a string that identifies the location of a resource on the internet and tells the browser how to access it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com/products?id=10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It contains different parts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com/products?id=10
   ↓          ↓          ↓        ↓
Protocol    Domain     Path     Query
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;https&lt;/code&gt; part tells the browser to use secure HTTP communication.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;example.com&lt;/code&gt; is the domain name.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/products&lt;/code&gt; is the path.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;?id=10&lt;/code&gt; is a query parameter that provides additional information to the server.&lt;/p&gt;

&lt;p&gt;So when you type a URL, you're basically giving the browser an &lt;strong&gt;address and instructions for accessing a resource&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But there's a problem.&lt;/p&gt;

&lt;p&gt;The browser can't communicate across the internet using just the human-friendly name &lt;code&gt;example.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It needs an IP address.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. DNS Finds the IP Address
&lt;/h2&gt;

&lt;p&gt;This is where &lt;strong&gt;DNS (Domain Name System)&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;DNS is a system that helps translate domain names into IP addresses.&lt;/p&gt;

&lt;p&gt;Think of it like the internet's phonebook.&lt;/p&gt;

&lt;p&gt;You remember:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the network needs an IP address to identify the destination.&lt;/p&gt;

&lt;p&gt;So the simplified process looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example.com
     ↓
    DNS
     ↓
IP Address
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An IPv4 address might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;93.184.216.34
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual address returned depends on the website and its DNS configuration.&lt;/p&gt;

&lt;p&gt;The browser or operating system may already have the answer cached, so a DNS lookup isn't always required from scratch.&lt;/p&gt;

&lt;p&gt;But conceptually, the important idea is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;DNS helps the browser find the IP address associated with the domain name.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now the browser knows where it needs to communicate.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Browser Connects to the Server
&lt;/h2&gt;

&lt;p&gt;Once the browser knows the destination IP address, it needs to establish a suitable network connection.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;server&lt;/strong&gt; is a computer or software system that provides resources or services to clients.&lt;/p&gt;

&lt;p&gt;In our case:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser → Client
Server  → Provides the requested resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For many traditional web connections, HTTP/1.1 and HTTP/2 use &lt;strong&gt;TCP (Transmission Control Protocol)&lt;/strong&gt; as the transport protocol.&lt;/p&gt;

&lt;p&gt;TCP helps provide reliable and ordered delivery of data between applications.&lt;/p&gt;

&lt;p&gt;You don't need to memorize the TCP handshake to understand this article.&lt;/p&gt;

&lt;p&gt;The simple idea is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The browser needs a network connection through which it can communicate with the server.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For modern HTTP/3 connections, the transport works differently because HTTP/3 uses &lt;strong&gt;QUIC&lt;/strong&gt; instead of TCP.&lt;/p&gt;

&lt;p&gt;For now, the important thing is understanding that the browser needs a suitable connection before exchanging web data.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. HTTPS Makes the Communication Secure
&lt;/h2&gt;

&lt;p&gt;Our URL starts with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;S&lt;/code&gt; in HTTPS stands for &lt;strong&gt;Secure&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;HTTPS uses &lt;strong&gt;TLS (Transport Layer Security)&lt;/strong&gt; to protect HTTP communication.&lt;/p&gt;

&lt;p&gt;TLS helps provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encryption&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Integrity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple terms, TLS helps protect the communication between your browser and the server and helps the browser verify the server's identity.&lt;/p&gt;

&lt;p&gt;A simplified flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
Network Connection
   ↓
TLS
   ↓
Secure Communication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the browser is ready to communicate with the server securely.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. The Browser Sends an HTTP Request
&lt;/h2&gt;

&lt;p&gt;Now comes &lt;strong&gt;HTTP (Hypertext Transfer Protocol)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;HTTP is a protocol that allows clients and servers to communicate on the web.&lt;/p&gt;

&lt;p&gt;The browser sends an &lt;strong&gt;HTTP request&lt;/strong&gt; to the server.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;GET&lt;/span&gt; &lt;span class="nn"&gt;/products?id=10&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser is essentially saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I want the &lt;code&gt;/products?id=10&lt;/code&gt; resource from &lt;code&gt;example.com&lt;/code&gt;."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;GET&lt;/code&gt; is an HTTP method commonly used when requesting a resource.&lt;/p&gt;

&lt;p&gt;An HTTP request can contain things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Method&lt;/li&gt;
&lt;li&gt;Path&lt;/li&gt;
&lt;li&gt;Headers&lt;/li&gt;
&lt;li&gt;Request body, when needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For our example, the browser is mainly asking the server to retrieve something.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. The Server Processes the Request
&lt;/h2&gt;

&lt;p&gt;The server receives the request.&lt;/p&gt;

&lt;p&gt;Now it has to figure out what to do with it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /products?id=10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server might:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Understand the requested path.&lt;/li&gt;
&lt;li&gt;Read the query parameter.&lt;/li&gt;
&lt;li&gt;Run application logic.&lt;/li&gt;
&lt;li&gt;Query a database.&lt;/li&gt;
&lt;li&gt;Prepare the required data.&lt;/li&gt;
&lt;li&gt;Create a response.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a simple website, the server might just return an HTML file.&lt;/p&gt;

&lt;p&gt;For a dynamic application, there could be much more happening:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
HTTP Request
   ↓
Server
   ↓
Application
   ↓
Database
   ↓
Application
   ↓
Server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is one reason why a simple button click in a web application can trigger many operations behind the scenes.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. The Server Sends an HTTP Response
&lt;/h2&gt;

&lt;p&gt;After processing the request, the server sends an &lt;strong&gt;HTTP response&lt;/strong&gt; back to the browser.&lt;/p&gt;

&lt;p&gt;A response usually contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Status code&lt;/li&gt;
&lt;li&gt;Headers&lt;/li&gt;
&lt;li&gt;Response body&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="ne"&gt;OK&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;text/html&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The response body may contain the HTML for the webpage.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;status code&lt;/strong&gt; tells the browser the general result of the request.&lt;/p&gt;

&lt;p&gt;Some common examples are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200 → OK
301 → Moved Permanently
302 → Found
400 → Bad Request
401 → Unauthorized
403 → Forbidden
404 → Not Found
500 → Internal Server Error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200 OK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;generally means the request was successfully processed.&lt;/p&gt;

&lt;p&gt;If the requested resource doesn't exist, the server might return:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;404 Not Found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the browser now has a response.&lt;/p&gt;

&lt;p&gt;But it still has more work to do.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. The Browser Receives HTML, CSS and JavaScript
&lt;/h2&gt;

&lt;p&gt;The response may contain HTML.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;My Website&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello World&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Welcome to my website.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTML&lt;/strong&gt; gives the webpage its structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML → Structure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The HTML may also reference other resources such as CSS, JavaScript, images, and fonts.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/app.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/logo.png"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser can then make additional requests to retrieve those resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;CSS (Cascading Style Sheets)&lt;/strong&gt; controls how the webpage looks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;blue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;32px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS → Appearance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  JavaScript
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;JavaScript&lt;/strong&gt; adds behavior and interactivity.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JavaScript → Behavior
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple mental model is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML       → Structure
CSS        → Appearance
JavaScript → Behavior
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  9. The Browser Builds the Page
&lt;/h2&gt;

&lt;p&gt;Now the browser has to turn all these resources into something you can actually see.&lt;/p&gt;

&lt;p&gt;The browser parses the HTML and builds the &lt;strong&gt;DOM (Document Object Model)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The DOM represents the webpage as a tree of elements.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Welcome&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;can be represented conceptually as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;html
└── body
    ├── h1
    │   └── "Hello"
    └── p
        └── "Welcome"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser also processes CSS to determine how those elements should look.&lt;/p&gt;

&lt;p&gt;It then performs rendering work such as calculating layout and painting the page.&lt;/p&gt;

&lt;p&gt;Very roughly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML
 ↓
DOM

CSS
 ↓
Style Information

DOM + CSS
 ↓
Layout
 ↓
Paint
 ↓
Screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript may also modify the page or request additional data while the page is loading or after it has loaded.&lt;/p&gt;

&lt;p&gt;Finally:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You see the webpage.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  So What Actually Happened?
&lt;/h1&gt;

&lt;p&gt;Let's go back to the beginning.&lt;/p&gt;

&lt;p&gt;You typed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and pressed &lt;strong&gt;Enter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Behind the scenes, a simplified version of the journey was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Browser receives the URL
          ↓
2. Browser needs to find the destination
          ↓
3. DNS helps resolve the domain to an IP address
          ↓
4. Browser establishes the required connection
          ↓
5. HTTPS provides secure communication when applicable
          ↓
6. Browser sends an HTTP request
          ↓
7. Server receives and processes the request
          ↓
8. Server sends an HTTP response
          ↓
9. Browser receives HTML and other resources
          ↓
10. Browser processes HTML, CSS and JavaScript
          ↓
11. Browser renders the page
          ↓
12. You see the website
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What looked like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Type URL → Press Enter → Website
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;was actually closer to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;URL
 ↓
Browser
 ↓
DNS
 ↓
IP Address
 ↓
Connection
 ↓
HTTP Request
 ↓
Server
 ↓
HTTP Response
 ↓
HTML / CSS / JS
 ↓
Browser Rendering
 ↓
Web Page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  One More Thing: Real Websites Can Be More Complicated
&lt;/h1&gt;

&lt;p&gt;The flow above is a simplified mental model.&lt;/p&gt;

&lt;p&gt;Real-world websites can involve many additional components, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser caching&lt;/li&gt;
&lt;li&gt;DNS caching&lt;/li&gt;
&lt;li&gt;HTTP caching&lt;/li&gt;
&lt;li&gt;CDNs&lt;/li&gt;
&lt;li&gt;Load balancers&lt;/li&gt;
&lt;li&gt;Proxies&lt;/li&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;li&gt;Cookies&lt;/li&gt;
&lt;li&gt;Sessions&lt;/li&gt;
&lt;li&gt;Redirects&lt;/li&gt;
&lt;li&gt;HTTP/2&lt;/li&gt;
&lt;li&gt;HTTP/3&lt;/li&gt;
&lt;li&gt;QUIC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a real request might look more like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   ↓
DNS
   ↓
CDN / Load Balancer
   ↓
Web Server
   ↓
Application Server
   ↓
Database
   ↓
Response
   ↓
Browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you don't need to understand everything at once.&lt;/p&gt;

&lt;p&gt;The important thing is to understand the basic journey first.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Takeaway
&lt;/h1&gt;

&lt;p&gt;The next time you type a URL and press Enter, remember that the webpage doesn't simply appear from nowhere.&lt;/p&gt;

&lt;p&gt;The browser has to find the destination, communicate with the server, request the resource, receive the response, download additional resources, and finally render everything on your screen.&lt;/p&gt;

&lt;p&gt;The whole process can be remembered as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;URL
 ↓
DNS
 ↓
IP Address
 ↓
Connection
 ↓
HTTP/HTTPS
 ↓
Request
 ↓
Server
 ↓
Response
 ↓
HTML / CSS / JS
 ↓
Browser Rendering
 ↓
Web Page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple action like pressing &lt;strong&gt;Enter&lt;/strong&gt; hides a lot of interesting engineering underneath.&lt;/p&gt;

&lt;p&gt;And that's what happens when you type a URL in the browser.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Thanks for reading!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're learning web development too, the next time you open a website, don't just look at the page.&lt;/p&gt;

&lt;p&gt;Think about the journey that happened before you could see it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>What Happens If a Bank Transfer Fails Halfway? Understanding ACID Properties in SQL</title>
      <dc:creator>Darshan R</dc:creator>
      <pubDate>Sun, 02 Aug 2026 14:04:26 +0000</pubDate>
      <link>https://dev.to/darshan_dev/what-happens-if-a-bank-transfer-fails-halfway-understanding-acid-properties-in-sql-1oe</link>
      <guid>https://dev.to/darshan_dev/what-happens-if-a-bank-transfer-fails-halfway-understanding-acid-properties-in-sql-1oe</guid>
      <description>&lt;p&gt;Imagine transferring &lt;strong&gt;₹5,000&lt;/strong&gt; from one bank account to another.&lt;/p&gt;

&lt;p&gt;Let's say Jeni has &lt;strong&gt;₹25,000&lt;/strong&gt; in his account, and Dravid has &lt;strong&gt;₹15,000&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Jeni wants to transfer &lt;strong&gt;₹5,000&lt;/strong&gt; to Dravid.&lt;/p&gt;

&lt;p&gt;If everything works correctly, two things happen:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;₹5,000 is deducted from Jeni's account.&lt;/li&gt;
&lt;li&gt;₹5,000 is credited to Dravid's account.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before the transfer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹25,000
Dravid → ₹15,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the transfer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹20,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple, right?&lt;/p&gt;

&lt;p&gt;But what happens if something goes wrong halfway through?&lt;/p&gt;

&lt;p&gt;Suppose ₹5,000 is successfully deducted from Jeni's account, but before the money is credited to Dravid's account, the application crashes.&lt;/p&gt;

&lt;p&gt;Now the database contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹15,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Jeni has lost ₹5,000, but Dravid never received it.&lt;/p&gt;

&lt;p&gt;That's a serious problem.&lt;/p&gt;

&lt;p&gt;In real-world applications, failures can happen because of application errors, system crashes, network failures, or other unexpected situations.&lt;/p&gt;

&lt;p&gt;So how do databases prevent operations from being left halfway completed?&lt;/p&gt;

&lt;p&gt;That's where &lt;strong&gt;database transactions&lt;/strong&gt; and &lt;strong&gt;ACID properties&lt;/strong&gt; come in.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is a Database Transaction?
&lt;/h2&gt;

&lt;p&gt;A database transaction is a logical group of one or more database operations treated as a &lt;strong&gt;single unit of work&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: This is a simplified example created to explain database transactions. Real banking systems involve additional layers of validation, security, and financial processing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In our bank transfer example, there are two important operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Jeni'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Dravid'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These two operations belong together.&lt;/p&gt;

&lt;p&gt;We don't want the first operation to permanently succeed while the second one fails.&lt;/p&gt;

&lt;p&gt;Instead, both operations should succeed together.&lt;/p&gt;

&lt;p&gt;A simplified transaction might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;BEGIN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Jeni'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Dravid'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;COMMIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;strong&gt;BEGIN&lt;/strong&gt; starts the transaction, &lt;strong&gt;COMMIT&lt;/strong&gt; permanently saves the changes, and &lt;strong&gt;ROLLBACK&lt;/strong&gt; undoes the changes made by the current transaction if something goes wrong before it is committed.&lt;/p&gt;

&lt;p&gt;If something goes wrong before the transaction is successfully completed, its changes can be rolled back:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ROLLBACK&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prevents the database from being left in an unexpected halfway state.&lt;/p&gt;

&lt;p&gt;But what makes transactions reliable?&lt;/p&gt;

&lt;p&gt;That's where &lt;strong&gt;ACID&lt;/strong&gt; comes in.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Are ACID Properties?
&lt;/h2&gt;

&lt;p&gt;ACID represents four important properties of database transactions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A — Atomicity&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C — Consistency&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;I — Isolation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;D — Durability&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of memorizing these as definitions, let's understand each one using our bank transfer.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Atomicity — All or Nothing
&lt;/h2&gt;

&lt;p&gt;Atomicity means that all operations inside a transaction are treated as &lt;strong&gt;one unit&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Either all operations succeed or none of them take effect.&lt;/p&gt;

&lt;p&gt;Our bank transfer contains two operations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deduct ₹5,000 from Jeni.&lt;/li&gt;
&lt;li&gt;Add ₹5,000 to Dravid.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If both operations succeed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹20,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The transaction can be committed.&lt;/p&gt;

&lt;p&gt;But imagine the system crashes after deducting ₹5,000 from Jeni and before crediting Dravid.&lt;/p&gt;

&lt;p&gt;Without proper transaction handling, we could end up with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹15,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Atomicity prevents the transaction from being permanently left in this halfway-completed state.&lt;/p&gt;

&lt;p&gt;If the complete transaction cannot succeed, its changes are rolled back.&lt;/p&gt;

&lt;p&gt;The accounts return to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹25,000
Dravid → ₹15,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple way to remember &lt;strong&gt;Atomicity&lt;/strong&gt; is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Everything succeeds, or the transaction doesn't happen.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. Consistency — Keep the Database Valid
&lt;/h2&gt;

&lt;p&gt;Consistency means that a successful transaction should move the database from one &lt;strong&gt;valid state to another&lt;/strong&gt; while respecting the rules and constraints defined for the data.&lt;/p&gt;

&lt;p&gt;Let's look at our simplified bank example.&lt;/p&gt;

&lt;p&gt;Before the transfer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹25,000
Dravid → ₹15,000

Total → ₹40,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After transferring ₹5,000:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹20,000

Total → ₹40,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The money moved from one account to another, but it wasn't magically created or destroyed.&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;consistency is broader than simply keeping the total balance unchanged.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A database may have rules such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A balance cannot violate defined constraints.&lt;/li&gt;
&lt;li&gt;Required values cannot be missing.&lt;/li&gt;
&lt;li&gt;Relationships between records must remain valid.&lt;/li&gt;
&lt;li&gt;Data must satisfy the rules defined by the database and application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A transaction should not leave the database violating these rules.&lt;/p&gt;

&lt;p&gt;A simple way to remember &lt;strong&gt;Consistency&lt;/strong&gt; is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The database should remain valid before and after a transaction.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. Isolation — Transactions Shouldn't Interfere Unexpectedly
&lt;/h2&gt;

&lt;p&gt;Real applications don't process only one transaction at a time.&lt;/p&gt;

&lt;p&gt;Thousands of users may perform operations simultaneously.&lt;/p&gt;

&lt;p&gt;Imagine two transactions happening around the same time:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transaction A:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni transfers ₹5,000 to Dravid.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Transaction B:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni transfers ₹2,000 to Alex.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both transactions may try to read or modify Jeni's account balance.&lt;/p&gt;

&lt;p&gt;Think of it like two people trying to update the same account at the same time. Isolation helps make sure their transactions don't interfere with each other in unexpected ways.&lt;/p&gt;

&lt;p&gt;If concurrency isn't handled correctly, one transaction could read an intermediate value or interfere with another transaction's work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Isolation&lt;/strong&gt; controls how concurrent transactions can see and interact with each other's changes.&lt;/p&gt;

&lt;p&gt;The goal is to prevent unsafe interference and provide predictable results according to the database's isolation guarantees.&lt;/p&gt;

&lt;p&gt;Databases can provide different &lt;strong&gt;isolation levels&lt;/strong&gt;, so this doesn't necessarily mean every transaction literally runs one after another.&lt;/p&gt;

&lt;p&gt;A simple way to remember &lt;strong&gt;Isolation&lt;/strong&gt; is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Concurrent transactions should not expose unsafe intermediate states to each other.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. Durability — Committed Means Saved
&lt;/h2&gt;

&lt;p&gt;Now imagine our transaction completes successfully.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹20,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database confirms that the transaction has been &lt;strong&gt;committed&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Then, one second later, the server crashes.&lt;/p&gt;

&lt;p&gt;Should the transfer disappear?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once a transaction has been successfully committed, &lt;strong&gt;Durability&lt;/strong&gt; means its effects should survive failures such as a system crash.&lt;/p&gt;

&lt;p&gt;After the system recovers, the committed information should still be there.&lt;/p&gt;

&lt;p&gt;Before the crash:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹20,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After recovery:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jeni   → ₹20,000
Dravid → ₹20,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Database systems use mechanisms such as transaction logs and persistent storage to help provide this guarantee.&lt;/p&gt;

&lt;p&gt;A simple way to remember &lt;strong&gt;Durability&lt;/strong&gt; is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Once committed, the result stays committed.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Putting ACID Together
&lt;/h2&gt;

&lt;p&gt;Let's return to the ₹5,000 bank transfer one final time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Atomicity
&lt;/h3&gt;

&lt;p&gt;The debit and credit should succeed together or be rolled back.&lt;/p&gt;

&lt;h3&gt;
  
  
  Consistency
&lt;/h3&gt;

&lt;p&gt;The transaction should preserve the rules that define a valid database state.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation
&lt;/h3&gt;

&lt;p&gt;Other transactions should not interfere with the transfer in unsafe ways.&lt;/p&gt;

&lt;h3&gt;
  
  
  Durability
&lt;/h3&gt;

&lt;p&gt;Once the transfer is committed, its result should survive failures.&lt;/p&gt;

&lt;p&gt;Together, these properties help databases execute transactions reliably.&lt;/p&gt;




&lt;h2&gt;
  
  
  ACID Is Not Just About Banking
&lt;/h2&gt;

&lt;p&gt;Bank transfers are one of the easiest examples for understanding ACID, but transactional reliability is useful in many other systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛒 E-commerce
&lt;/h3&gt;

&lt;p&gt;Placing an order may involve updating inventory, creating an order record, and recording payment-related information.&lt;/p&gt;

&lt;p&gt;These related operations may need to succeed together.&lt;/p&gt;

&lt;h3&gt;
  
  
  🎟️ Ticket Booking
&lt;/h3&gt;

&lt;p&gt;Multiple users may attempt to reserve the same seat at nearly the same time.&lt;/p&gt;

&lt;p&gt;Transaction handling helps prevent conflicting operations from producing incorrect results.&lt;/p&gt;

&lt;h3&gt;
  
  
  📦 Inventory Systems
&lt;/h3&gt;

&lt;p&gt;A purchase may require stock quantities and related records to be updated together.&lt;/p&gt;

&lt;p&gt;The system shouldn't reduce stock while failing to create the corresponding order information.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌐 Social Platforms
&lt;/h3&gt;

&lt;p&gt;Some actions may require multiple related database changes that need to remain consistent.&lt;/p&gt;

&lt;p&gt;The exact transaction design and guarantees depend on the application and database being used.&lt;/p&gt;

&lt;p&gt;But the underlying problem remains similar:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Related data changes shouldn't leave the system in an unexpected halfway state.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Final Takeaway
&lt;/h2&gt;

&lt;p&gt;When I first came across ACID properties, the four terms could easily look like definitions that simply needed to be memorized.&lt;/p&gt;

&lt;p&gt;But they're much easier to understand when we start with a real-world question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What happens if a bank transfer fails halfway?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That single scenario explains why reliable database transactions are so important.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Atomicity   → All or nothing
Consistency → Keep the database valid
Isolation   → Control concurrent transactions
Durability  → Committed data survives
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next time you transfer money, book a ticket, or place an online order, remember that behind a simple button click there may be multiple database operations that need to work together safely.&lt;/p&gt;

&lt;p&gt;And that's exactly the kind of problem database transactions are designed to solve.&lt;/p&gt;




&lt;p&gt;If you're learning SQL or databases too, I hope this bank-transfer example made ACID properties a little easier to understand.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
