<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[The Build Log]]></title><description><![CDATA[The Build Log]]></description><link>https://blog.ayushsawant.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 23:23:46 GMT</lastBuildDate><atom:link href="https://blog.ayushsawant.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Keeping Promises in JavaScript (Unlike Real Life)]]></title><description><![CDATA[Life Doesn’t Pause. Neither Does JavaScript.
When ordering food in a cafe, you go to the counter, place an order by making payment, and the cashier hands you a buzzer. You don't stand in front of the ]]></description><link>https://blog.ayushsawant.dev/keeping-promises-in-javascript-unlike-real-life</link><guid isPermaLink="true">https://blog.ayushsawant.dev/keeping-promises-in-javascript-unlike-real-life</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Sun, 01 Mar 2026 11:45:23 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/695bc1edb25e65753dc4cdcb/fc0bd799-1886-4c71-9493-375a2c7f29e2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Life Doesn’t Pause. Neither Does JavaScript.</h2>
<p>When ordering food in a cafe, you go to the counter, place an order by making payment, and the cashier hands you a buzzer. You don't stand in front of the cashier while your order is being prepared, blocking the queue for everyone after you. You take the buzzer and sit down, scrolling through your phone until your order is ready. You are doing other tasks while the food is cooking in the background. When the food is ready, the buzzer rings and signals you to collect the food at the counter (this is promise resolving!), and now you go get the food. <em><strong>JavaScript deals with waiting the same way</strong></em>.</p>
<h2>What Promises exactly are:</h2>
<p>A Promise in JavaScript represents that an block of code will eventually be completed or failed and also represents the result value.</p>
<p>A promise has 3 states being:</p>
<ol>
<li><p><strong>Pending</strong> -&gt; The initial state where the tasks has not yet been completed.</p>
</li>
<li><p><strong>Fulfilled</strong> -&gt; The task has been completed successfully.</p>
</li>
<li><p><strong>Rejected</strong> -&gt; The task has failed.</p>
</li>
</ol>
<pre><code class="language-javascript">function prepareOrder(dish) {
  return new Promise((resolve, reject) =&gt; { 
    setTimeout(() =&gt; {
      if (!dish) {    //if no dish(argument) has been passed, reject state
        reject(new Error("No dish is there"));
        return;
      }
      console.log(`${dish} is ready`);
      resolve({ dish, status: "prepared" });
    }, 100);                //100 milli-second of delay has been added
  });
}
</code></pre>
<h2><code>Promise.all()</code></h2>
<p><em>The scenario:</em></p>
<p>Imagine a group chat is planning a weekend trip to Goa. For this trip to happen, there are four friends who want to go but there are certain conditions before going.</p>
<ol>
<li><p><strong>Ayush</strong> -&gt; needs to get permission from his parents.</p>
</li>
<li><p><strong>Himanshu</strong> -&gt; needs to get his money back from a friend who he lended money, to fund hotels.</p>
</li>
<li><p><strong>Ishan</strong> -&gt; needs to bring his car.</p>
</li>
<li><p><strong>Raj</strong> -&gt; needs to just show-up. (he is lazy)</p>
</li>
</ol>
<p>If Ayush and Himanshu are ready to go, but Ishan says that he cant get the car, then the whole plan is completely dead. You can't go on a partial trip without a car. It's everyone, or it's no one.</p>
<p><strong>Translating the analogy to JavaScript</strong></p>
<p><code>Promise.all()</code> works in a similar way, where the group chat is <code>Promise.all([Ayush, Himanshu, Ishan])</code> and <code>.then</code> is every single friend confirming that he is coming and the trip is officially on.</p>
<p><strong>The Rejection (</strong><code>.catch</code><strong>)</strong>: This is the important part of <code>Promise.all()</code> . As soon as Ishan says he can't get his car, the plan is cancelled immediately. The group chat doesn't care anymore if Ayush got permission or if Raj is coming. This is when <code>.catch</code> triggers and none of the other promises resolve.</p>
<pre><code class="language-javascript">const Ayush = Promise.resolve("Got permission, Let's go!.")
const Himanshu = Promise.resolve("Got the money! ")
const Ishan= Promise.reject("Couldn't get the car, Abba nahi maane 😭")
const Raj = Promise.resolve("Bags Packed, I am ready to go!")

Promise.all([Ayush, Himanshu, Ishan, Raj])
  .then((confirmations) =&gt; {
    console.log("The Plan is ON!, Pack your bags!")
  })
  .catch((reasons)=&gt;{
    console.log("Trip cancelled because: ", reasons)
  })
//Output: Trip cancelled because: Couldn't get the car, Abba nahi maane 😭
</code></pre>
<p>If everything goes as planned and trip happens, then the result will be returned in an array of 'confirmations' in the same order as input.</p>
<h2><code>Promise.allSettled()</code> :</h2>
<p><strong>Acquiring food at a Wedding Buffet:</strong></p>
<p>Imagine you are at a wedding along with three of your cousins. The buffet just opened and you have planned that each of you will go for different foot stalls to get every food fast.</p>
<ul>
<li><p><strong>Cousin A</strong> goes for Live starter counter (Returns with Panner tikkas = <code>fulfilled</code>)</p>
</li>
<li><p><strong>Cousin B</strong> goes for the main course, but the tandoor broke down and he gets nothing (Fails to get Naan = <code>rejected</code>)</p>
</li>
<li><p><strong>Cousin C</strong> successfully secures Gulab Jamun (Returns with Gulab Jamuns = <code>fulfilled</code>)</p>
</li>
</ul>
<p>If this was <code>Promise.all()</code> you would leave the wedding buffet as soon as tandoor broke down and Cousin B fails to get Naan and be starving, but here we use <code>Promise.allSettled()</code> here, you wait for all cousins to return with whatever they managed to get and just eat whatever survived the chaos.</p>
<pre><code class="language-javascript">const cousinA= Promise.resolve("Paneer Tikka secured");
const cousinB = Promise.reject("Tandoor broke down");
const cousinC = Promise.resolve("Gulab Jamun acquired");

Promise.allSettled([cousinA, cousinB , cousinC ])
  .then((plate) =&gt; {
    console.log("Time to eat! Here is what we got:");
    console.log(plate);
  });

/* OUTPUT:
Time to eat! Here is what we got:
[
  { status: 'fulfilled', value: 'Paneer Tikka secured' },
  { status: 'rejected', reason: 'Tandoor broke down' },
  { status: 'fulfilled', value: 'Gulab Jamun acquired' }
]
*/
</code></pre>
<p><code>Promise.allSettled()</code> executes all the promise statements, both resolved and rejected. It does not care resolve or reject, it returns the result in an array in the same sequence as the original promise array.</p>
<h2><code>Promise.race()</code> :</h2>
<p><em>The Scenario:</em></p>
<p>Imagine it is 2:00am and you are feeling lonely and you make the most chaotic decision of texting three of your exes with the same text "you up?". You hit send on all three at the exact same time.</p>
<ul>
<li><p><strong>Ex A (The fast replier):</strong> Instantly replies in 0.5 seconds: "Do not ever contact me again, I am calling the police."(<code>rejected</code>)</p>
</li>
<li><p><strong>Ex B:</strong> Is currently typing (will resolve in 3 seconds with "I've missed you.")</p>
</li>
<li><p><strong>Ex C:</strong> Is fast asleep (will resolve in 5 hours with "Hey, just woke up, come over.")</p>
</li>
</ul>
<p>Because Ex A was the fastest to reply, she wins the race.</p>
<p><code>Promise.race()</code> takes the brutal rejection as the final answer for the entire night. It instantly throws your phone out of the window, you cry yourself to sleep all alone and lonely.</p>
<pre><code class="language-javascript">const exA = new Promise((_, reject) =&gt; {
  setTimeout(() =&gt; {
    reject("Blocked and reported");
  }, 500); //0.5 seconds
});

const exB = new Promise((resolve) =&gt; {
  setTimeout(() =&gt; {
    resolve("I missed you too &lt;3");
  }, 3000); //3 seconds
});

const exC = new Promise((resolve) =&gt; {
  setTimeout(() =&gt; {
    resolve("Come over");
  }, 18000000); // 18,000,000ms = 5 hours
});

Promise.race([exA, exB, exC])
.then((reply)=&gt;{
  console.log("Success! You got a late night date: ", reply)
  return
})
.catch((disaster) =&gt;{
  console.log("Night ruined. Final result:", disaster)
}
)

// Output: Night ruined. Final result: Blocked and reported 
// (Notice how Ex B and Ex C are completely ignored because Ex A was faster)
</code></pre>
<p>This is exactly how <code>Promise.race()</code> works, race does not care if the promise is resolved or rejected, it just wants the promise which executes the fastest, Everything else that finishes after that is completely ignored.</p>
<h2><code>Promise.any()</code> :</h2>
<p><em>The Scenario:</em></p>
<p>Suppose you are standing on the side of the road during evening rush hour. You need to get home, so you walk up to a line of three parked auto-rickshaws and ask them all if they will go to your area.</p>
<ul>
<li><p><strong>Auto 1 (The VIP):</strong> Looks at you, shakes his head without saying a word and drives off (<code>rejected</code> instantly)</p>
</li>
<li><p><strong>Auto 2 (The Scammer):</strong> Tells you, "Meter se nahi jaunga, 300 lagenge." You refuse. (<code>rejected</code> after negotiation)</p>
</li>
<li><p><strong>Auto 3 (The Legend):</strong> Just nods, resets the meter and says, "Baith Jao." (<code>fulfilled</code>)</p>
</li>
</ul>
<p>We do not care how many drivers rejected as long as atleast one of them says yes.</p>
<pre><code class="language-javascript">const auto1 = new Promise((_,reject) =&gt; setTimeout(() =&gt; {
  reject("Silently drives away")
}, 1000))
const auto2 = new Promise((_,reject) =&gt; setTimeout(() =&gt; {
  reject("Demands double the meter rate!")
}, 3000))
const auto3 = new Promise((resolve) =&gt; setTimeout(() =&gt; {
  resolve("Meter on. Let's Go!")
}, 5000))

