<?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>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="no"&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;₹1,000&lt;/strong&gt; from one bank account to another.&lt;/p&gt;

&lt;p&gt;Let's say Jeni has &lt;strong&gt;₹10,000&lt;/strong&gt; in his account, and Dravid has &lt;strong&gt;₹5,000&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Jeni wants to transfer &lt;strong&gt;₹1,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;₹1,000 is deducted from Jeni's account.&lt;/li&gt;
&lt;li&gt;₹1,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   → ₹10,000
Dravid → ₹5,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   → ₹9,000
Dravid → ₹6,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 ₹1,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   → ₹9,000
Dravid → ₹5,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Jeni has lost ₹1,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;1000&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;1000&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;1000&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;1000&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 ₹1,000 from Jeni.&lt;/li&gt;
&lt;li&gt;Add ₹1,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   → ₹9,000
Dravid → ₹6,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 ₹1,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   → ₹9,000
Dravid → ₹5,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   → ₹10,000
Dravid → ₹5,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   → ₹10,000
Dravid → ₹5,000

Total → ₹15,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After transferring ₹1,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   → ₹9,000
Dravid → ₹6,000

Total → ₹15,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 ₹1,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   → ₹9,000
Dravid → ₹6,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   → ₹9,000
Dravid → ₹6,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   → ₹9,000
Dravid → ₹6,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 ₹1,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>