Promise.any([auto1, auto2, auto3])
.then((ride)=&gt;{
  console.log("Success! You got a ride home:", ride)
})
// Output: Success! We got a ride home: Meter on. Let's go! 
// Notice how it completely ignored the first two rejections!
</code></pre>
<p><code>Promise.any()</code> ignores the number of rejections as long as there is at least one resolution. It fails only if all promises fail.</p>
<h2>Choosing the Right Promise Strategy:</h2>
<ul>
<li><p><strong>Promise.all() is strict.</strong> It needs all of the promises to resolve and collapses even after one rejection</p>
</li>
<li><p><strong>Promise.allSettled() is realistic.</strong> It reports everything, whether resolution or rejection. It doesn't care.</p>
</li>
<li><p><strong>Promise.race() is impatient.</strong> The first outcome decides everything, be it rejection or fulfillment.</p>
</li>
<li><p><strong>Promise.any() is stubborn.</strong> It gives up when everyone says no.</p>
</li>
</ul>
<blockquote>
<p>In asynchronous JavaScript, the problem is not waiting,</p>
<p>it is waiting the wrong way.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[CSS Selectors 101: Targeting Elements with Precision]]></title><description><![CDATA[Introduction — Why CSS Needs Selectors
CSS cannot apply styles without knowing where to apply a specific style. To style a specific element, there needs to be a unique identifier to select that specific element to be styled. Without, selector all sty...]]></description><link>https://blog.ayushsawant.dev/css-selectors-101-targeting-elements-with-precision</link><guid isPermaLink="true">https://blog.ayushsawant.dev/css-selectors-101-targeting-elements-with-precision</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Sun, 01 Feb 2026 07:53:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769932334817/37a3b390-39f0-4594-b2f9-eefe05b6b6e9.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction-why-css-needs-selectors">Introduction — Why CSS Needs Selectors</h2>
<p>CSS cannot apply styles without knowing where to apply a specific style. To style a specific element, there needs to be a unique identifier to select that specific element to be styled. Without, selector all styling becomes random or gets applied to the entire page. It is like addressing a crowd rather than calling someone specific using their name. Selectors are the foundation of CSS. For precise styling, CSS selectors are needed.</p>
<h2 id="heading-what-is-a-css-selector">What is a CSS Selector?</h2>
<p>Selectors in CSS are used to choose HTML elements. Selectors are the ones who decide who gets styled. Selector works as a filter deciding the specific element or group of elements which are going to be styled next. CSS has a set rule for selector, which says that while writing CSS, first comes the selector name and then comes the declaration block which decides the styling of the selected elements. An example of CSS selector is given below.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span>{
<span class="hljs-attribute">background-color</span>:red;
<span class="hljs-attribute">color</span>:black}
</code></pre>
<h2 id="heading-element-selector">Element Selector</h2>
<p>Element Selector is used to select an element anywhere in the entire HTML document, the given element may have multiple instances and all of them will get styled at the same time. Syntax structure involves writing the name of the tag followed by a curly brace which holds the declaration block which decides the styling of the selected element. It is used for addressing an entire category. An example of Element Selector is given below.</p>
<p>It will make all the text in paragraph tag, red colored anywhere in the entire webpage.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> {
<span class="hljs-attribute">color</span>:red}
</code></pre>
<h2 id="heading-class-selector">Class Selector</h2>
<p>The class selector uses the class attribute from HTML tags. They are accessed in CSS using <code>.</code> notation. They can be reused across multiple elements. One single element can have multiple classes. It is designed for reusable styling patterns. Some of the practical use cases of Class selector are in buttons, cards and layout components. It is really flexible with it usage in various elements. It is like calling everyone wearing a red shirt, when we use class to call every element from that class.</p>
<p>This is an example of <strong>HTML</strong> with class highlight.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"highlight"</span>&gt;</span>Important text<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p><strong>CSS</strong> using class selector for highlight class and adding a background colour yellow to it. It is shown how we used <code>.</code> notation to specific that it is a class.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.highlight</span> {
  <span class="hljs-attribute">background</span>: yellow;
}
</code></pre>
<h2 id="heading-id-selector">ID Selector</h2>
<p>The ID selector uses the ID attribute from HTML tags. They are accessed in CSS using <code>#</code> notation. It is used to target a specific element in the HTML. It is designed for targeted styling patterns. Some of the practical use cases of ID selector are in header and main section. ID should be unique for every page. It is used for single specific elements. It is like calling someone by their full name, when we use ID to call a specific element with that specific name gets styled.</p>
<p>This is an example of <strong>HTML</strong> with class highlight.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"header"</span>&gt;</span>Welcome<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<p><strong>CSS</strong> using ID selector for header id and changing the font size to 24pixels. It is shown how we used <code>#</code> notation to specific that it is using ID.</p>
<pre><code class="lang-css"><span class="hljs-selector-id">#header</span> {
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">24px</span>;
}
</code></pre>
<h2 id="heading-group-selectors">Group Selectors</h2>
<p>Group selector is used to group several selectors into one rule. It is used to combine multiple selectors. It uses comma separated syntax. It is used to avoid repetition in CSS. It improves the readability and maintenance of the CSS.</p>
<p>The CSS below changes the font for all of the headings: h1, h2, h3.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">h1</span>, <span class="hljs-selector-tag">h2</span>, <span class="hljs-selector-tag">h3</span> {
  <span class="hljs-attribute">font-family</span>: Arial;
}
</code></pre>
<p>This would have been the CSS if we didn't use group selectors in CSS. Very lengthy and not clean. Think of it as addressing multiple groups with one announcement.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">h1</span> {
  <span class="hljs-attribute">font-family</span>: Arial;
}
<span class="hljs-selector-tag">h2</span> {
  <span class="hljs-attribute">font-family</span>: Arial;
}
<span class="hljs-selector-tag">h3</span> {
  <span class="hljs-attribute">font-family</span>: Arial;
}
</code></pre>
<h2 id="heading-descendant-selectors">Descendant Selectors</h2>
<p>Descendant Selectors target elements inside other elements.</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">div</span> <span class="hljs-selector-tag">p</span> {
  <span class="hljs-attribute">color</span>: green;
}
</code></pre>
<p>This styles only the paragraphs inside the div tag. It adds context to which paragraph is being styled, it does styling every paragraph but only specific ones based on location. An analogy for Descendant Selectors is like calling all the students inside Room A.</p>
<h2 id="heading-basic-selector-priority">Basic Selector Priority</h2>
<p>When multiple selectors target the same element, CSS decides using priority</p>
<p><strong>ID &gt; Class &gt; Element</strong></p>
<p>IDs have a higher priority compared to classes, while classes have a higher priority compared to elements.</p>
<p>This is called specificity, it prevents conflict between which style gets applied to an element.</p>
]]></content:encoded></item><item><title><![CDATA[Emmet for HTML: A Beginner's Guide to Writing Faster]]></title><description><![CDATA[Writing HTML the slow way
HTML can be quite wordy, making developers spend a lot of time writing code. This is especially true with all the opening and closing tags HTML needs. It can become boring and take longer than designing and developing the we...]]></description><link>https://blog.ayushsawant.dev/emmet-for-html-a-beginners-guide-to-writing-faster</link><guid isPermaLink="true">https://blog.ayushsawant.dev/emmet-for-html-a-beginners-guide-to-writing-faster</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Sat, 31 Jan 2026 14:45:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769870670290/5c504991-f67b-439e-aa13-01c6e02b133e.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-writing-html-the-slow-way">Writing HTML the slow way</h2>
<p>HTML can be quite wordy, making developers spend a lot of time writing code. This is especially true with all the opening and closing tags HTML needs. It can become boring and take longer than designing and developing the webpage's features. For example, creating a navigation bar with 10 list items means typing each <code>&lt;li&gt;</code> tag, making sure every opening tag has a closing tag, and keeping the indentation right for easy reading. Developers also need to watch for and fix mistakes like missing tags or wrong nesting, which can slow things down even more. This repetitive and careful work can be both slow and frustrating, taking away from the creative side of web development.</p>
<p>This is the normal and manual HTML, very time consuming.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>What if we could write this in one line? This is where Emmet comes into the game.</p>
<h2 id="heading-what-is-emmet">What is Emmet?</h2>
<p>Emmet is a shorthand/shortcut language. It is built into most code editors. It is used to convert abbreviations into HTML/CSS. Emmet is like autocomplete for HTML, which is actually smart. It allows developers to write complex and nested HTML structures. Emmet is included in VS Code by default and in many other editors.</p>
<h2 id="heading-how-emmet-works-inside-editors">How Emmet works inside editors</h2>
<p>Emmet works inside editors as a plugin that turns abbreviations into full, structured HTML or CSS code snippets. The expansion is triggered by pressing the <code>Tab</code> key. The plugin, i.e., Emmet, expands the abbreviation into a full, correctly formatted code block at the cursor’s location.</p>
<p>For example <code>ul&gt;li*3</code>, the result is shown below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769866928485/0176d4fa-2763-439f-852d-7b6d9980a582.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-basic-emmet-syntax">Basic Emmet syntax</h2>
<h3 id="heading-creating-elements">Creating elements:</h3>
<p>Typing the tag name expands into that tag.</p>
<pre><code class="lang-xml">div-&gt; <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
p-&gt; <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
section-&gt; <span class="hljs-tag">&lt;<span class="hljs-name">section</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
header-&gt; <span class="hljs-tag">&lt;<span class="hljs-name">header</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">header</span>&gt;</span>
</code></pre>
<h3 id="heading-classes-and-ids">Classes and IDs:</h3>
<p>This syntax gets converted into proper tags.</p>
<pre><code class="lang-xml">div.container
h1#title
</code></pre>
<p>The expansion for above shorthand syntax:</p>
<ul>
<li><p><code>.</code> = class</p>
</li>
<li><p><code>#</code> = id</p>
</li>
</ul>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"container"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"title"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<h3 id="heading-nested-elements">Nested elements</h3>
<p>There are several elements in HTML and CSS which are nested together to create a structure. Typing these elements manually is time consuming which is where Emmet takes the load off you.<br />In Emmet &gt; operator is used to nest several elements together, this operator is used to indicate that the next abbreviation coming after the operator will be inside the first element’s opening and closing tag. An example of this is <code>ul&gt;li</code>, this examples shows how <code>li</code> tag will be nested inside the <code>ul</code> tag and a similar example will be <code>table&gt;tr*3&gt;td*2</code> and the result for this abbreviation is shown below. It creates a well structured table with 3 rows and each row having 2 columns.</p>
<pre><code class="lang-html">    <span class="hljs-tag">&lt;<span class="hljs-name">table</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">tr</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">tr</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">tr</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">tr</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">tr</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">tr</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">table</span>&gt;</span>
</code></pre>
<h3 id="heading-repeating-elements">Repeating elements</h3>
<p>You must have noticed that we use <code>*2</code> in the above abbreviation to create the tag multiple times and that is exactly how it works. You use <code>*</code> operator to multiply the occurrence of a tag.</p>
<h2 id="heading-adding-attributes">Adding Attributes</h2>
<p>While using Emmet, attributes to a certain tag can be added using [] operator, you write the tag name and then the attribute inside the [] operator and it gets converted into expanded form. An example for this is <code>a[href="#"]</code> this gets converted into <code>&lt;a href="#"&gt;&lt;/a&gt;</code></p>
<h2 id="heading-full-html-boilerplate">Full HTML Boilerplate:</h2>
<p>Emmet is used to get the essential and repetitive structure every web page needs. It uses <code>!</code> to generate the necessary code which is needed in every page. Shown below is the code that gets generated by using <code>!</code>.</p>
<pre><code class="lang-xml">    <span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Document<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>

    <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h2 id="heading-why-emmet-matters-for-beginners">Why Emmet matters for beginners</h2>
<p>Emmet is essential for both beginners and experienced developers because it helps with faster typing and reduces syntax errors. Emmet allows you to focus on the layout instead of typing, and it encourages experimentation. While using Emmet is optional, once you learn it, you'll find it hard to stop using it.</p>
]]></content:encoded></item><item><title><![CDATA[How a Browser Works: A Beginner-Friendly Guide to Browser Internals]]></title><description><![CDATA[What a browser actually is (beyond “it opens websites”)
Brower opens websites is the lay man definition, while what it actually does it way more interesting and important. A browser is a software that talks to servers by being the mediator between th...]]></description><link>https://blog.ayushsawant.dev/how-a-browser-works-a-beginner-friendly-guide-to-browser-internals</link><guid isPermaLink="true">https://blog.ayushsawant.dev/how-a-browser-works-a-beginner-friendly-guide-to-browser-internals</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Thu, 29 Jan 2026 18:26:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769711164173/a49b173b-02cd-4ee7-97da-ae6e02434d9b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-a-browser-actually-is-beyond-it-opens-websites">What a browser actually is (beyond “it opens websites”)</h2>
<p>Brower opens websites is the lay man definition, while what it actually does it way more interesting and important. A browser is a software that talks to servers by being the mediator between the client and the server, transferring the client’s requests and the server’s response. Browser understand HTML/CSS/JS and converts it and renders it for users to see it. Browser is displays the UI of the websites, used for networking by fetching files from the server, it has JavaScript engine to run JS, it also has data storage to store cache and cookies in local storage.</p>
<h2 id="heading-main-parts-of-a-browser-high-level">Main Parts of a Browser (High-Level)</h2>
<ul>
<li><p><strong>User Interface:</strong> The part that we click while on a website.</p>
</li>
<li><p><strong>Browser Engine:</strong> It acts as a coordinator or a manager between the server and client.</p>
</li>
<li><p><strong>Rendering Engine:</strong> It Turns code into visuals.</p>
</li>
<li><p><strong>Networking:</strong> It is used for fetching files.</p>
</li>
<li><p><strong>JavaScript Engine:</strong> It runs JavaScript.</p>
</li>
<li><p><strong>Data Storage:</strong> Cache, cookies are stored in local storage.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769709651297/f42a365c-033c-480a-89fe-59c392af2b6f.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-user-interface-address-bar-tabs-buttons">User Interface: Address Bar, Tabs, Buttons</h2>
<p>UI or User Interface is the part of the browser which is interactive and the part that we click while using a browser. Elements like the Address bar, Back/forward, buttons, Tabs, Bookmark bar are parts of the browser UI.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769701820159/74bcaafe-9f88-45f5-aed8-51171c53d251.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-browser-engine-vs-rendering-engine">Browser Engine vs Rendering Engine</h2>
<h3 id="heading-browser-engine"><strong>Browser Engine</strong></h3>
<p>The <strong>Browser Engine</strong> acts as a middleman for the server and the client. It manages how they interact. When you type a URL or click a link, the browser engine sends the request to the server and waits for a response. Once the server sends back the data, the browser engine gives it to the rendering engine to display. This process makes sure all of the requests are handled and the right data is shown. The browser engine also deals with errors and manages the browser's cache to make browsing faster and smoother.</p>
<h3 id="heading-rendering-engine"><strong>Rendering Engine</strong></h3>
<p>The Rendering Engine is a key part of the web browser that turns HTML and CSS code into what you see on your screen. When you open a webpage, it takes the HTML, which has the page's structure and content, and the CSS, which controls the style and layout. It uses this info to build a Document Object Model (DOM) tree, showing the page's structure. The rendering engine also quickly updates the display if anything changes, when you click on the page or when new content loads with JavaScript.</p>
<h2 id="heading-networking-getting-the-website-files">Networking: Getting the Website Files</h2>
<p>Getting the Website files is a process carried out by the browser it involves various sequential steps.</p>
<ol>
<li><p>URL of the website is entered.</p>
</li>
<li><p>DNS converts domain name into IP address.</p>
</li>
<li><p>HTTP request is sent to the server of the website.</p>
</li>
<li><p>Servers responds with HTML, CSS, JS and Images.</p>
</li>
</ol>
<p>Browser downloads the files first and then processes them.</p>
<h2 id="heading-html-parsing-and-dom-creation">HTML Parsing and DOM Creation</h2>
<p>Parsing means checks the syntax to understand the structure and then converting it into a structured format. HTML is read from top to bottom, meaning the syntax conversion starts at the top and moves toward the bottom. After the process of HTML parsing it creates DOM (Document Object Model). DOM is like a tree structure. It includes the root → Element → Children. It is like a folder structure including the root folder and then the subfolders that are followed in the absolute filepath.</p>
<h2 id="heading-css-parsing-and-cssom-creation">CSS Parsing and CSSOM creation</h2>
<p>CSS is handled by a special part called the CSS parser. This parser carefully checks the CSS code to figure out how the webpage should look. While doing this, it creates a CSSOM (CSS Object Model). The CSSOM is a detailed guide that includes rules for styling the webpage, like colors, font sizes, layout positions, and other visual details. This model is important because it decides how everything on the page will look. Even though the CSSOM is ready, nothing has rendered on the webpage yet. The display show up only after the DOM and CSSOM are combined, which allows the browser to display the content correctly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769710736267/40f3468f-7147-4aea-865b-ca71bae848f0.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-how-dom-and-cssom-come-together">How DOM and CSSOM come together</h2>
<p>The Document Object Model (DOM) and the CSS Object Model (CSSOM) come together when the browser merges them together to form a render tree. This render tree is a visual representation of how the page should look like, which browser uses to perform layout and painting operations to display content on the screen. Render tree knows what to draw and how to draw it. It shows only the visible elements.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769709989176/e40027c0-af00-4db5-adab-896aed1d1026.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-parsing">Parsing</h2>
<p>Parsing is the process that takes raw characters from an equation and breaks it down into a structured format that a computer can compute. First, The parser identifies the tokens then, it builds a hierarchy to determine the order of operation, it can be simply said that it creates a tree of all the operands and operators. For example, in the expression (3 + 5) x 2, the parser identifies the parentheses as a priority and makes sure the computer adds 3 and 5 together before trying to multiply their result by 2.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769710319725/74517570-3678-46a0-90b6-ddce847a4e22.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>When you type a URL, the browser manages everything from the first network request to the final display on your screen. It starts by getting raw files like HTML, CSS, and JavaScript from servers, then turns that code into internal models called the DOM (the structure) and CSSOM (the style). By putting these models together, the browser figures out the page layout and finally shows it as pixels on your screen. Knowing this process is very helpful for developers because it shows that the browser is an organized system with many parts, not just a "mystery box".</p>
]]></content:encoded></item><item><title><![CDATA[How DNS Resolution Works]]></title><description><![CDATA[What is DNS and why name resolution exists
DNS stands for Domain Name System. DNS is used to map human-readable names to IP-addresses. DNS are useful because it is easier for us as humans to remember names rather than specific IP addresses to our fav...]]></description><link>https://blog.ayushsawant.dev/how-dns-resolution-works</link><guid isPermaLink="true">https://blog.ayushsawant.dev/how-dns-resolution-works</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Thu, 29 Jan 2026 11:35:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769686391618/0a34446c-d4b4-4914-b42a-a7aae39a14a1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-dns-and-why-name-resolution-exists">What is DNS and why name resolution exists</h2>
<p><strong>DNS</strong> stands for <strong>Domain Name System</strong>. DNS is used to map human-readable names to IP-addresses. DNS are useful because it is easier for us as humans to remember names rather than specific IP addresses to our favorite website, this is where DNS comes in to play, converting the names into IP-addresses. Without DNS, users would have to remember number of the IP address. DNS acts like a universal phonebook, people’s names are replaced with website names and telephone numbers are replaced with IP-addresses, only it is not accessible to us as is. Name resolution in DNS simply means converting domain names into IP addresses.</p>
<h2 id="heading-what-is-the-dig-command-and-when-it-is-used">What is the dig command and when it is used</h2>
<p>The <code>dig</code> command is a powerful DNS inspection tool that helps users query DNS servers to find out detailed information about domain name resolutions. This command is used in the terminal. When you run a command like <code>dig google.com</code>, you are asking the DNS servers to provide information on how to resolve the domain name google.com into its IP address. The output of the <code>dig</code> command has various sections, like the question section, answer section, authority section and additional section, each providing specific details about the DNS query and response process.</p>
<h3 id="heading-the-dig-command-is-used-to">The dig command is used to</h3>
<ul>
<li><p>Debug DNS issues.</p>
</li>
<li><p>See which servers answer queries</p>
</li>
<li><p>Understand the resolution flow.</p>
</li>
</ul>
<h2 id="heading-understanding-dig-ns">Understanding <code>dig . NS</code></h2>
<p>The command <code>dig . NS</code> is used to identify the <strong>Root Name Servers</strong> that sits at the top of the DNS hierarchy. The specific <code>.</code> is used to select the root DNS and requesting for the <code>NS</code> (Name server) records. These root server do not know IP addresses. When this command is run, it return the 13 logical root servers that act as the starting point for resolving any web address. Root servers guide the resolver, they don’t resolve domains themselves.</p>
<h2 id="heading-understanding-dig-com-ns">Understanding <code>dig com NS</code></h2>
<p>While <code>dig . NS</code> looks at the top of the hierarchy, <code>dig com NS</code> focuses specifically on the Top Level Domain(TLD) servers related to <code>.com</code>. When this command is run, you are looking for authoritative name servers that manage all domains ending with .com. These servers act as the middle man in the DNS hierarchy, they don’t know the IP address of a specific site like <code>google.com</code> but they know exactly which name servers have that information. This is the second layer in DNS resolution.</p>
<h2 id="heading-understanding-dig-googlecom-ns">Understanding <code>dig google.com NS</code></h2>
<p>Running the command <code>dig google.com NS</code> is the final level in the DNS hierarchy, the Authoritative Name Servers. Unlike the root or TLD servers, these specific servers hold the actual IP address for a particular domain. When you run this command, you are asking the internet, that which specific servers are the ones that manage the records for google.com. The answer points to Google’s own infrastructure like ns1.google.com which is where all specific records like IP addresses(A records) are stored and managed. These servers are the source of truth and the final answers come from here.</p>
<h2 id="heading-understanding-dig-googlecom">Understanding <code>dig google.com</code></h2>
<p>When you run a standard <code>dig google.com</code> without NS, you are asking for the full DNS resolution flow to find a specific IP address. Instead of asking who is in-charge of a server, you are asking for the A record, the actual location of the server.</p>
<p>The entire flow is shown in the diagram below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769686291408/2a401117-531f-4679-9538-45215d968f15.png" alt class="image--center mx-auto" /></p>
<p>The Full Resolution Flow is as follows:</p>
<ol>
<li><p>Client asks recursive resolver.</p>
</li>
<li><p>Resolver queries root servers.</p>
</li>
<li><p>Root servers point to TLD(.com)</p>
</li>
<li><p>TLD points to google.com authoritative servers.</p>
</li>
<li><p>Authoritative servers return IP address.</p>
</li>
<li><p>Resolvers caches the result for later usage.</p>
</li>
<li><p>Client connects to IP.</p>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>DNS Hierarchy is a structured phonebook that is used to delegate the traffic from the general servers to specific ones. Using dig at different levels allows you to see this personally. Understanding this flow is the key to troubleshooting why a website might be reachable for few people but appear to be down for others due to propagation or configuration errors.</p>
]]></content:encoded></item><item><title><![CDATA[Getting Started with cURL]]></title><description><![CDATA[Introduction: Talking to Servers
A server is just a computer connected to the internet. Its job is to listen to the requests of the various clients and send responses according to the requests. When a website or app is opened, thes device sends a req...]]></description><link>https://blog.ayushsawant.dev/getting-started-with-curl</link><guid isPermaLink="true">https://blog.ayushsawant.dev/getting-started-with-curl</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Wed, 28 Jan 2026 18:21:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769624415763/a8b79d33-6e8d-441d-9c5a-1f9b47922df2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction-talking-to-servers">Introduction: Talking to Servers</h2>
<p>A server is just a computer connected to the internet. Its job is to listen to the requests of the various clients and send responses according to the requests. When a website or app is opened, thes device sends a request to the server. The servers replies with data like HTML, JSON, images, etc. The website works because clients and servers talk to each other. Websites need data like pages, users, posts and apps need data like login, messages, products. All of this data lives on servers, not on our laptop. Client → Sends request and the Server → Sends response.</p>
<h2 id="heading-what-is-curl">What is cURL?</h2>
<p>cURL is a tool that lets you talk to the servers from the terminal. It sends requests the same way a browser does, but the only difference is browser hides everything behind UI while cURL show everything raw.</p>
<h2 id="heading-why-do-programmers-use-curl">Why Do Programmers Use cURL?</h2>
<p>cURL is widely used by programmer for various reason, it helps you see the real web, not the polished UI browser version. Some of the reason why cURL is used by programmers are:</p>
<ol>
<li><p>It is used to test servers quickly.</p>
</li>
<li><p>It is used to test APIs without writing code.</p>
</li>
<li><p>It is used to understand how requests and responses work.</p>
</li>
<li><p>It is used to debug backend problems.</p>
</li>
</ol>
<h2 id="heading-making-your-first-request-using-curl">Making your first request using cURL</h2>
<pre><code class="lang-plaintext">curl https://example.com
</code></pre>
<p>What happens when the above command is run in the terminal:<br />You send a GET request to example.com and then the server replies with HTML. cURL prints that HTML in the terminal. It look messy because Browsers can render HTML while cURL just prints the HTML. Nothing is wrong here, it is just how it works. It is simply sending a request to the server and getting a response back.</p>
<h2 id="heading-introducing-get-and-post">Introducing GET and POST</h2>
<h3 id="heading-get-request">Get request</h3>
<p>The Get request is used to get the data from a server and it is the default method in cURL.<br /><strong>Example:</strong> <code>curl https://api.example.com/users</code><br /><strong>Means:</strong> The client is asking the server for the users.</p>
<h3 id="heading-post-request">Post request</h3>
<p>The Post request is used to send the data to a server. This method is used for submitting forms, uploading files, adding new users to a server.<br /><strong>Example:</strong> <code>curl -X POST https://api.example.com/users</code><br /><strong>Means:</strong> The client is sending or creating data onto the server.</p>
<h2 id="heading-understanding-request-and-response">Understanding Request and Response</h2>
<h3 id="heading-request-what-you-send">Request = what you send</h3>
<p>Request is what you send including where you send it, the URL and how it was send using the GET method or the POST method.</p>
<h3 id="heading-response-what-you-get-back">Response = what you get back</h3>
<p>Response is what you get back after a request is sent onto a server. It includes the status code of the response, 200 meaning success while 404 meaning not found. It also includes the body of the website which is HTML and of APIs which is JSON</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769615533759/3ca18783-d733-49ad-8493-1c95fcc1b2a7.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-using-curl-to-talk-to-apis">Using cURL to talk to APIs:</h2>
<p>APIs are servers that return JSON as a response when a request is made to it, it does not return HTML like an average server. cURL is perfect for testing APIs. This makes them essential for building modern web and mobile applications, where data needs to be exchanged seamlessly between the client and server. It is widely used by backend developers to check if endpoints of an API work, check the exact responses and it is used to debug issues fast.<br /><strong>Example:</strong></p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">"name"</span>: <span class="hljs-string">"Ayush"</span>
}
</code></pre>
<h2 id="heading-common-mistakes-beginners-make-with-curl">Common mistakes beginners make with cURL:</h2>
<ul>
<li><p>They forget to add <code>https://</code> in the URL while using the curl command.</p>
</li>
<li><p>They expect browser like output in the terminal.</p>
</li>
<li><p>They get intimidated by the raw HTML and JSON.</p>
</li>
<li><p>They copy paste commands without understanding the intention of using it.</p>
</li>
<li><p>They think cURL is too advanced.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[DNS Record Types Explained]]></title><description><![CDATA[What is DNS
How does a browser know where a website lives? When a user types google.com, the browser needs an IP. This is where DNS comes into play, DNS solves the problem by helping the browser find the exact IP of the website. DNS is basically a ph...]]></description><link>https://blog.ayushsawant.dev/dns-record-types-explained</link><guid isPermaLink="true">https://blog.ayushsawant.dev/dns-record-types-explained</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Tue, 27 Jan 2026 19:11:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769541162279/50bcf9f1-cc5d-4063-bb8b-5162469bfabe.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-dns">What is DNS</h2>
<p>How does a browser know where a website lives? When a user types <code>google.com</code>, the browser needs an IP. This is where DNS comes into play, DNS solves the problem by helping the browser find the exact IP of the website. DNS is basically a phonebook of the internet. A regular phonebook has names of the people along with their phone numbers while the DNS has IP addresses corresponding to their domains. It converts names into IPs.<br />Examples: <code>google.com → 142.XXX.XXX.XXX</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769540778877/37fc1e06-a1e9-4b31-bdda-d9630e92414e.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-why-dns-records-exist">Why DNS Records Exist</h2>
<p>Usually, one domain name is used for several services like websites emails, verifications, etc. DNS records are used in this context. DNS records tell the internet what does what. There are several types of DNS record like A, AAAA, NS, CNAME, MX, etc. All of these records have different use cases and they are used separately to delegate their services using the same domain name. Each DNS record solves one specific problem.</p>
<h2 id="heading-ns-record">NS Record:</h2>
<p>NS record is a type of DNS record that specifies which servers are managing a domain’s DNS records. It is used to navigate traffic to the correct website or application. It informs DNS system which servers hold the IP address. NS records are great for delegating subdomains to specific name servers. They are managed by DNS hosting providers. They contain the domain name, the record type (NS), and the hostname of the name server such as <a target="_blank" href="http://ns1.example.com"><code>ns1.example.com</code></a>. NS records tell the internet which DNS server is in charge.</p>
<h2 id="heading-a-record">A Record:</h2>
<p>A record is the fundamental alternative to human-readable domain names like google.com. A record converts a domain name to IPv4. It directs traffic to the server hosting the website, allowing users to access sites using domain names rather than complex IP addresses. The main purpose of A records is to point a domain to an IP address. It is specifically used for IPv4, while AAAA is used for IPv6. A domain can have multiple A records, which are often used for load balancing, where traffic is distributed across different servers. This is the most important record for websites.<br />Example: <code>example.com → 93.184.216.34</code></p>
<p><img src="https://media.geeksforgeeks.org/wp-content/uploads/20260105180018802909/dns_hierarchy.webp" alt="Domain Name System (DNS) - GeeksforGeeks" /></p>
<h2 id="heading-aaaa-record">AAAA Record:</h2>
<p>Exactly the same as A but IPv6. IPv4 maps to 32 bit-IPv4 addresses while AAAA records map to 128bit-IPv6. A records are the standard for older networks, whereas AAAA records are required for modern IPv6 connectivity and faster networking. </p>
<h2 id="heading-cname-record">CNAME Record:</h2>
<p>CNAME record is short for Canonical Name, it is a type of DNS that maps an alias domain or subdomain to a canonical domain name, rather than directly to an IP address. It is essential for mapping subdomains to external services and simplifying DNS management when updating IP addresses. CNAME records must point to a domain name, never directly to an IP address. When a user visits a CNAME site, the DNS resolver looks up the target domain to find the final <code>A</code> record, which provides the IP address.</p>
<p><img src="https://www.mailersend.com/img/containers/gcs/blog/blog-dns-cname-graph2-min.png/949e2350d7206bb5e12cf1d4db6eaa11.webp" alt="What are CNAME Records and how They're Used in Email Sending - MailerSend" /></p>
<h2 id="heading-mx-record">MX Record:</h2>
<p>MX which stand for Mail Exchange is a type of DNS record that is used to reroute incoming mails to the correct mail server for a domain. It is used for email delivery, directing messages to specific servers like Microsoft 365 or Google workspace. The MX record indicates how email messages should be routed in accordance with SMTP(Simple Mail Transfer Protocol).</p>
<p><img src="https://www.zohowebstatic.com/sites/zweb/images/mail/what-are-mx-records-explained.jpg" alt="What is an MX record? - Zoho Mail Glossary" /></p>
<h2 id="heading-txt-record">TXT Record:</h2>
<p>A TXT record is a DNS record that stores human-readable or machine-readable text about a domain. It doesn't tell a computer where to go like an IP address, but instead holds text-based information for verification and security. It is essentially used for keeping notes that can be used to prove services like Google that you actually own the website or provide a list of "approved senders" to stop spammers from faking emails from your domain.</p>
<h2 id="heading-how-all-dns-records-work-together-for-one-website">How all DNS records work together for one website</h2>
<p>The NS Record is the city directory. It tells the world exactly which map to look at to find the building. Once you have that map, the other records guide the traffic:</p>
<ul>
<li><p><strong>A Record (The Address):</strong> This guides browsers to the main front door which is the IP Address so they can enter the building.</p>
</li>
<li><p><strong>CNAME (The Redirection Sign):</strong> If someone asks for <code>www</code>, this sign says, "That is just the main building," and points them back to the A Record. It is a redirection for the same location.</p>
</li>
<li><p><strong>MX Record (The Mailroom):</strong> This tells postman to skip the front door and deliver letters to the back gate.</p>
</li>
<li><p><strong>TXT Record (The Security Badge):</strong> This is a public notice on the wall used for verification. It proves who owns the building and lists who is allowed to speak on its behalf.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Understanding HTML Tags and Elements]]></title><description><![CDATA[What is HTML and Why Is It Used?
HTML stands for Hypertext Markup Language, and it is used to create the basic structure of any website. When a browser loads a webpage, it doesn’t see design or logic. It only sees structure. HTML creates the structur...]]></description><link>https://blog.ayushsawant.dev/understanding-html-tags-and-elements</link><guid isPermaLink="true">https://blog.ayushsawant.dev/understanding-html-tags-and-elements</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Tue, 27 Jan 2026 15:58:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769529474867/cbf2914a-4ff0-433c-ba01-ec4af75560df.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-html-and-why-is-it-used">What is HTML and Why Is It Used?</h2>
<p>HTML stands for Hypertext Markup Language, and it is used to create the basic structure of any website. When a browser loads a webpage, it doesn’t see design or logic. It only sees structure. HTML creates the structure and the outline for the content of the website. It has all the content the webpage has added in a semantic manner to be styled later using CSS.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769525017507/221355e3-ca6b-4631-8474-5f50fd1e4ec8.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-an-html-tag-is">What an HTML tag is</h2>
<p>HTML tags are used to create the outline of the webpage. Tags are used to create HTML elements, which may contain content. Tags come with various attributes which are like extra properties that can be added to the tag, to increase its functionality.</p>
<h3 id="heading-some-of-the-basic-tags-are">Some of the Basic Tags are</h3>
<ul>
<li><p><code>&lt;p&gt;&lt;/p&gt;</code>:This is the paragraph tag, used to write content onto the webpage.</p>
</li>
<li><p><code>&lt;h1&gt;&lt;/h1&gt;</code>: This is the heading tag, which is used to create a heading on the webpage, this tag can range from h1 to h6</p>
</li>
<li><p><code>&lt;div&gt;&lt;/div&gt;</code>: This is the Division tag, used to create a division in the webpage, it is used to group elements together for layout or styling.</p>
</li>
<li><p><code>&lt;hr&gt;</code>: This is the Horizontal Rule tag, used to create a horizontal line to create a partition in the webpage.</p>
</li>
<li><p><code>&lt;br&gt;</code>: This is Break tag, used to break the current line and move the content to the next line.  </p>
</li>
</ul>
<h2 id="heading-opening-tag-closing-tag-and-content">Opening Tag, Closing Tag and Content</h2>
<p>Opening tag, closing tag and the content are all combined to call an element of HTML. Opening tag is the opening part of a tag which is used toward the beginning. Let’s take an example to showcase the opening tag and the closing tag.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Content<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
</code></pre>
<p>Here, &lt;h1&gt; is the opening tag while &lt;/h1&gt; is the closing tag, these two tags combine together to contain the content. Tags are like the walls of the box while content is the thing kept inside the box.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769528551914/c1f12165-f032-40fa-8c4e-5232a668a232.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-self-closing-void-elements">Self-Closing (void) Elements:</h2>
<p>Void elements in HTML are unique because they do not contain any content between tags. These elements are self-contained and only require an opening tag, without the need for a closing tag. Examples of void elements include <code>&lt;br&gt;</code>, which inserts a line break in the text, and <code>&lt;hr&gt;</code>, which creates a horizontal line for separating content. These elements are used to structure the webpage without the need for content, making them efficient for specific tasks. Since they do not wrap any content, they help reducing the number of tags needed for certain functions.</p>
<h3 id="heading-ia"> </h3>
<p>Some of the Self closing elements:</p>
<ul>
<li><p><code>&lt;hr&gt;</code>: Creates a horizontal line to separate content sections.</p>
</li>
<li><p><code>&lt;br&gt;</code>: Inserts a single line break.</p>
</li>
<li><p><code>&lt;img&gt;</code>: Embeds an image into the document.</p>
</li>
<li><p><code>&lt;input&gt;</code>: Used to create web forms and its behavior is defined by the <code>type</code> attribute.</p>
</li>
</ul>
<h2 id="heading-block-level-vs-inline-elements">Block-Level vs Inline Elements:</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Block-Level</strong></td><td><strong>Inline</strong></td></tr>
</thead>
<tbody>
<tr>
<td>Starts on a new line.</td><td>Does not start on a new line.</td></tr>
<tr>
<td>Takes up the full width available in its container.</td><td>Takes only as much width as its content requires.</td></tr>
<tr>
<td>Fully supports height/width using CSS.</td><td>Height and width do not affect layout by default.</td></tr>
<tr>
<td>Top and bottom margins work.</td><td>Top and bottom margins have no effect (only horizontal works)</td></tr>
</tbody>
</table>
</div><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769528239480/2be4958f-8edf-421e-9011-76dae5c47f0c.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Working of TCP: 3-Way Handshake]]></title><description><![CDATA[What is TCP and why it is needed
TCP is short for Transmission Control Protocol. TCP is a very reliable form of communication between two devices and it ensures the entire data is transferred. In TCP packets are sent in a numbered order, which helps ...]]></description><link>https://blog.ayushsawant.dev/working-of-tcp-3-way-handshakes</link><guid isPermaLink="true">https://blog.ayushsawant.dev/working-of-tcp-3-way-handshakes</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[ChaiCohort]]></category><category><![CDATA[Chaiaurcode]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Sat, 24 Jan 2026 14:40:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769530058914/685be4cf-26e2-4562-af40-49bdb6da54cf.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-tcp-and-why-it-is-needed">What is TCP and why it is needed</h2>
<p>TCP is short for Transmission Control Protocol. TCP is a very reliable form of communication between two devices and it ensures the entire data is transferred. In TCP packets are sent in a numbered order, which helps in retransmission of missing packets. It does not prevent packet loss but recovers from it. It is used for important tasks like downloading/uploading data, webpages, etc. TCP is like sending a courier to a friend’s address, this ensures the entire data reaches the person safely, although it is slow.</p>
<p>TCP is used when reliable, ordered, error-checked delivery is needed in a network. It is used when a slight delay can be tolerated but correctness is the priority over speed. If TCP were not used, users might notice missing or corrupt data. When applications are expected guaranteed delivery, TCP is used. TCP is needed because it is made assuming the network is unreliable and faces issues like packet loss, connection drop, slowing down and rerouting traffic mid conversation. All of the packets do not take the same path, some routes might be fast while some might be slow changing the order in which packets were sent. They might be sent in the order <code>1→2→3→4→5</code> but are received in the order <code>4→5→2→1→3</code>. TCP reorders the packets before sending them to the application.</p>
<h2 id="heading-problems-tcp-is-designed-to-solve">Problems TCP is designed to solve:</h2>
<ul>
<li><p><strong>Packet loss:</strong><br />  Data packets can be lost during transit due to congestion or unreliable network.</p>
</li>
<li><p><strong>Out of order delivery:</strong><br />  Due to problems like packet loss, connection drop and rerouting traffic, packets are received in an out of order manner, meaning they are sent in a different order than the order they are received in.</p>
</li>
<li><p><strong>Unreliable network paths:</strong><br />  Routes can be changed mid-communication, causing delay and drops.</p>
</li>
<li><p><strong>No reliability in IP</strong><br />  The network does not guarantee delivery or correctness.</p>
</li>
</ul>
<h2 id="heading-what-is-the-tcp-3-way-handshake">What is the TCP 3-Way Handshake</h2>
<p>3-Way Handshake is the method TCP uses to confirm the connection before transferring the data starts. In this process, the client sends a SYN (Synchronization) message to the server. Once the server receives the SYN message, it sends back SYN-ACK(Synchronization-Acknowledgement) to the client signaling that the SYN was received and acknowledging. When the client receives back the SYN-ACK, it knows that the server is active and then the client send back an ACK(Acknowledgement) telling the server that the transfer can begin now, since the connection has been established. After this 3 way handshake containing SYN, SYN-ACK and ACK, continuous data/packet transfer starts. This exchange ensures that both sides are ready for reliable communication.</p>
<p>A great analogy to explain this is during an online meeting, when a person comes forward to speak. Their first words are “Am I audible?” which is similar to the client sending SYN. After this, the listeners signal them back telling them that they are audible, which is SYN-ACK in our case. This interaction is followed by the speaking saying something indicating that they will begin speaking, exactly the way client sends back an ACK before the data transfer starts.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769190547837/00c4572a-34e6-4dfe-8071-e78ed16728e1.png" alt /></p>
<h2 id="heading-step-by-step-working-of-syn-syn-ack-and-ack">Step-by-step working of SYN, SYN-ACK, and ACK</h2>
<ul>
<li><p><strong>Step 1: SYN</strong></p>
<p>  The client send the SYN message to the server asking if it is ready to communicate</p>
</li>
<li><p><strong>Step 2: SYN-ACK</strong></p>
<p>  The server sends back SYN-ACK to the client signaling that it is indeed ready for communication.</p>
</li>
<li><p><strong>Step 3: ACK</strong></p>
<p>  The client sends back ACK to the server, telling the server that the transfer can begin now, since the connection has been established.</p>
</li>
</ul>
<h2 id="heading-how-data-transfer-works-in-tcp">How data transfer works in TCP</h2>
<p>The data transfer process in TCP works by breaking down the data into smaller segments. Each of these segments is sent separately. These segments are called packets. Each segment is given a sequence number. These segments are shared/transferred in a sequential manner, ensuring that the receiver gets them in the same order as they were sent. These sequence numbers are useful to tell when a certain packet has be lost during the transit. In TCP receivers send ACKs(Acknowledgement) to the sender to confirm received data. This is how TCP knows what arrived safely. If receiver doesn’t send acknowledgement (ACK) for a certain packet, then it is concluded that it went missing and sender retransmits the segment to the receiver. Even if packets are received in an un-ordered manner, TCP reorders them before they reach the application.</p>
<h2 id="heading-how-a-tcp-connection-is-closed">How a TCP connection is closed</h2>
<p>When two computers are talking using TCP, both sides can send data. So, if one side is done sending the data, the other side might still have data left to send. If we just cut the connection, the last data might be lost and the other side might still be sending data leading to application getting incomplete results.</p>
<p>This is when FIN and ACK comes into play, FIN signals the computer that “Hey, I am done sending data” and ACK means “I understood that”</p>
<h3 id="heading-step-by-step-how-a-tcp-connection-is-closed">Step by step: How a TCP connection is closed:</h3>
<ul>
<li><p><strong>Step 1: FIN</strong></p>
<p>  One side(assume client) sends a FIN packet, telling the server that I have no more data to send you. This means the client cannot send more data after this but the server can still send data.</p>
</li>
<li><p><strong>Step 2: ACK</strong><br />  The server sends an ACK, telling the client that “I have received your FIN”<br />  Client-server connection is closed but server-client is still open.</p>
</li>
<li><p><strong>Step 3: FIN</strong></p>
<p>  When the server is also done sending the data, it send back its own FIN.</p>
</li>
<li><p><strong>Step 4: ACK</strong></p>
<p>  The client send the final ACK to the server, telling “I have received your FIN”</p>
<p>  This is when the entire connection is closed and no more data can be shared and both the sides are done.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769264375494/e90d8416-fddd-4e9e-a41f-fec95ced7b32.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>TCP exists because networks are unreliable and applications should not have to deal with packet loss, reordering or partial data.</p>
<p>From the 3-way handshake to reliable data transfer and graceful connection termination, TCP ensures communication is complete, ordered and correct.</p>
<p>This is why TCP is used for critical tasks like web browsing, file transfers and APIs is where correctness matters more than speed.</p>
]]></content:encoded></item><item><title><![CDATA[TCP vs UDP: Fast vs Reliable (And Why HTTP Needs TCP)]]></title><description><![CDATA[What are TCP and UDP:
TCP is short for Transmission Control Protocol. TCP is a very reliable form of communication between two devices and it ensures the entire data is transferred. In TCP packets are sent in a numbered order, which helps in retransm...]]></description><link>https://blog.ayushsawant.dev/tcp-udp-fast-reliable-and-why-http-needs-tcp</link><guid isPermaLink="true">https://blog.ayushsawant.dev/tcp-udp-fast-reliable-and-why-http-needs-tcp</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[ChaiCohort]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Fri, 23 Jan 2026 19:24:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769094184820/ace846fc-32fb-4559-a94f-04fbd5d1ba5e.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-are-tcp-and-udp">What are TCP and UDP:</h2>
<p>TCP is short for Transmission Control Protocol. TCP is a very reliable form of communication between two devices and it ensures the entire data is transferred. In TCP packets are sent in a numbered order, which helps in retransmission of missing packets. It does not prevent packet loss but recovers from it. It is used for important tasks like downloading/uploading data, webpages, etc. TCP is like sending a courier to a friend’s address, this ensures the entire data reaches the person safely, although it is slow.<br />UDP is short for User Datagram Protocol. UDP is a fast and comparatively less reliable form of communication. UDP does not share data in ordered manner and it does not worry about the lost packets. It is used for video streaming, video calls and even for online gaming. UDP is like shouting a message across a football field; the person might not hear it, and there is no confirmation if the person heard it. The only upside to this method is that it is fast.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769196209205/f0740e44-535f-47d1-821d-9a033607bda1.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-key-differences-between-tcp-and-udp">Key differences between TCP and UDP:</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td>TCP (Transmission Control Protocol)</td><td>UDP (User Datagram Protocol)</td></tr>
</thead>
<tbody>
<tr>
<td>Connection Oriented.</td><td>Connectionless</td></tr>
<tr>
<td>Reliable</td><td>Less Reliable</td></tr>
<tr>
<td>Uses 3 way handshake.</td><td>Does not use 3 way handshake.</td></tr>
<tr>
<td>Every packet is ordered during delivery.</td><td>Packets are not ordered.</td></tr>
<tr>
<td>Efficient error handling.</td><td>Error handling is concerned with application.</td></tr>
<tr>
<td>Missing packets are retransmitted.</td><td>Missing packets are ignored.</td></tr>
<tr>
<td>Focused on correctness.</td><td>Focused more on speed than correctness.</td></tr>
</tbody>
</table>
</div><h2 id="heading-when-to-use-tcp">When to use TCP?</h2>
<p>TCP is used when reliable, ordered, error-checked delivery is needed in a network. It is used when a slight delay can be tolerated but correctness is the priority over speed. If TCP were not used, users might notice missing or corrupted data. When applications expect guaranteed delivery, TCP is used.<br />Use cases of TCP are:</p>
<ul>
<li><p>Web browsing</p>
</li>
<li><p>Uploading/Downloading</p>
</li>
<li><p>Emails</p>
</li>
<li><p>API/Backend communication</p>
<p>  If TCP was not used web browsing would not be possible. If any packets go missing, they could contain crucial data about the webpage and it might corrupt the data.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769190547837/00c4572a-34e6-4dfe-8071-e78ed16728e1.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<h2 id="heading-when-to-use-udp">When to use UDP?</h2>
<p>UDP is used when the speed of transfer and low latency is the priority. If accuracy of every packet is not the main concern, then UDP can be used. This makes UDP ideal for real-time applications like live video streaming, online gaming and video calls. TCP implements retransmission in case of lost packets but UDP remove the wait for retransmission entirely making it faster. If the data becomes useless if it arrives late, then UDP is used in this case.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769190175793/c8ad2683-c8ef-4324-a9d7-f20f8f408182.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-common-real-world-examples-of-tcp-vs-udp">Common real-world examples of TCP vs UDP</h2>
<ul>
<li><p>Web Browsing (TCP): Missing packets would break the HTML/CSS and cause pages to load wrongly</p>
</li>
<li><p>File Downloads (TCP): Downloading files with lost packets would corrupt the entire file.</p>
</li>
<li><p>Video calls (UDP): Late audio and video frames are useless, so skipping them makes the playback smoother.</p>
</li>
<li><p>Online gaming (UDP): In online gaming late possible are not only late but wrong and it would cause lag and incorrect gameplay.</p>
</li>
</ul>
<h2 id="heading-what-is-http-and-where-it-fits">What is HTTP and where it fits?</h2>
<p>HTTP is an Application Layer Protocol. It is not reliable itself but uses TCP to achieve reliability. HTTP depends on TCP to move its data across the network. It cannot function on its own. TCP is responsible for establishing connection, breaking data into packets, ensuring packets arrive in the correct order and retransmitting the missing packets. TCP just moves the data, nothing else. While HTTP is responsible for defining the request and response format. It lays down ground rules on how the server and the browser talk.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769195524233/85f74a2a-e992-4b8e-a416-de80027ec152.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-relationship-between-tcp-and-http">Relationship between TCP and HTTP</h2>
<p>HTTP is an Application Layer Protocol, while TCP is a Transport Layer Protocol. HTTP uses TCP to send and receive data. TCP takes care of sending the data and deciding how the data is sent to another computer. HTTP decides what has to be sent. TCP has no idea on what HTTP is sending and HTTP has no control on how TCP delivers packets. They cooperate, but they don’t overlap. HTTP is not a replacement for TCP. HTTP cannot work without a transport protocol but TCP can exist without HTTP. They solve different problems at different levels.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Network Devices]]></title><description><![CDATA[What is Modem and How It Connects Your Network To The Internet?
MODEM is short for Modulator Demodulator, which means a device that converts the analog signal of the internet cables that come to your home into a digital signal (Binary 1s and 0s). The...]]></description><link>https://blog.ayushsawant.dev/understanding-network-devices</link><guid isPermaLink="true">https://blog.ayushsawant.dev/understanding-network-devices</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[ChaiCohort]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[networking]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Wed, 21 Jan 2026 19:02:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769022127701/edd83ba9-e65e-4c81-a95c-f92a5644694d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-modem-and-how-it-connects-your-network-to-the-internet">What is Modem and How It Connects Your Network To The Internet?</h2>
<p>MODEM is short for Modulator Demodulator, which means a device that converts the analog signal of the internet cables that come to your home into a digital signal (Binary <code>1</code>s and <code>0</code>s). The computer can only work with a digital signal, which is provided by the modem through the conversion from analog to digital.</p>
<h3 id="heading-incoming-data-demodulation-decoding">Incoming Data (Demodulation / Decoding):</h3>
<p>When Netflix sends a movie video stream to your computer through the internet to your ISP, who sends it to your house using a cable. MODEM uses this physical signal and demodulates it, converting it into digital signal(Binary 1s and 0s) and sends the stream to your computer through a router or ethernet cable.</p>
<h3 id="heading-outgoing-data-modulation-encoding">Outgoing Data (Modulation / Encoding):</h3>
<p>When you click upload on Instagram to post an image, the image is sent from your device to the modem through a digital signal. This signal is then converted into a physical signal, which is sent to the ISP, who then sends the same analog signal to the Instagram servers.</p>
<p>Modem brings the internet into your house, it establishes a connection to ISP. While the router supplies the internet to your devices in the house</p>
<h3 id="heading-internet-modem-router-switch-devices-flow">Internet → Modem → Router → Switch → Devices flow:</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768843428919/af8cc227-527d-4a08-9b47-712f2f1c9a55.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-is-a-router-and-how-it-directs-traffic">What is a Router and How It Directs Traffic?</h2>
<p>We have seen how internet reaches from ISP to modem and gets decoded and is sent to the router to transmit it to various devices in the house. The primary role of router is to connect the two different networks together, Wide Area Network(WAN) (Internet) to the Local Area Network(LAN) in your house. Router acts as a decision point between WAN and the LAN. Every time a new connection is made router takes care of the transactions between your computer and the internet.</p>
<p>Router acts as the mediator between the internet and the devices. When any data is received on the modem it does not know which devices to send this data to, those data packets come with a destination IP address, router checks if that IP address in present in it’s LAN, if it is available then the data is sent to the respective device. Without router, every device in a LAN would get every data, even the one that is not meant for it.</p>
<h3 id="heading-incoming-data">Incoming Data:</h3>
<p>When data incoming is under process, the data comes to the router in the form of packets. Every packet contains a destination address. It is the IP address where the data is supposed to end up.<br />Router check if the address is present in my LAN?<br />If Yes → Send the data to the respective device.<br />Router sends the data to that device only, without router every device would get all the data.</p>
<h3 id="heading-outgoing-data">Outgoing Data:</h3>
<p>When you press the upload on Instagram, packets of data are created with Source address(Your IP address) and the destination address(Instagram server). This is when the router check if the destination address is present in my LAN, if not then router sends the data to the MODEM and then IP and then to the internet.</p>
<p>Router is like a traffic police standing at the door of your house taking care of all the interactions you are going to have. If you order a pizza and the pizza deliver guy comes then how would he know where to deliver the pizza in a large building, this is where traffic police(router) check that you ordered the pizza and he takes the pizza from the guys and delivers it to you personally. This is why your computer is "safe" behind a router. If a bad delivery guy comes to the building, the Router stops them at the door and says, "Nobody ordered this," and sends them away. They never get near your actual room.</p>
<h2 id="heading-switch-vs-hub-how-local-networks-actually-work">Switch vs Hub: How Local Networks Actually Work?</h2>
<p>Hub is a multi-port repeater. It send any received data to all the devices by default. It works in a way like one to many fashion. When a laptop A wants to send data to laptop B using hub, what hub does is it takes the data sends it to device B and also to every other device like laptop C, D E, etc.</p>
<p>Switch intelligently transfer the data to the correct device using the MAC address(It is the hardware based address concerned with every network card). The data in switch is wrapped around Ethernet frame so that it can travel in LAN. This Ethernet frame has a source MAC address and the Destination MAC address and the payload(actual data)</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Switch</td><td>Hub</td></tr>
</thead>
<tbody>
<tr>
<td>1. Sends data to the correct device in LAN</td><td>1. Sends data to every device in LAN</td></tr>
<tr>
<td>2. Other devices do not see the data</td><td>2. Every device processes every frame</td></tr>
<tr>
<td>3. Collisions are basically eliminated</td><td>3. Collisions are very common due to sending data to multiple devices at the same time</td></tr>
<tr>
<td>4. Security is very high compared to hub as every device sees only its own traffic</td><td>4. Security is lower compared to switch as every device sees all the data</td></tr>
</tbody>
</table>
</div><h2 id="heading-what-is-a-firewall-and-why-security-lives-here">What is a Firewall and why security lives here?</h2>
<p>Firewall works as the gatekeeper, who takes care of the packets that are going to enter the network. It sits between the secure network(LAN) and the untrustworthy network(Internet). It check if a certain data is allowed to go into the secure network and also the outgoing traffic from our current secure network. Firewall takes care of inspection and decision. It checks things like the source address, destination address, port, etc. Firewall also control the apps that can access the internet and the servers that can talk to the databases. It prevents data leaks. There are two kinds of firewalls, there is a software firewall which comes in-build in most of the latest computers and there is a hardware firewall which is used to protect the servers from unwanted visitors and threats.</p>
<p>The network Firewall and a real structural firewall work in a similar fashion, where a structural firewall works by containing the fire in a building and avoiding it from spreading and causing more damage. Similarly, network firewall also has a fire to avoid entering our secure network and that fire in our case is the internet which is full of threats, hackers and viruses. The network firewall filters the incoming packets by their IP-addresses, certain addresses are allowed while the traffic from some addresses is filtered out or stopped from entering the network. The firewall does not filter out only on the basis of IP-addresses but also on the basis of other factors like domain names, ports, protocols and even keywords.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769006745157/ad43fb41-323e-457b-b942-a30ce49ac226.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769006986016/6a5ac0bb-d7b1-49b6-a3ca-f01448a5b47e.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-is-a-load-balancer-and-why-scalable-systems-need-it">What is a Load Balancer and why scalable systems need it?</h2>
<p>Load Balancer the name itself is self explanatory. It works to reduce the load on servers by distributing requests across available servers, so no one server gets load of client requests.In case a server goes down, the load is redirected to the other active servers. If a new server is added to the network, then the same load is redistributed among those servers. Since load balancer works with multiple server, the client get their request readily addressed even when certain servers might be down.</p>
<p>Load balancer is widely used in the development market, an example to explain it is that during diwali sale or yearend sale, the ecommerce websites get a really heavy traffic and this is when load balancer plays an important role by delegating the requests between all the available servers and providing a smooth experience to the users. Load balancer allows to dynamic addition or removal of servers from the network, ensuring that the system remains scalable. The main reason a load balancer is needed is because if a single server is used it gets bottlenecked and overwhelmed by large number of requests, to avoid this several servers are used along with a load balancer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769018354974/537abb4f-b9a3-4e99-aa21-f690cebb13c1.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-how-all-these-devices-work-together-in-a-real-world-setup">How all these devices work together in a real-world setup?</h2>
<p>The internet comes to your home in network cables in form of physical signal which is decoded by the modem. Modem converts the physical signal received from the ISP to digital signal. Next comes the router which mostly has inbuilt firewall, so the router acts as the distributor for the internet packets, while the firewall acts as a safeguard which protects our system and network from threats and unwanted visitors. After all of this process, your open a website and your request leaves the computer. The request hits the website’s load balancer, which delegates the requests to various available servers. That server processes the request and the response travels the same path back. Modem, Router, Firewall, Switch, Hub are the part of our LAN, while the load balancer is an external device used at servers and users interact with the load balancer and the same load balancers deals with selecting a server for your request subject to availability of servers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769022043791/c81899eb-a9f7-484b-82e3-6d39a3f29bb3.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Inside Git: How It Works and the Role of the .git Folder]]></title><description><![CDATA[Introduction (Why This Matters)
Git is a version control system that helps developers collaborate and keep track of all the changes made in the code over time. Git stores the project data such as who authored the commit and the timestamp of the commi...]]></description><link>https://blog.ayushsawant.dev/inside-git-how-it-works-and-the-role-of-the-git-folder</link><guid isPermaLink="true">https://blog.ayushsawant.dev/inside-git-how-it-works-and-the-role-of-the-git-folder</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><category><![CDATA[learn in public]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Sat, 10 Jan 2026 10:58:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768042718419/54c6b241-ec9c-4653-98df-8a90a9ad0207.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction-why-this-matters">Introduction (Why This Matters)</h2>
<p>Git is a version control system that helps developers collaborate and keep track of all the changes made in the code over time. Git stores the project data such as who authored the commit and the timestamp of the commit in the repository.</p>
<p>Most people use Git as a magic box, where they know just a few commands and go about their tasks without understanding what exactly happens under the hood of Git. How it stores the changes and what the contents of the <strong>.git</strong> folder are not known by most developers who work on the surface level and don't dive deeply into understanding the workings of Git.</p>
<p>This specific article is meant to create a mental model of Git’s workings and is not going to be a command memorization cheatsheet. By the end of this article, you’ll know what Git stores, where it stores it, and how it tracks the changes.</p>
<h2 id="heading-what-is-git-really"><strong>What Is Git Really?</strong></h2>
<p>Git is a <strong>content-addressable file system.</strong> What does that mean? It means that at the core of Git is a basic key-value data store. You can add any type of content to a Git repository, and it provides a unique key that you can use later to retrieve the content.</p>
<p>Git doesn’t really track changes of the code-base but it takes a snapshot of the project whenever asked to do so. It does not track line-by-line differences of the project.</p>
<p>Everything in Git is stored using hash. Git uses <strong>SHA-1 hash function</strong> to generate unique identifiers (hashes) for all of its objects, such as commits, files (blobs), and directories (trees). These hashes are 40-character hexadecimal strings.</p>
<p>The commands in Git serve as a user-friendly interface that allows you to interact with the repository. However, the real magic happens in the background, where Git manages object storage. This means that when you use Git commands, you are actually communicating with an internal database that efficiently handles the storage and retrieval of data.</p>
<h2 id="heading-understanding-the-git-folder">Understanding the <code>.git</code> folder:</h2>
<h3 id="heading-why-the-git-folder-exists"><strong>Why the .git Folder Exists</strong></h3>
<p>.git is the hidden subfolder created after the command <code>git init</code> is run, this command initializes the repository creating a .git folder. It is the entire repository of the project. The .git folder is where all the data related to the project repository is stored and this folder is created in the current directory.</p>
<p>Deleting the .git folder means losing the entire version history of the project. It works as the internal database of the project. To understand Git, you must understand what’s inside .git.</p>
<h3 id="heading-structuring-of-the-git-directory">Structuring of the .git Directory</h3>
<ul>
<li><p><strong>objects/</strong> → The subfolder objects/ is the heart of the Git database. It stores all your content in a compressed format using a hash algorithm. <strong>Blobs</strong>, <strong>Trees</strong> and <strong>Commits</strong> are the part of the content saved in objects/</p>
</li>
<li><p><strong>refs/</strong> → Short for “references.” Keeps track of where all the branches and tags are pointing. HEAD points to the latest commit.</p>
</li>
<li><p><strong>index/</strong> → This is the <strong>staging area</strong>. It stores the information of the changes you had decided for the next commit. It acts as a middle-man between your working directory and your actual commit history</p>
</li>
</ul>
<p><strong>config</strong> → This file holds the repository's settings, like your name and email for commits, the default branch name, and any custom Git command shortcuts you’ve set up. It tweaks how Git works to suit the project’s needs.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1767895570782/0b835f7a-ebf3-4911-ba83-af1d4c696faf.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-git-objects-blob-tree-commit">Git Objects: Blob, Tree, Commit</h2>
<h3 id="heading-blob">Blob:</h3>
<p>Blob stands for Binary Large Object. It is the simplest file and stores the content of a file and nothing else. A blob does not know its own name or where it lives in your folders. It only knows the stored data inside. Every time you change even a single character in a file. Git creates a new blob for that specific version, only if the content changes. The same content has the exact same hash. If you have 10 identical files in different folders, Git creates only one blob. This is why Git is so space-efficient.</p>
<h3 id="heading-tree">Tree:</h3>
<p>If a blob is an object, then a tree is the directory. It acts as a map that organizes your files. A tree object lists filenames and maps them to their respective <strong>blob hashes</strong>. It also stores file permissions. If a directory has not been changed between commits, Git just points to the existing tree object rather than creating a new one.</p>
<h3 id="heading-commits">Commits:</h3>
<p>The commit acts as the “wrapper” that ties everything together in a snapshot of the project at a specific moment. Every commit points to exactly one root Tree (representing your main project folder). It stores data like who, what, when, and why a specific change was made to the project. Most importantly, every commit points to the parent commit (previous commit). This creates a chain of all the commits made so far, which acts as a history of the project.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768030410848/b042f689-659d-4eba-97bb-8b23a332b6ac.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-how-git-tracks-changes">How Git Tracks Changes?</h2>
<p>Git works as a version control system that tracks changes made to a project and helps developers work together. These changes are recorded in the .git folder when the <code>git commit</code> command is run after changes have been added to the staging area using the <code>git add</code> command.</p>
<h3 id="heading-what-happens-internally-during-git-add"><strong>What Happens Internally During</strong> <code>git add</code><strong>:</strong></h3>
<p>Git has three stages:<br />1. <strong>Working Directory</strong> – your files on disk<br />2. <strong>Staging Area (index)</strong> – what you <em>intend</em> to commit<br />3. <strong>Repository (.git)</strong> – immutable history (objects)</p>
<p><code>git add</code> moves the files to the staging area<br /><code>git commit</code> turns staged data into permanent history</p>
<p><strong>Step by Step Process of internal working of</strong> <code>git add</code>:</p>
<ol>
<li><p><strong>Git reads the file content:</strong></p>
<p> Git looks at the <strong>actual bytes</strong> of <code>file.txt</code>.<br /> It does not look into the filename and not even the path, it purely looks at the content.</p>
</li>
<li><p><strong>Git hashes the object:</strong><br /> Git runs SHA-1 on the file’s content, this hash becomes the identity of the content.<br /> Same content → Same hash<br /> Different content → Different hash</p>
</li>
<li><p><strong>Git creates a blob object(if needed):</strong><br /> If a blob with this hash already exists → Git reuses it</p>
<p> If not → Git writes a new blob into:</p>
</li>
<li><p><strong>Git updates the index (staging area):</strong><br /> Git writes an entry in the index:<br /> Filename<br /> Permission<br /> Pointer → blob hash</p>
<p> Here, we are just telling Git that for the next commit, I want this version.</p>
</li>
</ol>
<h3 id="heading-what-happens-internally-during-git-commit"><strong>What Happens Internally During</strong> <code>git commit</code><strong>:</strong></h3>
<ol>
<li><p><strong>Git reads the index:</strong></p>
<p> Git looks at:</p>
<ul>
<li><p>all staged files</p>
</li>
<li><p>their blob hashes</p>
</li>
<li><p>directory structure implied by paths</p>
</li>
</ul>
</li>
<li><p><strong>Git creates Tree objects:</strong></p>
<p> Git builds:</p>
<ul>
<li><p>trees for subdirectories</p>
</li>
<li><p>one root tree for the project</p>
</li>
</ul>
</li>
</ol>
<p>    Each tree has:</p>
<ul>
<li><p>maps filenames → blob hashes</p>
</li>
<li><p>stores permissions</p>
</li>
</ul>
<p>    Trees are also hashed and stored in <code>.git/objects</code>.</p>
<ol start="3">
<li><p><strong>Git creates a Commit object:</strong></p>
<p> Now Git creates <strong>one commit object</strong> containing:</p>
<ul>
<li><p>pointer to the root tree</p>
</li>
<li><p>pointer to parent commit</p>
</li>
<li><p>author, timestamp</p>
</li>
<li><p>commit message</p>
</li>
</ul>
</li>
</ol>
<p>    This commit is hashed and stored.</p>
<ol start="4">
<li><p><strong>Git updates HEAD:</strong></p>
<ul>
<li><p><code>HEAD</code> moves to point to the new commit</p>
</li>
<li><p>Current branch ref updates to the same commit</p>
</li>
</ul>
</li>
</ol>
<p>    <strong>Result of</strong> <code>git commit</code>:</p>
<ul>
<li><p>History grows</p>
</li>
<li><p>Snapshot becomes permanent</p>
</li>
<li><p>Previous commits remain untouched.  </p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768040512893/200cc4e8-57fb-4a9f-b827-f4ab8d4bdefe.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>Git might seem tricky because a lot of its processes happen in the background. However, once you understand what's inside the <code>.git</code> folder, it becomes clearer. Git is essentially a content-addressable database that keeps snapshots of your project using blobs, trees, and commits, all connected by hashes.</p>
<p>Commands like <code>git add</code> and <code>git commit</code> aren't magical, they are simply ways to interact with this structure. When you know what Git is doing internally, it's easier to fix errors, debugging becomes more straightforward, and workflows feel more dependable. Instead of just memorizing commands, you gain a clear understanding of how Git tracks changes, maintains history, and ensures everything is accurate. This understanding is what makes Git truly powerful.</p>
]]></content:encoded></item><item><title><![CDATA[Why Version Control Exists: The Pendrive Problem]]></title><description><![CDATA[Why Version Control Exists:
The need for version control arises as the complexity of the project continues to increase. The code of the project is not written once; it continues evolving over time. A version control system helps manage the different ...]]></description><link>https://blog.ayushsawant.dev/why-version-control-exists-the-pendrive-problem</link><guid isPermaLink="true">https://blog.ayushsawant.dev/why-version-control-exists-the-pendrive-problem</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><category><![CDATA[version control systems]]></category><category><![CDATA[#learning-in-public]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Wed, 07 Jan 2026 08:16:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1767773453492/663f1754-6b3b-40c8-9e03-e6c6f47e8cfd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-why-version-control-exists">Why Version Control Exists:</h2>
<p>The need for version control arises as the complexity of the project continues to increase. The code of the project is not written once; it continues evolving over time. A version control system helps manage the different versions of a project. As the software changes eventually, keeping track of all the versions can be challenging.</p>
<p>The version control system tracks all the changes made to the codebase. When a mistake occurs in the code or a bug is reported, the tracked versions are crucial. They help identify which change in the code led to the bug, making it easier to resolve. It allows you to compare the older version of the code against the newer version, which might have new features added later. It allows developers to revert to a previously stable version in case something goes wrong. The version control system allows multiple developers to collaborate on a project and make their own contributions to the codebase without risking overwrites. The version control system brings accountability to the development process by providing details like the timestamp and the author of the change.</p>
<p>Imagine you are working on a hackathon project and need to add a new feature. This is where the version control system becomes useful, as it saves the last working version of the project. Giving you the freedom to experiment with the feature while keeping the working version safe from any unnecessary changes. The famous version control system 'Git' was developed by Linus Torvalds while working on his ambitious project of the Linux OS. He faced similar problems during development and needed a tool to manage different versions of the project while allowing collaboration among multiple developers. This led to the creation of Git.</p>
<h2 id="heading-the-pendrive-analogy-in-software-development">The Pendrive Analogy in Software Development</h2>
<p>Having started programming before learning about Git, I used to share my program with friends on WhatsApp or upload the zip file of the project to the drive and send them the link. Using this method, my friend would debug the program and send it back to me. It was too time-consuming and inefficient, leading to the classic development problem of having multiple versions of the code like final_v1, final_v2, final_latest and final_latest_latest_v1.</p>
<p>This is where the classic pendrive analogy comes in. A developer writes the code, zips it, and copies it to a pendrive to share with a friend who will work on a new feature or debug and then return the pendrive. The problem arises when trying to identify what changes were made in the code.</p>
<p>A developer writes some code and encounters a bug, then zips the code to share with a friend who is supposed to resolve the bug. He moves the code to a pendrive and shares it with the friend. This friend writes some code and debugs the program, moving it back to the pendrive to share with the first developer. When the first developer opens the code, he sees that the bug has been resolved but is unable to identify what changes were made to the code. Merging the different changes created by two developers becomes even more complex when a third developer joins the project. Coordinating a single pendrive and managing the different versions from these developers is challenging. As the project grows, multiple versions appear, causing confusion about which one actually works.</p>
<pre><code class="lang-plaintext">Day 1 → project
Day 3 → project_final
Day 5 → project_latest_latest_v1
Day 7 → project_final_latest_latest_v1
Which one actually works?
</code></pre>
<h3 id="heading-old-methods-used-by-developers">Old Methods Used by Developers</h3>
<ul>
<li><p>Exchanging project zip files</p>
</li>
<li><p>Carrying code in pendrives between computers</p>
</li>
<li><p>Sending updated files over email</p>
</li>
<li><p>Maintaining backups in shared drives</p>
</li>
<li><p>Keeping multiple folders for safety</p>
</li>
</ul>
<h3 id="heading-major-problems">Major Problems</h3>
<ul>
<li><p>Accidental overwriting of teammates’ work</p>
</li>
<li><p>Loss of pendrive leading to complete data loss</p>
</li>
<li><p>Corrupted zip files</p>
</li>
<li><p>No rollback mechanism</p>
</li>
<li><p>No accountability</p>
</li>
<li><p>No safe way to experiment</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1767771369721/98ed427e-c884-4625-a115-c4d3de7f98dd.jpeg" alt class="image--center mx-auto" /></p>
</li>
</ul>
<h3 id="heading-what-version-control-replaced">What Version Control Replaced</h3>
<ul>
<li><p>Central repository instead of pendrive</p>
</li>
<li><p>Commits instead of renamed folders</p>
</li>
<li><p>Branches instead of duplicate files</p>
</li>
<li><p>Pull/merge instead of manual copy paste</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1767771536227/209d9b5a-c4f8-488a-8363-fb32710aac18.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The version control system solves the pendrive chaos by providing a way to track changes made to the code along with the timestamp and author, bringing accountability to the work. Creates a sequential history of all the versions of the project, making it easier to pinpoint any specific change made to the code by any contributor. Today, Git is universally used by developers to manage their code. The pendrive problem wasn't really about storage. It was about lost work, broken collaboration, no history, and no trust in the process. With this understanding of the issues that existed before Git, let's move forward and explore "<a target="_blank" href="https://thebuildlog.hashnode.dev/git-for-beginners-basics-and-essential-commands">Git for Beginners: Basics and Essential Commands.</a>" Here, we will learn the core commands and workflows of a modern version control system.</p>
]]></content:encoded></item><item><title><![CDATA[Git for Beginners: Basics and Essential Commands]]></title><description><![CDATA[1. What is Git?
Git is a distributed version control system and is essentially a code tracker in simple words. Git works in a way that it tracks the commits made to a code base making it easier to track and understand the changes developers made over...]]></description><link>https://blog.ayushsawant.dev/git-for-beginners-basics-and-essential-commands</link><guid isPermaLink="true">https://blog.ayushsawant.dev/git-for-beginners-basics-and-essential-commands</guid><category><![CDATA[Git]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[#learning-in-public]]></category><dc:creator><![CDATA[Ayush Sawant]]></dc:creator><pubDate>Tue, 06 Jan 2026 14:56:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1767711309732/c6befc78-21d5-4b68-9d2c-af50427f883f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-1-what-is-git">1. What is Git?</h2>
<p>Git is a distributed version control system and is essentially a code tracker in simple words. Git works in a way that it tracks the commits made to a code base making it easier to track and understand the changes developers made over time while working on the project. Git helps keep track of any additions or deletions made to the code as it tracks the various versions of the project. Git stores the project data such as who authored the commit, the timestamp of the commit and also the previous versions(history) of the project in the repository. GitHub is a remote version control system that acts as a server storing a copy of the Git repository and allowing you to collaborate with multiple developers. GitHub is the server where the data related to the changes is stored for access by collaborators. GitHub receives commits when you push them and allows others to pull those commits, showcasing collaboration.</p>
<h2 id="heading-2-why-git-is-used">2. Why Git is Used?</h2>
<p>Working on a project without Git makes it difficult to track changes, undo mistakes, and understand how the code evolved over time. Problems like creating multiple copies of the project with different changes in each version and no coordination between them were faced by developers. Not using Git creates a fear of breaking the currently working code, which can prevent one from adding new features. Only if they use Git can they have a working version of the code saved and then freely experiment with the code to try adding new features. Even solo developers need Git because they may not remember the changes they made to the code yesterday, which adds a lot of friction to the programming process. Problems like not knowing which change broke the code can also occur.<br />Even team collaboration needs Git, as it allows them to work on the code simultaneously. Git records which developer made each specific change to the code, along with the timestamp, and this data is stored in the repository. GitHub, being the server hosting Git, allows for collaboration and provides clarity on who made a certain change to the code. In large codebases, it can be hard to find and identify changes made by any developer. Git helps by keeping track of every change and who made it.<br />Git was originally created by Linus while developing his Linux operating system when he needed a version control system to track changes made to the code. Having seen the problems that arise if Git is not used, let’s understand how Git actually solves them.</p>
<h2 id="heading-3-git-basics-and-core-terminologies">3. Git Basics and Core Terminologies</h2>
<h3 id="heading-repository">Repository:</h3>
<p>Repository is the place where every change made on the code is stored. Repository can exist locally on a developer’s machine, and it can also exist remotely on platforms like GitHub. Git works locally, while GitHub stores the remote copies of the repositories. Once a commit is made, the changes to the code, the author of the commit, and the timestamp of the commit are stored in the repository.</p>
<h3 id="heading-working-directory">Working Directory:</h3>
<p>Working directory is the folder where our project exists and it contains the source code, README, and any other file that is currently being editing. The working directory is the current state of the project where files are being edited before being saved into Git’s history. Git does not save any file or change automatically unless a commit is made.</p>
<h3 id="heading-staging-area">Staging Area:</h3>
<p>Staging Area is the location where the change is stored before a commit is made. The staging area is the intermediate state between a working directory and a repository. Once a change is made to the code, the file is added to the staging area. After being added to the staging area, a commit is made, which stores the change in the repository.</p>
<h3 id="heading-commit">Commit:</h3>
<p>Commit is the snapshot of the project that is stored in the repository. A commit is created from the changes added to the staging area. Once a change is added to the staging area, it is committed, and then those changes are stored in the repository. A commit stores data such as the exact changes made to the code, the author of the changes, the timestamp of the commit, and links to previous commits.</p>
<h3 id="heading-commit-history">Commit History:</h3>
<p>Commit History is the record of all the commits made so far by the multiple programmers. All of the past commits are represented in a sequential manner, and each commit points to the previous one. Commit History represents the timeline of the project.</p>
<h3 id="heading-branch">Branch:</h3>
<p>Branch is the concept in Git that creates a separate line of development. Branching allows working on different features without affecting the original code. Using Git, different developers can create branches of the code and work on their own specific version of the code. This allows multiple developers to work on a single project simultaneously and on different features.</p>
<h3 id="heading-head">HEAD:</h3>
<p>HEAD points to the latest commit. It represents the current state of the project in Git history. When a new commit is made, HEAD moves forward and points to the new commit. HEAD is essentially a pointer to the latest commit. The HEAD branch points to the branch currently being worked on.</p>
<h2 id="heading-4-common-git-commands">4. Common Git Commands</h2>
<h3 id="heading-installing-git">Installing Git:</h3>
<ol>
<li><p>Navigate to the latest <a target="_blank" href="https://gitforwindows.org/">Git for Windows installer</a> and download the latest version.</p>
</li>
<li><p>Once the installer has started, follow the instructions as provided in the <strong>Git Setup</strong> wizard screen until the installation is complete.</p>
</li>
<li><p>Open the windows command prompt</p>
</li>
<li><p>Type <code>git version</code> to verify Git was installed.</p>
</li>
</ol>
<h3 id="heading-essential-commands">Essential Commands:</h3>
<ol>
<li><p><code>git init</code> → Used to create a Git Repository, it runs only once per project.</p>
</li>
<li><p><code>git add</code> → Used to add the current changes from working directory to the staging area, waiting to be committed.</p>
</li>
<li><p><code>git commit</code> → Used to add the commit to the repository and saves any staged changes.</p>
</li>
<li><p><code>git revert</code> → Used to create a new commit that undoes any unwanted changes made in an earlier commit by creating the complement of the commit.</p>
</li>
<li><p><code>git reset</code> → Used to move the HEAD to a certain commit and optionally upstages or discards changes.</p>
</li>
<li><p><code>git log</code> → Used to display the history of all the commits made so far.</p>
</li>
<li><p><code>git diff</code> → Used to find the differences between two different commits, it is used to point what changed between those two commits.</p>
</li>
<li><p><code>git status</code> → Used to show the current state of your working directory and staging area.</p>
</li>
</ol>
<h3 id="heading-basic-developer-workflow">Basic Developer Workflow:</h3>
<ul>
<li><p>A developer creates a project folder.</p>
</li>
<li><p>Initialize Git using <code>git init</code></p>
</li>
<li><p>Edits files</p>
</li>
<li><p>Checks state using <code>git status</code></p>
</li>
<li><p>Stages changes with <code>git add</code></p>
</li>
<li><p>Saves snapshot with <code>git commit</code></p>
</li>
<li><p>Views history with <code>git log</code></p>
</li>
</ul>
<p>The basic development workflow starts with creating a project folder, which is the working directory where all the files reside. This is the fundamental step in the development process. After creating the project folder, the folder is initialized using <code>git init</code>, which creates a repository where all the changes will be saved. The developer starts working on the project and checks the project state using <code>git status</code>. Once enough progress is made, the developer uses the command <code>git add</code> to add the changes to the staging area. Later, <code>git commit</code> is run to commit those changes and save them to the repository. After several commits, <code>git log</code> is used to see the history of all the commits made so far.</p>
<h2 id="heading-diagrams">Diagrams:</h2>
<ol>
<li><h3 id="heading-git-working-lifecycle">Git Working Lifecycle:</h3>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1767710382210/01e7b4b6-bf5a-4410-a96a-aecdeb65cac2.png" alt="Git Working Lifecycle" class="image--center mx-auto" /></p>
<ol start="2">
<li><h3 id="heading-git-commit-timeline">Git Commit Timeline:</h3>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1767710511210/931277e9-648d-4974-8542-0534247c0ce9.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
]]></content:encoded></item></channel></rss>