<?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 Engineering Log]]></title><description><![CDATA[Documenting the journey from bits to architecture. A technical archive exploring internals, engineering, infrastructure, and the systems that power modern softw]]></description><link>https://blog.mayurbadgujar.me</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1768137090476/ca0fe617-abfb-43de-8583-c244a8723235.png</url><title>The Engineering Log</title><link>https://blog.mayurbadgujar.me</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 17:44:44 GMT</lastBuildDate><atom:link href="https://blog.mayurbadgujar.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Chef’s Recipe (Declarations vs. Expressions)]]></title><description><![CDATA[Welcome back, friends! ☕
In our last post, we made our code smart using if/else and switch. But we hit a wall: if we want to grade 100 students on the Masterji platform, we had to write the same 10 li]]></description><link>https://blog.mayurbadgujar.me/chef-s-recipe-declarations-vs-expressions</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/chef-s-recipe-declarations-vs-expressions</guid><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sun, 15 Mar 2026 13:32:22 GMT</pubDate><content:encoded><![CDATA[<p>Welcome back, friends! ☕</p>
<p>In our last post, we made our code smart using <code>if/else</code> and <code>switch</code>. But we hit a wall: if we want to grade 100 students on the Masterji platform, we had to write the same 10 lines of <code>if/else</code> code 100 times.</p>
<p>Developers are lazy. We don't repeat ourselves (the DRY principle: Don't Repeat Yourself). Instead, we take those 10 lines of code, put them in a box, and just press a button whenever we want to use them.</p>
<p>That box is called a <strong>Function</strong>.</p>
<p>But JavaScript, being the weird and wonderful language it is, gives us two different ways to hire a chef to cook our code: <strong>Function Declarations</strong> and <strong>Function Expressions</strong>. Let's look at the difference.</p>
<h3>1. Famous Dhaba (Function Declaration)</h3>
<p>A Function Declaration is the traditional, old-school way to write a function. You give it a name, and you tell it what to do.</p>
<p>Let's write a function to make chai:</p>
<pre><code class="language-javascript">// Calling the function BEFORE it's even created?!
makeChai(); 

// The Declaration
function makeChai() {
  console.log("Boiling water, adding tea leaves, sugar, and milk... Chai is ready! ☕");
}
</code></pre>
<p>Wait, look closely at that code. We called <code>makeChai()</code> on line 2, but we didn't write the recipe until line 5. <strong>How did it not crash?!</strong></p>
<h4>Magic of "Hoisting"</h4>
<p>Function Declarations are like "Masterji's Famous Dhaba". Before the JavaScript engine even runs your code line-by-line, it scans the whole file, finds all the Function Declarations, and "hoists" them to the very top of memory.</p>
<p>Because it's officially registered in the JS phonebook from second one, you can call it from <em>anywhere</em> in your file.</p>
<h3>Pop-Up Food Truck (Function Expression)</h3>
<p>Now, let's look at the second way. Remember how we learned that we can store Numbers, Strings, and Arrays inside a variable? Well, in JavaScript, <strong>Functions are just Data Types too!</strong> That means we can write a function and stuff it directly inside a <code>const</code> or <code>let</code> variable. This is called a <strong>Function Expression</strong>.</p>
<pre><code class="language-javascript">// Trying to order before the truck arrives...
// makeCoffee(); // ❌ ERROR: Cannot access 'makeCoffee' before initialization!

const makeCoffee = function() {
  console.log("Brewing some dark roast coffee... ☕");
};

// Now you can order!
makeCoffee(); // ✅ Works perfectly.
</code></pre>
<h4>The Knowledge Bomb: The Temporal Dead Zone (TDZ)</h4>
<p>Wait, why did the first one crash? Is it because <code>const</code> and <code>let</code> aren't hoisted?</p>
<p>Actually, here is a massive JS interview secret: <strong>They ARE hoisted.</strong> The JS engine <em>knows</em> the <code>makeCoffee</code> variable exists from line 1. But instead of letting you use it, the engine puts it in a strict waiting area called the <strong>Temporal Dead Zone (TDZ)</strong>.</p>
<p>Think of it like this: The city knows the parking spot is reserved for the <code>makeCoffee</code> truck (it's hoisted!). But they put up yellow police tape around it until the truck actually arrives and parks. If you try to cross that tape to order coffee <em>before</em> the truck is initialized, you get tackled by security (JavaScript throws a ReferenceError!).</p>
<p><em>(Side note: If you used the dreaded</em> <code>var</code> <em>instead of</em> <code>const</code><em>, there is no police tape. The city just puts an empty cardboard box there that says</em> <code>undefined</code><em>. You wouldn't get an error, but you definitely wouldn't get coffee either!)</em></p>
<p>You can only access a Function Expression <em>after</em> it has been assigned. It gives you strict, predictable control over your code flow.</p>
<h3>3. "Anonymous" Chef</h3>
<p>Did you notice something weird about the Function Expression above? Look at the right side of the equals sign: <code>function() { ... }</code>.</p>
<p>The function itself <strong>doesn't have a name</strong>! Because we stored it in the <code>makeCoffee</code> variable, the function doesn't need its own name. We just call the variable. A function without a name is called an <strong>Anonymous Function</strong>.</p>
<p>It’s like hiring a freelance chef. You don't care what his real name is, you just call him "The Coffee Guy" (the variable name) and he does his job.</p>
<h3>Which one should you use?</h3>
<p>Honestly? Both are great.</p>
<ul>
<li><p>Use <strong>Function Declarations</strong> when you want utility functions (like math calculators) that you can use anywhere in your file without worrying about order.</p>
</li>
<li><p>Use <strong>Function Expressions</strong> when you want strict control, or when you are passing functions around as data (which we will do a lot in React!).</p>
</li>
</ul>
<h3>What's Next?</h3>
<p>Alright, we know how to make reusable boxes of code. But typing the word <code>function</code> every single time gets exhausting.</p>
<p>Remember what I said? Developers are lazy. In 2015, JS gave us an ultimate shortcut that changed the way we write code forever. In our next JS Exploration, we are diving into <strong>Arrow Functions</strong> <code>() =&gt; {}</code>.</p>
<p>Drink your chai, and I'll see you there!</p>
]]></content:encoded></item><item><title><![CDATA[Masterji Logic (If, Else & Switch)]]></title><description><![CDATA[Welcome back, bro! ☕
In our last session, we gathered our data (Variables) and learned how to do the math and comparisons (Operators). But right now, our code is a bit..... dumb. It just runs straight]]></description><link>https://blog.mayurbadgujar.me/javascript-control-flow-masterji</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/javascript-control-flow-masterji</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sun, 15 Mar 2026 12:33:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/86dc9302-3b5f-40ad-b68a-f8b9c0212857.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome back, bro! ☕</p>
<p>In our last session, we gathered our data (Variables) and learned how to do the math and comparisons (Operators). But right now, our code is a bit..... dumb. It just runs straight from line 1 to line 100 without thinking.</p>
<p>Real applications don't work like that. If you click a "Submit" button with empty fields, the app shouldn't just crash, it should say, <em>"Hey, fill this out first!"</em> To make our code actually think and make decisions, we use <strong>Control Flow</strong>.</p>
<p>Instead of our RPG game from last time, let's look at something we all know too well. Imagine we are building the backend for a brand new EdTech platform called <strong>Masterji</strong>. We need to automate the logic for giving out course certificates, bounties, and goodies. Let's write the logic!</p>
<h3>1. <code>if</code> Statement</h3>
<p>The <code>if</code> statement is the simplest way to make a decision. You give JavaScript a condition (using the Operators we learned last time!). If the condition is <code>true</code>, it runs the code inside the block <code>{}</code>. If it's <code>false</code>, it completely ignores it.</p>
<p>Let's check if a student is ready to graduate:</p>
<pre><code class="language-javascript">let courseProgress = 100;

// Masterji checks the progress...
if (courseProgress === 100) {
  console.log("Congratulations! Your JS Certificate is in your inbox.");
}

// If progress is 99, JavaScript just skips the block and says nothing.
</code></pre>
<h3>2. <code>else</code> Statement</h3>
<p>Just using <code>if</code> is great, but what if the student <em>isn't</em> at 100%? We shouldn't just leave them hanging in silence. We need a fallback plan. That’s where <code>else</code> comes in.</p>
<p>Think of <code>else</code> as the default response when the <code>if</code> condition fails.</p>
<pre><code class="language-javascript">let assignmentScore = 45;
let passingMarks = 50;

if (assignmentScore &gt;= passingMarks) {
  console.log("Awesome job! You passed the assignment. 🎉");
} else {
  console.log("Masterji says: Beta, you need to study more. Try again!");
}
</code></pre>
<p><em>Notice how there is no condition next to</em> <code>else</code><em>? It simply catches EVERYTHING that didn't pass the</em> <code>if</code> <em>test.</em></p>
<h3>3. <code>else if</code> Ladder</h3>
<p>Okay, now let's build the fun part: The Masterji Reward System.</p>
<p>What if we have more than two outcomes? Pass or Fail isn't enough. We want to give a Mechanical Keyboard to top scorers, a T-shirt to good scorers, and just stickers to the rest.</p>
<p>We chain conditions together using <code>else if</code>. JavaScript will check them one by one, from top to bottom. <strong>As soon as it finds one that is</strong> <code>true</code><strong>, it runs that code and skips the rest.</strong></p>
<pre><code class="language-javascript">let testScore = 92;

if (testScore &gt;= 95) {
  console.log("Bounty Unlocked: Mechanical Keyboard!");
} else if (testScore &gt;= 80) {
  console.log("Goodie Unlocked: Exclusive Masterji T-Shirt!");
} else if (testScore &gt;= 60) {
  console.log("Goodie Unlocked: Laptop Stickers!");
} else {
  console.log("You passed, but no goodies this time. Just my blessings.");
}
</code></pre>
<p><em>Bro, order matters here!</em> If we put <code>testScore &gt;= 60</code> at the very top, a student with <code>99</code> marks would hit that first condition, get some stickers, and the code would stop running. They’d miss out on their keyboard! Always check your highest/strictest conditions first.</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/1aba3af2-3f7d-475c-9b96-909a3f682b33.png" alt="" style="display:block;margin:0 auto" />

<h3>4. <code>switch</code> Statement</h3>
<p>The <code>else if</code> ladder is great for checking ranges (like <code>&gt;= 80</code>). But what if a student is selecting a specific learning track on their Masterji dashboard?</p>
<p>If we have 5 different tracks, writing <code>else if (track === "Frontend")</code>, <code>else if (track === "Backend")</code>, over and over again gets messy and annoying to read.</p>
<p>When you have a single variable and you want to check it against a bunch of <em>exact</em> matches, use a <code>switch</code> statement!</p>
<pre><code class="language-javascript">let selectedTrack = "DevOps";

switch (selectedTrack) {
  case "Frontend":
    console.log("Roadmap loaded: HTML, CSS, React. Have fun making buttons!");
    break;

  case "Backend":
    console.log("Roadmap loaded: Node.js, Express, Databases. Welcome to the shadows.");
    break;

  case "DevOps":
    console.log("Roadmap loaded: Docker, AWS, CI/CD. You love pain, don't you? 🐳");
    break;

  default:
    console.log("Track not found. Are you just here for the free chai?");
}
</code></pre>
<h4><code>break</code> Trap!</h4>
<p>Did you notice the <code>break</code> keyword at the end of every case? This is crucial. If you forget to write <code>break</code>, JavaScript suffers from something called <strong>"Fall-through"</strong>.</p>
<p>If we removed the <code>break</code>s and selected <code>"Frontend"</code>, Masterji would print the Frontend roadmap... AND the Backend roadmap... AND the DevOps roadmap. It literally executes every line below it until it hits the end. Always use <code>break</code> to tell JS: <em>"We found our match, stop checking!"</em></p>
<h3>Shortcut (Ternary Operator)</h3>
<p>Sometimes, you just want to do a simple <code>if/else</code> on one single line. Devs hate typing, remember?</p>
<p>Let's check if a user gets premium access. Instead of writing 5 lines of <code>if/else</code>, we use the <strong>Ternary Operator (</strong><code>? :</code><strong>)</strong>.</p>
<p>It reads exactly like plain English: <code>Condition ? If True : If False</code></p>
<pre><code class="language-javascript">let hasPaidSubscription = true;

// Is it true ? Yes do this : No do this
let accessLevel = hasPaidSubscription ? "Premium Videos Unlocked" : "Show Ads";

console.log(accessLevel);
</code></pre>
<p>Makes you look like a senior dev.</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/00e15106-d531-4794-abfa-2479ad3659f6.png" alt="" style="display:block;margin:0 auto" />

<h3>What's Next?</h3>
<p>Look at us! We are officially controlling how our code thinks. Masterji is now fully operational, handing out bounties and kicking out students who fail their <code>if</code> checks.</p>
<p>But right now, if we want to grade 100 students, we'd have to write our logic 100 times. That violates the #1 rule of coding: <strong>DRY (Don't Repeat Yourself)</strong>.</p>
<p>In our next <strong>JS Exploration</strong>, we are going to learn how to pack our code into reusable chunks. We are tackling <strong>Functions (Declaration vs. Expressions)</strong>.</p>
<p>Grab some water, review your <code>switch</code> cases, and I'll catch you in the next one!</p>
]]></content:encoded></item><item><title><![CDATA[Late-Night Lobby (Operators)]]></title><description><![CDATA[Welcome back, bro! In our last session, we created our storage chests (Variables) and filled them with loot (Data Types). But right now, those boxes are just sitting there doing absolutely nothing.
To]]></description><link>https://blog.mayurbadgujar.me/javascript-operators-gaming-lobby</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/javascript-operators-gaming-lobby</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sun, 15 Mar 2026 10:03:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/f340a3f8-972c-4c0a-81c0-38b764ffc294.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome back, bro! In our last session, we created our storage chests (Variables) and filled them with loot (Data Types). But right now, those boxes are just sitting there doing absolutely nothing.</p>
<p>To make a game or any web app actually work, we need to calculate scores, compare levels, and make decisions. We need <strong>Operators</strong>.</p>
<p>Forget the boring math textbook definitions. Imagine it’s 2 AM, and me (Mayur), Alok, and Abhinav just booted up a multiplayer game. Here is how JavaScript operators are secretly running our entire gaming session.</p>
<h3>1. Scoreboard (Arithmetic Operators)</h3>
<p>Every time we play, the game has to constantly update our points. This is where basic math operators come in: <code>+</code> (Add), <code>-</code> (Subtract), <code>*</code> (Multiply), and <code>/</code> (Divide).</p>
<pre><code class="language-javascript">let mayurScore = 100;
let alokScore = 100;

// I got a headshot!
mayurScore = mayurScore + 50; 

// Alok fell off the map (classic Alok) 💀
alokScore = alokScore - 20; 
</code></pre>
<p><strong>The Loot Split (And the</strong> <code>%</code> <strong>trick):</strong> We just defeated a boss and a chest dropped <strong>100 gold coins</strong>. There are 3 of us. If we use division (<code>100 / 3</code>), JavaScript gives us <code>33.333333333333336</code>. Nobody wants 0.33 of a digital coin.</p>
<p>Enter the <strong>Modulo (</strong><code>%</code><strong>)</strong> operator! Beginners always think <code>%</code> means percentage. It doesn’t! It means: <em>"If I divide these numbers, what is the remainder?"</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/4d162da2-c20a-459d-a900-167cac557ac4.png" alt="" style="display:block;margin:0 auto" />

<pre><code class="language-javascript">let totalGold = 100;
let players = 3;

let leftoverGold = totalGold % players; 
console.log(leftoverGold); // Output: 1
</code></pre>
<p>Everyone gets 33 coins, and since <code>100 % 3 = 1</code>, there is exactly 1 coin left over. (And obviously, since I'm hosting the lobby, I'm keeping it).</p>
<h3>2. "I'm Too Lazy to Type" Update (Assignment Operators)</h3>
<p>Writing <code>mayurScore = mayurScore + 50</code> every single time I get a kill is exhausting. Developers are inherently lazy (we call it being "efficient").</p>
<p>Instead of writing the variable name twice, JavaScript gives us <strong>Assignment Operators</strong> like <code>+=</code>, <code>-=</code>, and <code>*=</code>.</p>
<pre><code class="language-javascript">// The old, boring way
mayurScore = mayurScore + 50;

// The Pro-Gamer way
mayurScore += 50; 
alokScore -= 20;  // Alok fell off the map again...
</code></pre>
<p><strong>The Ultimate Shortcut (</strong><code>++</code> <strong>and</strong> <code>--</code><strong>):</strong> What if we just want to count how many matches we've played by adding exactly <code>1</code> each time?</p>
<pre><code class="language-javascript">let matchesPlayed = 5;

// Adds exactly 1 to the current value
matchesPlayed++; 
console.log(matchesPlayed); // Output: 6
</code></pre>
<h3>3. Who is the Boss? (Comparison Operators)</h3>
<p>You can't have a multiplayer game without a little toxicity and comparing stats. JavaScript lets us compare variables using <code>&lt;</code>, <code>&gt;</code>, <code>&lt;=</code>, and <code>&gt;=</code>. These always return a Boolean (<code>true</code> or <code>false</code>).</p>
<pre><code class="language-javascript">let myLevel = 50;
let abhinavLevel = 45;

console.log(myLevel &gt; abhinavLevel); // true (I'm the boss here)
console.log(myLevel &lt;= 50);          // true (I am exactly 50 or less)
</code></pre>
<h4>Bomb: <code>==</code> vs <code>===</code></h4>
<p>This is the most important rule in JavaScript comparison.</p>
<p>Let's say to join the VIP server, your level must be exactly <code>50</code>.</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/26cff13e-4798-482b-9d31-72215f34ccb1.png" alt="" style="display:block;margin:0 auto" />

<ul>
<li><p><code>==</code> <strong>(Loose Equality)</strong> is like a terrible, sleepy bouncer at a club. If the server needs the Number <code>50</code>, but you give it the String <code>"50"</code>, the <code>==</code> bouncer says, <em>"Eh, looks close enough, go on in."</em></p>
</li>
<li><p><code>===</code> <strong>(Strict Equality)</strong> is the strict, terrifying bouncer. It checks both the <strong>Value</strong> AND the <strong>Data Type</strong>. If you bring a String <code>"50"</code>, it kicks you out.</p>
</li>
</ul>
<pre><code class="language-javascript">let requiredLevel = 50;    // Number
let playerInput = "50";    // String

console.log(requiredLevel == playerInput);  // true  (Terrible! Don't use this)
console.log(requiredLevel === playerInput); // false (Perfect! Security is tight)
</code></pre>
<p><em>Rule of thumb: Always, ALWAYS use</em> <code>===</code><em>. Pretend</em> <code>==</code> <em>doesn't exist.</em></p>
<h3>4. Squad Logic (Logical Operators)</h3>
<p>This is real-life gamer logic. Before we queue up for a match, we have rules about who we play with. JavaScript handles this using <strong>Logical Operators</strong>: <code>&amp;&amp;</code> (AND), <code>||</code> (OR), and <code>!</code> (NOT).</p>
<p><code>&amp;&amp;</code> <strong>(AND) Operator:</strong> Both sides MUST be <code>true</code>. <em>I will only play the super-sweaty Ranked mode if BOTH Alok AND Abhinav are online.</em></p>
<pre><code class="language-javascript">let isAlokOnline = true;
let isAbhinavOnline = true;

let playRanked = isAlokOnline &amp;&amp; isAbhinavOnline; 
console.log("Playing Ranked? ", playRanked); // true! Both are here.
</code></pre>
<p><code>||</code> <strong>(OR) Operator:</strong> Only ONE side needs to be <code>true</code>. <em>I'll play casual matches if Alok OR Tasnish is online. I just need one of them.</em></p>
<pre><code class="language-javascript">let isAlokOnline = false;
let isTasnishOnline = true;

let playCasual = isAlokOnline || isTasnishOnline;
console.log("Playing Casual? ", playCasual); // true! At least Tasnish is here.
</code></pre>
<p><code>!</code> <strong>(NOT) Operator (Uno Reverse Card):</strong> You know that one friend who always says, <em>"Nah bro, I'm not playing tonight"</em>? We don't accept that logic. The <code>!</code> operator flips a boolean completely. If he says <code>false</code>, we make it <code>true</code>.</p>
<pre><code class="language-javascript">let abhinavWantsToPlay = false;

// If he says no, hit him with the ! to make it a yes. Force him into the lobby!
let forceIntoLobby = !abhinavWantsToPlay; 

console.log("Is Abhinav playing? ", forceIntoLobby); // Output: true 😂
</code></pre>
<h3>What's Next?</h3>
<p>Now you know how to do the math, compare the stats, and set up the squad logic.</p>
<p>But right now, our code just runs straight from top to bottom. What if we want the game to say <em>"If Mayur wins, show a victory screen, ELSE show a game over screen"</em>?</p>
<p>In the next post, we are diving into <strong>Control Flow (If, Else, and Switch)</strong> so we can finally let our code make its own decisions. Grab a fresh chai, and I'll see you there!</p>
]]></content:encoded></item><item><title><![CDATA[Surviving the Flash Sale: My Journey from a Fragile Monolith to a K8s Distributed System]]></title><description><![CDATA[When I first sat down to build a backend engine, the goal seemed straightforward: build a system that can sell 1,000 iPhones to 10,000+ highly eager users during a "Flash Sale."
How hard could it be, ]]></description><link>https://blog.mayurbadgujar.me/surviving-flash-sale-monolith-to-kubernetes</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/surviving-flash-sale-monolith-to-kubernetes</guid><category><![CDATA[System Design]]></category><category><![CDATA[Kubernetes]]></category><category><![CDATA[Microservices]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[backend]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sun, 08 Mar 2026 13:50:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/21b9975c-8091-46fd-97da-c69204a80c0c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When I first sat down to build a backend engine, the goal seemed straightforward: build a system that can sell 1,000 iPhones to 10,000+ highly eager users during a "Flash Sale."</p>
<p>How hard could it be, right?</p>
<p>It turns out, handling massive, concurrent checkout traffic without overselling your inventory or crashing your server is one of the hardest problems in backend engineering. This is the story of how I built the <code>Distributed-Flash-Sale-Engine</code>, hit a massive brick wall, and completely re-architected my system to survive the chaos.</p>
<h3>Chapter 1: The Naive Beginnings (Nov 22 - 24)</h3>
<p>I started where most developers start: I built a standard monolithic API using Node.js and Express, connected it to MongoDB, and wrote a simple <code>/buy</code> endpoint.</p>
<p>But I immediately ran into my first major logic bug: <strong>The Race Condition</strong>.</p>
<p>Imagine two users, Mayur and Prerana, clicking "Buy" at the exact same millisecond. The server checks the database for both of them simultaneously.</p>
<ul>
<li><p>"Are there any iPhones left?" -&gt; Yes, 1 left.</p>
</li>
<li><p>Both users pass the check.</p>
</li>
<li><p>Both users decrement the stock.</p>
</li>
<li><p>The stock becomes <code>-1</code>. I just sold a phone I don't have.</p>
</li>
</ul>
<p>To fix this, I had to drop down to the database level and implement strict <strong>ACID transactions</strong> to ensure that checking the stock and buying the item happened sequentially, never overlapping.</p>
<h3>Chapter 2: Caching &amp; Crashing (Nov 30 - Dec 6)</h3>
<p>The database was safe, but it was slow. Checking MongoDB for every single click was heavy. To speed things up, I integrated <strong>Redis</strong>.</p>
<p>Instead of a two-step "check then buy" process, I used Redis atomic locks (specifically the <code>DECR</code> command). This allowed the system to decrease the stock and check the new number in a single, unbreakable memory cycle. If the result was negative, the system threw an "Out of Stock" error instantly.</p>
<p><em>(Side note: I ran into a horrible infinite reconnect bug with Redis due to how I mounted my Docker volumes, but eventually squashed it!)</em></p>
<p>Feeling confident, I wrote a "Nuclear" load testing script using <strong>k6</strong> to simulate a massive spike in traffic.</p>
<p><strong>The result? The system absolutely burned to the ground.</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/242fb0e4-4d41-4e85-a8d3-bd505574ef02.png" alt="" style="display:block;margin:0 auto" />

<p>Why did it crash? Because I was using a <strong>Monolithic Architecture</strong>. Everything, user registration, stock checking, and order processing, lived inside one big Node.js process. When thousands of simulated users tried to register for the sale, hashing their passwords (<code>bcrypt</code>) ate 100% of the CPU. The server was so exhausted doing math that it couldn't process a simple stock check.</p>
<p>The checkout system wasn't broken; it was just starved of CPU by the authentication system.</p>
<h3>Chapter 3: The Great Migration (Dec 19 - 21)</h3>
<p>I realized that to scale the "Order" feature in a monolith, I had to duplicate the <em>entire</em> application, which wastes a ton of RAM. I needed to split the code up.</p>
<p>I spent the next few days tearing the monolith apart into a <strong>Microservices Architecture</strong>.</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/3039745e-381d-4730-bfd3-3a92edc84e7b.png" alt="" style="display:block;margin:0 auto" />

<p>I built a Node.js API Gateway to route traffic and separated the core logic into three distinct apps:</p>
<ol>
<li><p><strong>Auth Service</strong></p>
</li>
<li><p><strong>Stock Service</strong></p>
</li>
<li><p><strong>Order Service</strong></p>
</li>
</ol>
<p>In theory, this was beautiful. In practice, making these separate Docker containers talk to each other over a virtual network was a nightmare. I spent hours debugging inter-service HTTP calls and fixing Docker environment variable injections. But eventually, the services were communicating.</p>
<h3>Chapter 4: Kubernetes &amp; The Final Boss (Dec 22 - 23)</h3>
<p>Docker Compose is great for local development, but to handle a real Flash Sale, I needed serious infrastructure. I moved the entire ecosystem into a local Kubernetes (K8s) cluster using Docker Desktop. I wanted to see exactly how much traffic my own machine could orchestrate before breaking.  </p>
<p>The secret weapon here was the <strong>HPA (Horizontal Pod Autoscaler)</strong>. I gave Kubernetes a simple rule: <em>"If any service uses more than 50% of its CPU, instantly create a clone of it to handle the load."</em></p>
<p>It was time for the final boss. I fired up the k6 stress test: 200 concurrent users relentlessly hitting the system for 2 minutes straight.</p>
<p>The terminal logs were insane. The Auth Service got hit so hard by the heavy cryptography of password hashing that its CPU usage spiked to an unbelievable <strong>1439%</strong>!</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/8947662f-f458-40bd-9cb9-564eac340e26.png" alt="" style="display:block;margin:0 auto" />

<p>But the system didn't crash.</p>
<p>Kubernetes saw the Auth Service screaming for help and instantly scaled it from 1 pod to 5 pods (the max limit I set).</p>
<p>Benchmarking revealed exactly when the system needed help:</p>
<ul>
<li><p>The heavy <strong>Auth Service</strong> required a new server every <strong>~9 requests per second</strong>.</p>
</li>
<li><p>The complex <strong>Order Service</strong> scaled up every <strong>~12 RPS</strong>.</p>
</li>
<li><p>The lightweight <strong>Stock Service</strong> scaled up every <strong>~14 RPS</strong>.</p>
</li>
</ul>
<p>Because the domains were isolated, the chaos in the Auth service didn't affect the rest of the app. While Auth was fighting for its life, the Stock Service was casually serving requests with a lightning-fast <strong>10ms latency</strong> and a <strong>100% success rate</strong>.</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/961d7c51-b14d-4a8c-9242-eb4ee171c0b8.png" alt="" style="display:block;margin:0 auto" />

<h3>Conclusion</h3>
<p>Building this engine was a massive reality check. It taught me that writing the code is only half the battle.</p>
<p>Real backend engineering is about assuming that traffic will spike, servers will choke, and things will break. Moving from a fragile Monolith to a K8s Distributed System taught me the true value of <strong>Decoupling</strong>. When you isolate your services, a massive traffic spike on your login page won't prevent your active users from checking out.</p>
<p>The Flash Sale Engine survived, and I walked away with a profound respect for system design. 🚀</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Variables and Data Types in JavaScript]]></title><description><![CDATA[Hey! Welcome to the very first post of our JS Exploration series.
You know how it is, whenever you look up JavaScript variables online, you usually find the same boring examples like let x = 10 or let]]></description><link>https://blog.mayurbadgujar.me/javascript-variables-data-types</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/javascript-variables-data-types</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sun, 08 Mar 2026 09:20:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/c4abe598-8f26-4cd4-a5ef-ab5a13fff98a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey! Welcome to the very first post of our <strong>JS Exploration</strong> series.</p>
<p>You know how it is, whenever you look up JavaScript variables online, you usually find the same boring examples like <code>let x = 10</code> or <code>let apple = "fruit"</code>. But come on, we aren't here to build a fruit basket. We are here to build actual, complex applications.</p>
<p>So, put on your developer armor. Today, we are managing pirate ships, RPG hero stats, and magical inventories to really understand <strong>Variables and Data Types</strong> in JavaScript. Grab your chai, and let's get into it. ☕</p>
<h3>1. Storage Containers: <code>var</code>, <code>let</code>, and <code>const</code></h3>
<p>Think of variables like those treasure chests we keep hoarding in RPG games. You label the chest and stash something inside so you can easily find it later. In JavaScript, we have three ways to label our chests: <code>var</code>, <code>let</code>, and <code>const</code>.</p>
<h4>The Modern Standard: <code>let</code> and <code>const</code></h4>
<p>Honestly, 99% of the time, you will only use these two.</p>
<p><code>let</code> is used for values that you know will <em>change</em> (mutate) over time. Honestly, <code>let</code> is like your ex, can change at any time without warning! 😂</p>
<pre><code class="language-javascript">let crewCount = 12;
console.log("crew count: ", crewCount); // 12

// We recruited more sailors!
crewCount = 14; 
console.log("crew count: ", crewCount); // 14
</code></pre>
<p><code>const</code> is used for values that should <em>never</em> be reassigned. It literally stands for "constant". Think of <code>const</code> like your brothers and your daily cutting chai, they never leave you and they absolutely cannot be changed! ☕🤝</p>
<pre><code class="language-javascript">const captainName = "Jack Sparrow";
console.log("Captain Name: ", captainName);

// This will crash the ship (throw an error)! Don't even try it.
// captainName = "Dipesh"; 
</code></pre>
<h4>The Ghost of the Past: <code>var</code></h4>
<p>Before 2015, JavaScript only had <code>var</code>. It does the same job, but bro, it has a massive flaw: <strong>It doesn't respect block scope.</strong> Imagine hiding your treasure inside a secure room (like an <code>if</code> statement block). With <code>let</code> or <code>const</code>, the treasure stays locked in that room. With <code>var</code>, it magically leaks out through the walls.</p>
<pre><code class="language-javascript">if (true) {
  var leakyTreasure = "Gold coins";
}

// var ignores the {} walls! How did this get out?!
console.log(leakyTreasure); // Output: "Gold coins"
</code></pre>
<p><em>My advice? Always use</em> <code>let</code> <em>and</em> <code>const</code><em>. Leave</em> <code>var</code> <em>at the bottom of the ocean. (Speaking of the ocean, have you explored our "</em><a href="https://blog.mayurbadgujar.me/series/wire-web"><em>From Wire to Web</em></a><em>" series yet? 😉🌊)</em></p>
<h3>2. Primitive Data Types</h3>
<p>A "Data Type" just tells the JavaScript engine what <em>kind</em> of data is inside your chest. Is it text? A number? A simple Yes/No?</p>
<p>Here are the absolute basics (Primitives) you'll use every day:</p>
<ul>
<li><p><strong>String</strong> (Text wrapped in quotes):</p>
<pre><code class="language-javascript">const weaponName = "Flame Sword";
console.log("Weapon: ", weaponName, "| type: ", typeof weaponName);
</code></pre>
</li>
<li><p><strong>Number</strong> (Integers or decimals):</p>
<pre><code class="language-javascript">const attackPower = 75;
const attackUpgrade = 1.5;
</code></pre>
</li>
<li><p><strong>BigInt</strong> (For massive numbers that normal Numbers just can't handle):</p>
<pre><code class="language-javascript">console.log(typeof 42n); // Notice the 'n' at the end!
</code></pre>
</li>
<li><p><strong>Boolean</strong> (<code>true</code> or <code>false</code>):</p>
<pre><code class="language-javascript">const isLoggedIn = true;
</code></pre>
</li>
<li><p><strong>Undefined</strong> (A chest you created, but forgot to put anything inside):</p>
<pre><code class="language-javascript">let bonusEffect;
console.log(typeof bonusEffect); // Output: undefined
</code></pre>
</li>
<li><p><strong>Null</strong> (An <em>intentional</em> empty chest. You explicitly told JS, "there is nothing here"):</p>
<pre><code class="language-javascript">let curseStatus = null;
let weatherApiResponse = null;
</code></pre>
</li>
<li><p><strong>Symbol</strong> (Creates a unique, hidden identifier—even if the names look identical):</p>
<pre><code class="language-javascript">const uniqueRuneId = Symbol("rune_of_fire");
const uniqueRuneId2 = Symbol("rune_of_fire");
// These two are NOT the same!
</code></pre>
</li>
</ul>
<h3>3. Non-Primitive Data Types</h3>
<p>Primitive types hold just <em>one</em> piece of value. But what if you need to store an entire character's profile, or a whole list of items? That's where we use <strong>Non-Primitives</strong> (also known as Reference Types).</p>
<h4>Objects (Key-Value pairs)</h4>
<p>Objects let us group related data together using labels (keys). Super useful.</p>
<pre><code class="language-javascript">const heroStats = {
  name: "Deepak",
  level: 12,
  class: "Ranger",
};
console.log("Hero: ", heroStats, " | type: ", typeof heroStats);
</code></pre>
<h4>Arrays (Ordered Lists)</h4>
<p>Arrays are perfect for your lists. Under the hood, they are technically just objects, but they use numbered indexes (starting at <code>0</code>) instead of named keys.</p>
<pre><code class="language-javascript">const inventory = ["Flame Sword", "Health Potion", "Shield"];
console.log("Inventory: ", inventory, " | type: ", typeof inventory);
</code></pre>
<h4>Functions (Reusable Code)</h4>
<p>Yep, in JavaScript, functions are technically a data type (an object) too!</p>
<pre><code class="language-javascript">function castSpell() {
  return "Fireball";
}
console.log("Spell Type ", typeof castSpell); // Output: "function"
</code></pre>
<h3>4. Value vs. Reference (Listen closely to this one!)</h3>
<p>Bro, if there is one thing you take away from this blog, let it be this. This is where 90% of beginners mess up. Pay close attention to how JavaScript copies data.</p>
<p><strong>Copying Primitives (Pass by Value)</strong> When you copy a primitive (like a Number), JS makes a completely independent, safe clone.</p>
<pre><code class="language-javascript">let originalHP = 100;
let cloneHP = originalHP;

cloneHP = 80; // Only the clone took damage!

console.log("Original HP: ", originalHP); // 100 (Safe and sound)
console.log("Cloned HP: ", cloneHP);      // 80
</code></pre>
<p><strong>Copying Non-Primitives (Pass by Reference)</strong> When you copy an Object or Array, JS <strong>does not copy the data</strong>. It literally just copies the <em>address</em> pointing to the original chest.</p>
<pre><code class="language-javascript">const originalSword = { name: "Flame Sword", damage: 75 };
const cloneSword = originalSword; 

cloneSword.damage = 100; // We upgrade the clone...

// WAIT, WHAT?!
console.log("Original Sword: ", originalSword.damage); // Output: 100
</code></pre>
<p>Because both variables point to the <em>exact same object in memory</em>, changing one secretly changes the other!</p>
<img src="https://cdn.hashnode.com/uploads/covers/677e148dc0398e29546d0922/1be2fff1-3bf1-4f50-9752-384e0968fe98.png" alt="" style="display:block;margin:0 auto" />

<h4>How to actually clone an Object without breaking things:</h4>
<ol>
<li><p><strong>Shallow Copy (The Spread Operator</strong> <code>...</code><strong>):</strong> Perfect for simple objects.</p>
<pre><code class="language-javascript">const armorOriginal = { name: "Iron Plate", defence: 80 };
const armorCopy = { ...armorOriginal }; 
</code></pre>
</li>
<li><p><strong>Deep Copy (</strong><code>structuredClone</code><strong>):</strong> Use this if your object has other objects hidden <em>inside</em> of it (nested).</p>
<pre><code class="language-javascript">const potionOriginal = { name: "Health", effects: { heal: 40, mana: 30 } };
const potionCopy = structuredClone(potionOriginal);
</code></pre>
</li>
</ol>
<h3>5. JavaScript's Weird Historical Quirks</h3>
<p>We can use the <code>typeof</code> operator to check what's inside a variable. But JS has a few historical bugs that are just too ingrained in the web to fix now. You just have to memorize them and laugh:</p>
<pre><code class="language-javascript">console.log(typeof "chaicode"); // "string"
console.log(typeof 42);         // "number"
console.log(typeof undefined);  // "undefined"

// 🚨 THE WEIRD ONES 🚨
console.log(typeof null);       // "object" -&gt; (Wait, what? Yep, famous JS bug!)
console.log(typeof []);         // "object" -&gt; (Arrays are technically objects)
</code></pre>
<p><em>Pro-tip: Since</em> <code>typeof []</code> <em>just tells you it's an "object", the actual right way to check if something is an array is using</em> <code>Array.isArray(inventory)</code><em>!</em></p>
<h3>What's Next?</h3>
<p>Alright, that's enough for today. You now know how to build your storage chests (Variables), what kind of loot to stash inside them (Data Types), and how to avoid that deadly "Pass by Reference" trap.</p>
<p>But right now, our code doesn't really <em>do</em> much. In the next post of our <strong>JS Exploration</strong> series, we are going to look at <strong>JavaScript Operators</strong>—how to add, subtract, and compare all this data to make actual things happen.</p>
<p>Catch you in the next one!</p>
]]></content:encoded></item><item><title><![CDATA[CSS Selectors]]></title><description><![CDATA[IntroOkay, we built the skeleton with HTML. It looks ugly. It’s just black text on a white background. Now we want to style it. We want the button to be blue, the text to be bold, and the header to be sticky. But here is the problem: How do you tell ...]]></description><link>https://blog.mayurbadgujar.me/css-selectors</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/css-selectors</guid><category><![CDATA[HTML5]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[CSS]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 15:19:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769787437408/a824fc74-5610-4f89-99fd-5872c3225c1c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Intro</strong><br />Okay, we built the skeleton with HTML. It looks ugly. It’s just black text on a white background. Now we want to style it. We want the button to be blue, the text to be bold, and the header to be sticky. But here is the problem: <strong>How do you tell the browser WHICH button to paint blue?</strong> You can't just shout "Style the button!" The browser will style <em>every</em> button. This is where <strong>CSS Selectors</strong> come in. Think of a Selector as a <strong>Sniper Rifle</strong>. It lets you aim at a specific element (or group of elements) and apply style <em>only</em> to them.</p>
<h3 id="heading-1-element-selector">1. Element Selector</h3>
<p>This is the most basic tool. You target the <strong>Tag Name</strong>.</p>
<pre><code class="lang-plaintext">p {
  color: red;
}
</code></pre>
<ul>
<li><p><strong>What it does:</strong> It finds <strong>EVERY SINGLE</strong> <code>&lt;p&gt;</code> tag on your website and paints it red.</p>
</li>
<li><p><strong>The Problem:</strong> It’s messy. You usually don't want <em>every</em> paragraph to look the same.</p>
</li>
<li><p><strong>Analogy:</strong> "Hey everyone in the room, stand up!" (Everyone stands up).</p>
</li>
</ul>
<h3 id="heading-2-class-selector">2. Class Selector (<code>.</code>)</h3>
<p>This is your best friend. You will use this 90% of the time. You give an HTML element a <code>class</code> attribute, and then target it with a dot <code>.</code>.</p>
<p><strong>HTML:</strong></p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"primary-btn"</span>&gt;</span>Click Me<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"primary-btn"</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
</code></pre>
<p><strong>CSS:</strong></p>
<pre><code class="lang-css"><span class="hljs-selector-class">.primary-btn</span> {
  <span class="hljs-attribute">background-color</span>: blue;
}
</code></pre>
<ul>
<li><p><strong>What it does:</strong> It targets only elements wearing the "primary-btn" nametag.</p>
</li>
<li><p><strong>The Superpower:</strong> You can reuse it! Multiple elements can have the same class.</p>
</li>
<li><p><strong>Analogy:</strong> "Hey, everyone wearing a <strong>Red Hat</strong>, stand up!" (Only the red hat group stands up).</p>
</li>
</ul>
<h3 id="heading-3-the-passport-id-selector">3. The Passport: ID Selector (<code>#</code>)</h3>
<p>This is the strict one. An ID must be <strong>Unique</strong>. You can only have <strong>ONE</strong> element with a specific ID on a page. You target it with a hash <code>#</code>.</p>
<p><strong>HTML:</strong></p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">nav</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"main-header"</span>&gt;</span>Logo<span class="hljs-tag">&lt;/<span class="hljs-name">nav</span>&gt;</span>
</code></pre>
<p><strong>CSS:</strong></p>
<pre><code class="lang-css"><span class="hljs-selector-id">#main-header</span> {
  <span class="hljs-attribute">height</span>: <span class="hljs-number">50px</span>;
}
</code></pre>
<ul>
<li><p><strong>What it does:</strong> It finds that <em>one specific</em> guy.</p>
</li>
<li><p><strong>The Rule:</strong> Never reuse an ID. If you have two <code>#main-header</code>s, your code is broken.</p>
</li>
<li><p><strong>Analogy:</strong> "Hey <strong>Rahul Sharma with Passport #123</strong>, stand up!" (Only one person stands up).</p>
</li>
</ul>
<h3 id="heading-4-group-selector">4. Group Selector (<code>,</code>)</h3>
<p>Sometimes you want the same style for different things. Instead of writing code twice, you group them with a comma.</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">p</span> {
  <span class="hljs-attribute">font-family</span>: Arial;
}
</code></pre>
<ul>
<li><p><strong>What it does:</strong> "I want the h1 AND the h2 AND the paragraph to use Arial."</p>
</li>
<li><p><strong>Analogy:</strong> "Everyone in the front row <strong>AND</strong> the back row, stand up!"</p>
</li>
</ul>
<h3 id="heading-5-descendant-selector-space">5. Descendant Selector (Space)</h3>
<p>This is where it gets cool. You can target something <em>inside</em> something else. You use a <strong>Space</strong>.</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>
<ul>
<li><p><strong>Read it Right to Left:</strong> "Target any <code>&lt;p&gt;</code> that is inside a <code>&lt;div&gt;</code>."</p>
</li>
<li><p><strong>Result:</strong></p>
<ul>
<li><p><code>&lt;p&gt;</code> inside a <code>div</code>? <strong>Green.</strong></p>
</li>
<li><p><code>&lt;p&gt;</code> outside a <code>div</code>? <strong>Not Green.</strong></p>
</li>
</ul>
</li>
<li><p><strong>Analogy:</strong> "Target the <strong>Chair</strong>... but only the chair inside the <strong>Kitchen</strong>."</p>
</li>
</ul>
<h3 id="heading-6-who-wins-specificity">6. Who Wins? (Specificity)</h3>
<p>What happens if you have a conflict?</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">p</span> { <span class="hljs-attribute">color</span>: red; }      <span class="hljs-comment">/* Element */</span>
<span class="hljs-selector-class">.text</span> { <span class="hljs-attribute">color</span>: blue; } <span class="hljs-comment">/* Class */</span>
<span class="hljs-selector-id">#unique</span> { <span class="hljs-attribute">color</span>: green; } <span class="hljs-comment">/* ID */</span>
</code></pre>
<p>If one element has all three... who wins?</p>
<p><strong>The Hierarchy of Power:</strong></p>
<ol>
<li><p><strong>ID (</strong><code>#</code>) - The Boss. (Strongest)</p>
</li>
<li><p><strong>Class (</strong><code>.</code>) - The Manager. (Medium)</p>
</li>
<li><p><strong>Element (</strong><code>p</code>) - The Intern. (Weakest)</p>
</li>
</ol>
<p>So, <strong>Green</strong> (#ID) wins. If you want to override a Class, use an ID. If you want to override an ID... rethink your life choices (or use <code>!important</code>, but don't do that yet).</p>
<h3 id="heading-wrap-up">Wrap Up</h3>
<p>CSS is all about pointing.</p>
<ul>
<li><p>Use <strong>Element</strong> for defaults.</p>
</li>
<li><p>Use <strong>Class</strong> for reusable components (Buttons, Cards).</p>
</li>
<li><p>Use <strong>ID</strong> for unique layouts (Header, Footer).</p>
</li>
<li><p>Use <strong>Descendants</strong> for specific contexts.</p>
</li>
</ul>
<p>That's it for today! We are slowly building. I have a lot more ideas for this series, we will dive and eventually the beast itself: <strong>JavaScript</strong>.</p>
<p>So stay tuned and follow for more. Catch you in the next one!</p>
]]></content:encoded></item><item><title><![CDATA[HTML, It’s Not Just Easy]]></title><description><![CDATA[IntroOkay, listen. We just spent weeks stressing over TCP handshakes, DNS records, and how the browser engine works. That stuff was heavy. Now we are moving to HTML. And I know what you are thinking: "Bro, HTML is easy. I learned this in 6th grade. <...]]></description><link>https://blog.mayurbadgujar.me/html-basics-tags-vs-elements</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/html-basics-tags-vs-elements</guid><category><![CDATA[HTML5]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[frontend]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 15:18:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769784641930/7455d9eb-5beb-4ac8-8ff7-5344075bba6f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Intro</strong><br />Okay, listen. We just spent weeks stressing over TCP handshakes, DNS records, and how the browser engine works. That stuff was heavy. Now we are moving to HTML. And I know what you are thinking: <em>"Bro, HTML is easy. I learned this in 6th grade.</em> <code>&lt;p&gt;</code> is paragraph, <code>&lt;b&gt;</code> is bold. Done."</p>
<p>Stop right there. If I ask you right now—<strong>"What is the exact difference between a Tag and an Element?"</strong>—and you stumble? You will fail the interview. HTML isn't just about memorizing tags. It's about structure. If your HTML is trash, your CSS will be a nightmare. Let's strip it down to the basics.</p>
<h3 id="heading-1-the-skeleton">1. The Skeleton</h3>
<p>Think of a human body.</p>
<p><strong>HTML</strong> is the <strong>Skeleton</strong>. It’s the bones. Without it, you are just a pile of goo.</p>
<p><strong>CSS</strong> is the <strong>Skin and Clothes</strong>. It makes you look human.</p>
<p><strong>JS</strong> is the <strong>Muscles/Brain</strong>. It lets you walk and think.</p>
<p>You can have a skeleton without skin (scary, but works). But you can't have skin without a skeleton. It would just collapse. HTML gives your website <strong>structure</strong>. It tells the browser: "This isn't just text. This is a <strong>Heading</strong>. This is a <strong>Button</strong>."</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769941167832/4998a908-bb5b-4aa9-9697-f9b277d953cd.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-2-tag-vs-element">2. Tag vs. Element</h3>
<p>This is where beginners get confused. Let’s look at this line:</p>
<p><code>&lt;h1&gt; Hello World &lt;/h1&gt;</code></p>
<p>People call the whole thing a "Tag." That is <strong>wrong</strong>. Let's use the <strong>Burger Analogy</strong>.</p>
<ul>
<li><p><strong>The Opening Tag (</strong><code>&lt;h1&gt;</code>): This is the <strong>Top Bun</strong>. It starts the container.</p>
</li>
<li><p><strong>The Content ("Hello World"):</strong> This is the <strong>Patty/Veggie</strong>. The actual stuff inside.</p>
</li>
<li><p><strong>The Closing Tag (</strong><code>&lt;/h1&gt;</code>): This is the <strong>Bottom Bun</strong>. It ends the container. Notice the slash <code>/</code>.</p>
</li>
</ul>
<p><strong>So, what is an Element?</strong> The <strong>Element</strong> is the <strong>Whole Burger</strong>. Element = Top Bun + Patty + Bottom Bun.</p>
<p>If someone asks "Change the <code>h1</code> tag," they mean change the <code>&lt; &gt;</code> part. If someone asks "Change the <code>h1</code> element," they mean delete the whole line.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769941900593/26af4ed7-844b-4c69-ae54-21900ef57f27.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-3-void-elements-self-closing">3. Void Elements (Self-Closing)</h3>
<p>Most elements follow the Burger rule. Open, stuff inside, Close. But some elements are loners. They don’t have content. Take the Image tag:</p>
<p><code>&lt;img src="cat.jpg" /&gt;</code></p>
<p>There is no closing <code>&lt;/img&gt;</code>. Why? Because you can't put text <em>inside</em> an image. The image <em>is</em> the content. These are called <strong>Void Elements</strong> (or Self-Closing).</p>
<ul>
<li><p><code>&lt;br&gt;</code> (Break line)</p>
</li>
<li><p><code>&lt;hr&gt;</code> (Horizontal line)</p>
</li>
<li><p><code>&lt;input&gt;</code> (The text box)</p>
</li>
</ul>
<p>They are just one slice of bread. No burger.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769942479055/bab3bf05-a241-47e3-9ea3-a5f8e9c2c01d.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-4-block-vs-inline">4. Block vs. Inline</h3>
<p>This is the #1 reason your CSS layout breaks. HTML elements have two personalities: <strong>Introverts</strong> and <strong>Extroverts</strong>.</p>
<p><strong>Type A: Block-Level Elements (The Egoistic Ones)</strong> These guys have huge egos.</p>
<ul>
<li><p>They always start on a <strong>new line</strong>.</p>
</li>
<li><p>They take up the <strong>full width</strong> of the screen (100%), even if they don't need it.</p>
</li>
<li><p>They push everyone else to the next line.</p>
</li>
<li><p><strong>Who are they?</strong> <code>&lt;h1&gt;</code>, <code>&lt;p&gt;</code>, <code>&lt;div&gt;</code>, <code>&lt;ul&gt;</code>, <code>&lt;li&gt;</code>.</p>
</li>
<li><p><em>Think of them like a brick wall. Stacked one on top of another.</em></p>
</li>
</ul>
<p><strong>Type B: Inline Elements (The Friendly Ones)</strong> These guys are chill.</p>
<ul>
<li><p>They only take up as much space as they need.</p>
</li>
<li><p>They sit happily next to other elements on the same line.</p>
</li>
<li><p><strong>Who are they?</strong> <code>&lt;span&gt;</code>, <code>&lt;a&gt;</code> (Links), <code>&lt;b&gt;</code> (Bold), <code>&lt;img&gt;</code>.</p>
</li>
<li><p><em>Think of them like words in a sentence. They flow left to right.</em></p>
</li>
</ul>
<p><strong>Why does this matter?</strong> If you try to put two <code>&lt;div&gt;</code>s next to each other, they won't do it. They will stack. Because they are Block-level. You have to force them with CSS to behave differently.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769942984516/8878c81d-7c05-468f-9514-d86bacc41804.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-wrap-up">Wrap Up</h3>
<p>So, next time you write HTML, don't just type tags blindly. Visualize the boxes.</p>
<ul>
<li><p>Is this a <strong>Block</strong> taking the full width?</p>
</li>
<li><p>Is this an <strong>Inline</strong> sitting inside the text?</p>
</li>
<li><p>Did I close my <strong>Tag</strong> properly?</p>
</li>
</ul>
<p>Now that you know the difference between a Tag and an Element, you might be thinking: <em>"Do I really have to type</em> <code>&lt;div class="container"&gt;</code> every single time? That takes forever."</p>
<p>No, you don't. Pros don't type brackets. They use <strong>Cheat Codes</strong>. What if I told you that you can type <a target="_blank" href="http://div.box"><code>div.box</code></a> and hit <code>TAB</code>, and the code writes itself?</p>
<p>In the next blog, we will learn <strong>Emmet</strong></p>
]]></content:encoded></item><item><title><![CDATA[Emmet for HTML]]></title><description><![CDATA[IntroductionLet’s be honest. Typing HTML is slow. You type < then div then > then class then = then "... it’s exhausting. If you are writing every single bracket manually, you are doing it the "hard way."

What if I told you there is a way to type di...]]></description><link>https://blog.mayurbadgujar.me/emmet-for-html</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/emmet-for-html</guid><category><![CDATA[Beginner Developers]]></category><category><![CDATA[VS Code]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 15:17:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769786195526/53268695-9ee5-4923-a53e-8eddba1ddf1b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Introduction</strong><br />Let’s be honest. Typing HTML is slow. You type <code>&lt;</code> then <code>div</code> then <code>&gt;</code> then <code>class</code> then <code>=</code> then <code>"</code>... it’s exhausting. If you are writing every single bracket manually, you are doing it the "hard way."</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769944365486/39f00eba-95d3-4159-8b13-f36f7dd2ea20.png" alt class="image--center mx-auto" /></p>
<p>What if I told you there is a way to type <code>div.container</code> and have the code write itself? Welcome to <strong>Emmet</strong>.</p>
<h3 id="heading-1-what-is-emmet"><strong>1. What is Emmet?</strong></h3>
<p>Emmet is a plugin (built into VS Code) that acts like a <strong>Translator</strong>. You speak in "Shorthand," and Emmet translates it into full "HTML."</p>
<ul>
<li><p><strong>You type:</strong> <code>h1</code> + <code>Tab</code></p>
</li>
<li><p><strong>Emmet writes:</strong> <code>&lt;h1&gt;&lt;/h1&gt;</code></p>
</li>
</ul>
<p>It’s not a new language. It’s just a faster way to write the HTML you already know.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769944826180/f8d9b026-c8ab-4a6a-a148-9f58af7f2e72.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-2-how-to-use-it"><strong>2. How to use it?</strong></h3>
<p>If you use <strong>VS Code</strong>, good news: You already have it! It comes pre-installed. Just open an HTML file, type a shortcut, and hit <strong>TAB</strong> (or Enter).</p>
<ul>
<li><em>Note: If it doesn't work, make sure your file is saved as</em> <code>.html</code>.</li>
</ul>
<h3 id="heading-3-tags-classes-and-ids">3. Tags, Classes, and IDs</h3>
<p><strong>The Simple Tag</strong> Stop typing brackets. Just type the name.</p>
<ul>
<li><p><strong>Input:</strong> <code>button</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;button&gt;&lt;/button&gt;</code></p>
</li>
</ul>
<p><strong>The Class (</strong><code>.</code>) Use a dot, just like in CSS.</p>
<ul>
<li><p><strong>Input:</strong> <code>.box</code> (Defaults to div)</p>
</li>
<li><p><strong>Output:</strong> <code>&lt;div class="box"&gt;&lt;/div&gt;</code></p>
</li>
<li><p><strong>Input:</strong> <code>p.text</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;p class="text"&gt;&lt;/p&gt;</code></p>
</li>
</ul>
<p><strong>The ID (</strong><code>#</code>) Use a hash/pound sign.</p>
<ul>
<li><p><strong>Input:</strong> <code>#header</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;div id="header"&gt;&lt;/div&gt;</code></p>
</li>
<li><p><strong>Input:</strong> <code>nav#main-nav</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;nav id="main-nav"&gt;&lt;/nav&gt;</code></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769945845157/fa9e3cdb-58ef-404e-adf8-aa06e56914be.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-4-the-power-moves-nesting-amp-multiplication">4. The Power Moves: Nesting &amp; Multiplication</h3>
<p><strong>Nesting (</strong><code>&gt;</code>) This is where Emmet shines. You can create a parent and a child at the same time using the "Greater Than" symbol.</p>
<ul>
<li><p><strong>Input:</strong> <code>div&gt;ul&gt;li</code></p>
</li>
<li><p><strong>Output:</strong></p>
</li>
</ul>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
    <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">ul</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p><strong>Multiplication (</strong><code>*</code>) Need a list with 5 items? Don't copy-paste. Multiply it.</p>
<ul>
<li><p><strong>Input:</strong> <code>li*5</code></p>
</li>
<li><p><strong>Output:</strong></p>
</li>
</ul>
<pre><code class="lang-xml"><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">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
</code></pre>
<p><strong>The Combo (Nesting + Multiplication)</strong> Let's go crazy. A list with 3 items inside a nav.</p>
<ul>
<li><strong>Input:</strong> <code>nav&gt;ul&gt;li*3</code></li>
</ul>
<h3 id="heading-5-adding-content-amp-attributes">5. Adding Content &amp; Attributes</h3>
<p><strong>Content (</strong><code>{}</code>) You can even add text inside the tag using curly braces.</p>
<ul>
<li><p><strong>Input:</strong> <code>h1{Hello World}</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;h1&gt;Hello World&lt;/h1&gt;</code></p>
</li>
</ul>
<p><strong>Attributes (</strong><code>[]</code>) Need a specific link or type? Use square brackets.</p>
<ul>
<li><p><strong>Input:</strong> <code>a[href="</code><a target="_blank" href="http://google.com"><code>google.com</code></a><code>"]</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;a href="</code><a target="_blank" href="http://google.com"><code>google.com</code></a><code>"&gt;&lt;/a&gt;</code></p>
</li>
<li><p><strong>Input:</strong> <code>input[type="password"]</code></p>
</li>
<li><p><strong>Output:</strong> <code>&lt;input type="password" name="" id=""&gt;</code></p>
</li>
</ul>
<h3 id="heading-6-boilerplate">6. Boilerplate (<code>!</code>)</h3>
<p>This is the first thing every developer does when starting a project. Instead of typing <code>&lt;html&gt;</code>, <code>&lt;head&gt;</code>, <code>&lt;body&gt;</code> manually... Just type:</p>
<ul>
<li><p><strong>Input:</strong> <code>!</code></p>
</li>
<li><p><strong>Action:</strong> Hit Tab.</p>
</li>
</ul>
<p><strong>Output:</strong></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>
<p>Boom. Your entire project structure is ready in 1 second.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769946119394/872ac2a0-f37c-4910-907b-fcdef6e76d7b.png" alt class="image--center mx-auto" /></p>
<p><strong>Conclusion</strong> Emmet is optional, but so is running, you could just walk everywhere, but it would take forever. Start using these shortcuts today:</p>
<ol>
<li><p><code>!</code> for setup.</p>
</li>
<li><p><code>.</code> for classes.</p>
</li>
<li><p><code>*</code> for lists.</p>
</li>
</ol>
<p>Your fingers will thank you</p>
<p>Now you can generate thousands of lines of HTML in seconds. That’s great. But your website still looks like a Word document from 1995. Black text, white background. Boring.</p>
<p>We need to add <strong>CSS</strong> to make it beautiful. But here is the problem: <strong>How do you tell the browser to style <em>only</em> the button and not the heading?</strong></p>
<p>In the next blog, we will learn about <strong>CSS Selectors</strong></p>
]]></content:encoded></item><item><title><![CDATA[How a Browser Works]]></title><description><![CDATA[IntroductionWelcome back to the series! If you’ve been following along, we just spent weeks talking about cables, DNS, and TCP. We basically acted like delivery drivers, just trying to get the package (the website data) from the ocean to your laptop....]]></description><link>https://blog.mayurbadgujar.me/how-a-browser-works</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/how-a-browser-works</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Browsers]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[css3 animation]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 15:02:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769784286644/46942260-7c6d-46d7-8ca3-2afcc4b10fd1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Introduction</strong><br />Welcome back to the series! If you’ve been following along, we just spent weeks talking about cables, DNS, and TCP. We basically acted like delivery drivers, just trying to get the package (the website data) from the ocean to your laptop. But now, the package has finally arrived. The delivery is done. Now the real magic starts.</p>
<p>I used to think the browser was just one single app that "opens websites." You click Chrome, type a URL, and boom, Facebook appears. But after digging into the internals, I realized it’s actually a collection of huge components working together like a factory. It’s not just one thing; it’s a team.</p>
<p><strong>What is a Browser, Actually?</strong> So, let's break down this "team." When you look at the diagram (the black one with the boxes), you see the <strong>User Interface</strong> at the top. That’s the part you click on, the address bar, the back button, the bookmarks. That’s just the dashboard. But the real boss is the <strong>Browser Engine</strong>. This guy sits in the middle and manages everything. He takes orders from you (the UI) and tells the <strong>Rendering Engine</strong> what to do.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769934697422/1a0d969b-1d9b-45c4-8a50-c384dfc5e2e1.png" alt class="image--center mx-auto" /></p>
<p>The Rendering Engine is the star of the show today. In Chrome, it's called "Blink" (part of Chromium), and in Firefox, it's "Gecko." Its only job is to take your code, the HTML and CSS and paint it onto the screen. It also talks to other small workers like <strong>Networking</strong> (who fetches the images) and the <strong>JS Interpreter</strong> (who runs the JavaScript logic). But mostly, it’s about drawing pixels.</p>
<p><strong>Step 1: HTML to DOM</strong> So, how does it actually draw? Imagine the browser receives your HTML file. To the computer, it’s just a long string of text and numbers. It means nothing. The browser has to "parse" it, which is just a fancy word for translating. It reads the file character by character. It sees a <code>&lt;</code> tag, then <code>div</code>, then <code>&gt;</code>, and realizes, "Oh, this is a box."</p>
<p>It takes all these tags and builds a tree structure called the <strong>DOM (Document Object Model)</strong>. I like to think of the HTML as the script for a movie, and the DOM is the director organizing the actors. The browser creates a "Node" for every element, a node for the <code>&lt;body&gt;</code>, a node for the <code>&lt;div&gt;</code>, a node for the text inside. By the end, it has a full family tree of your content.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769936160653/a7136fcc-be62-4a93-b06a-23d867f23693.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 2: CSS to CSSOM</strong> But a movie script is boring without costumes. While the browser is building the DOM, it finds a link to your CSS file. It screams, "Hey Networking, go get this file!" Once the CSS arrives, the browser reads it just like the HTML.</p>
<p>It builds another tree called the <strong>CSSOM (CSS Object Model)</strong>. This tree is all about style. If the DOM says "There is a Headline here," the CSSOM says "The Headline is Red and 50px big." It attaches these rules to the nodes. It’s like the costume department measuring the actors and deciding what they will wear.</p>
<p><strong>Step 3: Render Tree</strong> Now comes the marriage. The browser combines the DOM (content) and the CSSOM (style) into something called the <strong>Render Tree</strong>. This is important because the Render Tree <em>only</em> contains things that will actually appear on the screen.</p>
<p>For example, if you have a <code>div</code> that says <code>display: none</code>, the DOM has it, but the Render Tree ignores it. It’s invisible. The Render Tree is the final list of "Actors who are going on stage right now."</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769937479734/16f6aca1-bb50-4c3c-b242-66143126c767.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 4: Layout</strong> Now the actors are in costume and ready, but where do they stand? This step is called <strong>Layout</strong> (or Reflow). The browser looks at your screen size (the viewport). It does the math. It calculates exactly where every box goes.</p>
<p>It says, "Okay, this Header is 100% width, so it goes all the way across. This button is 20px from the left." It draws a geometry map of the page. It’s like the set designer using a measuring tape to mark exactly where the furniture goes on the stage so nobody bumps into each other.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769937988757/e6071297-3b95-4489-a1d1-6ee0060f957c.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 5: Paint</strong> Finally, we have the <strong>Paint</strong> stage. This is where the pixels actually light up on your screen. The browser takes that geometry map and fills it in. It draws the text, colors the background, adds the shadows, and renders the images.</p>
<p>This happens incredibly fast. And the crazy part? If you change something, like if you resize the window or hover over a button, the browser might have to run through this whole process again. It has to re-calculate the Layout and Re-Paint the pixels. That’s why complex animations can sometimes make your laptop fan spin!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769939119736/1107b2e4-879a-4fe9-a50d-8ab760409ce0.png" alt class="image--center mx-auto" /></p>
<p><strong>Conclusion</strong> So that’s it. That’s the journey. It starts as a text file, turns into a DOM tree, gets dressed up by CSSOM, gets measured in the Layout, and finally gets Painted as pixels. It’s a messy, complex factory running inside your computer, and it does all of this in milliseconds just so you can see a meme. Pretty cool, right?</p>
<p>Now that we know <em>how</em> the browser processes code, we need to learn how to <em>write</em> it. We know the browser builds a <strong>DOM Tree</strong>... but what are the branches made of? They are made of <strong>HTML Tags</strong>.</p>
<p>In the next blog, we start a new series! We will stop talking about theory and start coding.</p>
]]></content:encoded></item><item><title><![CDATA[Getting Started with cURL]]></title><description><![CDATA[IntroductionWelcome to the final part of our "From Wire to Web" series!

Part 1: We learned how data travels from the ocean to your router.

Part 2 & 3: We learned how dig finds the IP address of the server.


Now, we are standing at the door of the ...]]></description><link>https://blog.mayurbadgujar.me/getting-started-with-curl</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/getting-started-with-curl</guid><category><![CDATA[curl]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[APIs]]></category><category><![CDATA[http]]></category><category><![CDATA[backend]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 11:25:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769783136492/e1f1da4c-9aa4-467c-a6f1-7a040b8b34a2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Introduction</strong><br />Welcome to the final part of our "From Wire to Web" series!</p>
<ul>
<li><p><strong>Part 1:</strong> We learned how data travels from the ocean to your router.</p>
</li>
<li><p><strong>Part 2 &amp; 3:</strong> We learned how <code>dig</code> finds the IP address of the server.</p>
</li>
</ul>
<p>Now, we are standing at the door of the server. We have the address. But how do we talk to it? Most of us use a <strong>Browser</strong> (Chrome/Brave). But as developers, sometimes we don't need the buttons and images. Sometimes, we just want to send a raw message to the server. That is where <strong>cURL</strong> comes in.</p>
<p><strong>What is cURL?</strong> cURL (Client URL) is a command-line tool that lets you transfer data to or from a server.</p>
<ul>
<li><p><strong>The Browser:</strong> It’s like a restaurant with a waiter, a menu with pictures, and nice music. You point at a picture to order.</p>
</li>
<li><p><strong>cURL:</strong> It’s like a walkie-talkie connected directly to the kitchen. You press a button and say, "Give me a burger." No waiter, no pictures, just raw communication.</p>
</li>
</ul>
<p><strong>Why do programmers need it?</strong></p>
<ol>
<li><p><strong>Debugging:</strong> If your API isn't working, the browser might hide the real error message behind a "404 Page." cURL shows you the exact raw response.</p>
</li>
<li><p><strong>Automation:</strong> You can't write a script to "click a button" in Chrome easily. But you can write a script to run a cURL command 1,000 times in a second.</p>
</li>
<li><p><strong>No UI Needed:</strong> When you are working on a remote server (backend), there is no screen. cURL is your only way to talk to the internet.</p>
</li>
</ol>
<p><strong>Making Your First Request</strong> Let’s try the simplest command. We will fetch the Google homepage. Open your terminal and type:</p>
<pre><code class="lang-plaintext">curl google.com
</code></pre>
<p><strong>What happened?</strong> You probably saw a huge mess of code on your screen. That is <strong>HTML</strong>. When you visit <a target="_blank" href="http://google.com"><code>google.com</code></a> in Chrome, the browser takes this code and paints it into a nice search bar. cURL doesn't paint. It just dumps the raw data. <em>(Proof that the browser is just a fancy cURL wrapper!)</em></p>
<p><strong>Understanding the Conversation (Request &amp; Response)</strong> Computers are polite. They follow a conversation structure:</p>
<ol>
<li><p><strong>Request (You):</strong> "Hey, give me this page."</p>
</li>
<li><p><strong>Response (Server):</strong> "Okay, here is the data."</p>
</li>
</ol>
<p>To see this "Handshake," use the <code>-v</code> (verbose) flag.</p>
<pre><code class="lang-plaintext">curl -v google.com
</code></pre>
<p>Look at the output. Lines starting with <code>&gt;</code> are your <strong>Request</strong>. Lines starting with <code>&lt;</code> are the Server's <strong>Response</strong>. You will see something like <code>HTTP/1.1 200 OK</code>.</p>
<ul>
<li><p><strong>200:</strong> This is the <strong>Status Code</strong>. It means "Success!"</p>
</li>
<li><p><strong>301:</strong> "Moved Permanently" (Go look somewhere else).</p>
</li>
<li><p><strong>404:</strong> "Not Found" (I don't have that).</p>
</li>
<li><p><strong>500:</strong> "Server Error" (I crashed).</p>
</li>
</ul>
<p><strong>Talking to APIs (GET vs POST)</strong> cURL is mostly used to talk to APIs (Application Programming Interfaces). There are two main ways to talk:</p>
<p><strong>1. GET (Asking for data)</strong> This is the default. You are just retrieving information.</p>
<pre><code class="lang-plaintext">curl https://jsonplaceholder.typicode.com/posts/1
</code></pre>
<ul>
<li>You get a nice JSON response (data), not HTML.</li>
</ul>
<p><strong>2. POST (Sending data)</strong> This is when you want to create something, like posting a Tweet or submitting a form. You need to send data <strong>to</strong> the server.</p>
<pre><code class="lang-plaintext">curl -X POST https://jsonplaceholder.typicode.com/posts \
     -d "title=My First Post&amp;body=Hello World"
</code></pre>
<ul>
<li><p><code>-X POST</code>: Tells cURL "I am sending data, not just asking."</p>
</li>
<li><p><code>-d</code>: Stands for "Data". This is the message you are sending.</p>
</li>
</ul>
<p><strong>Common Mistakes Beginners Make</strong></p>
<ol>
<li><p><strong>Forgetting</strong> <code>https://</code>: If you just type <code>curl</code> <a target="_blank" href="http://google.com"><code>google.com</code></a>, some servers might ignore you. Always use the full URL.</p>
</li>
<li><p><strong>Not using Quotes:</strong> When sending data (<code>-d</code>), always use quotes <code>"like this"</code>. If you don't, the terminal gets confused by spaces.</p>
</li>
<li><p><strong>Fear of the Terminal:</strong> The output looks scary (lots of text). Don't panic. Scroll up and look for the specific <code>HTTP</code> code (200, 404, etc).</p>
</li>
</ol>
<p><strong>Conclusion</strong> Congratulations! You have completed the "From Wire to Web" journey.</p>
<ol>
<li><p>We traced the <strong>Undersea Cables</strong>.</p>
</li>
<li><p>We looked up the <strong>DNS Records</strong>.</p>
</li>
<li><p>We used <code>dig</code> to find the <strong>IP</strong>.</p>
</li>
<li><p>And now, we used <code>curl</code> to <strong>talk</strong> to the server.</p>
</li>
</ol>
<p>You now understand the "Invisible Internet" better than 90% of people. Go build something awesome!<br />In the next series, we are opening the <strong>Browser's Black Box</strong>. We will look at how the <strong>Rendering Engine( stop saying display, rendering is for devs )</strong> paints pixels on your screen.</p>
]]></content:encoded></item><item><title><![CDATA[TCP Internals; Handshake, Delivery, and Goodbye]]></title><description><![CDATA[Introduction
In the last blog, we learned that TCP is the "Safe Mode" of the internet (like driving a Thar carefully). But how does it actually guarantee safety?
If I send a meme to my friend, how does TCP make sure the top half doesn't arrive after ...]]></description><link>https://blog.mayurbadgujar.me/tcp-internals-handshake-delivery-and-goodbye</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/tcp-internals-handshake-delivery-and-goodbye</guid><category><![CDATA[networking]]></category><category><![CDATA[TCP]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 11:02:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769782303031/59ab93b2-5361-4231-88d7-21c84fd6fcab.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>In the last blog, we learned that <strong>TCP</strong> is the "Safe Mode" of the internet (like driving a Thar carefully). But <em>how</em> does it actually guarantee safety?</p>
<p>If I send a meme to my friend, how does TCP make sure the top half doesn't arrive <em>after</em> the bottom half?</p>
<p>The answer lies in <strong>The Handshake</strong> and <strong>The Sequence</strong>.</p>
<h3 id="heading-1-the-3-way-handshake">1. The 3-Way Handshake</h3>
<p>TCP is extremely polite. It never sends data without asking first. It uses a 3-step process called the <strong>3-Way Handshake</strong>.</p>
<p>Imagine calling your friend:</p>
<p><strong>Step 1: SYN (The Dial)</strong></p>
<ul>
<li><p><strong>You (Client):</strong> "Hello? Can you hear me?"</p>
</li>
<li><p><strong>Technical:</strong> You send a packet with the <strong>SYN</strong> flag (Synchronize, it’s just jargon) and a random number (e.g., 100). This is your ID.</p>
</li>
</ul>
<p><strong>Step 2: SYN-ACK (The Answer)</strong></p>
<ul>
<li><p><strong>Friend (Server):</strong> "Yes, I hear you (ACK 101). Can you hear me? (SYN 5000)"</p>
</li>
<li><p><strong>Technical:</strong> The server <strong>ACKs</strong> your number (100 + 1) and sends its <em>own</em> <strong>SYN</strong> number (5000). Now both have IDs.</p>
</li>
</ul>
<p><strong>Step 3: ACK (The Confirmation)</strong></p>
<ul>
<li><p><strong>You (Client):</strong> "Yes, I hear you perfectly (ACK 5001). Let's talk."</p>
</li>
<li><p><strong>Technical:</strong> You <strong>ACK</strong> the server's number (5000 + 1). The connection is <strong>ESTABLISHED</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769855837870/12838390-6769-42e1-abc7-451910866063.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-2-data-transfer">2. Data Transfer</h3>
<p>Now the connection is open. We need to send the data.</p>
<p>But the internet is chaotic. Packets can arrive late, out of order, or duplicate.</p>
<p>TCP solves this using <strong>Sequence Numbers</strong>.</p>
<p>Think of it like moving houses. You don't just throw boxes into a truck. You <strong>label</strong> them: "Box 1 of 10", "Box 2 of 10".</p>
<ul>
<li><p><strong>The Sender:</strong> Sends "Packet #1 (Bytes 0-100)".</p>
</li>
<li><p><strong>The Receiver:</strong> Gets it and sends back "ACK 101".</p>
<ul>
<li><em>Translation:</em> "I got everything up to 100. Send me byte 101 next."</li>
</ul>
</li>
<li><p><strong>The Sender:</strong> Sends "Packet #2 (Bytes 101-200)".</p>
</li>
</ul>
<p><strong>Ordering:</strong> If "Packet #3" arrives <em>before</em> "Packet #2", TCP holds it in a waiting room (Buffer). It waits for #2 to arrive, puts them in the right order (1 → 2 → 3), and <em>then</em> gives it to the application.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769856357616/44cb1b93-7f4c-4867-affa-35aae0391466.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-3-handling-loss">3. Handling Loss</h3>
<p>What if a packet disappears?</p>
<ul>
<li><p><strong>Sender:</strong> "I sent Packet #2... waiting for confirmation..."</p>
</li>
<li><p><strong>Receiver:</strong> (Silence)</p>
</li>
<li><p><strong>Sender:</strong> "Okay, it's been 200ms. No ACK. It must be lost."</p>
</li>
<li><p><strong>Action:</strong> The sender <strong>Retransmits</strong> Packet #2.</p>
</li>
</ul>
<p>This is why TCP is "Reliable". It doesn't give up until the other side confirms receipt.</p>
<h3 id="heading-4-closing-the-connection">4. Closing the Connection</h3>
<p>UDP just stops talking. But TCP is polite—it says goodbye properly.</p>
<p>This is a <strong>4-Way Termination</strong>.</p>
<ol>
<li><p><strong>You:</strong> "I'm done talking." (<strong>FIN</strong>)</p>
</li>
<li><p><strong>Server:</strong> "Okay, I heard you." (<strong>ACK</strong>)</p>
<ul>
<li><em>(The Server might still have some final data to send to you. You wait.)</em></li>
</ul>
</li>
<li><p><strong>Server:</strong> "Okay, I'm done too. Bye." (<strong>FIN</strong>)</p>
</li>
<li><p><strong>You:</strong> "Bye." (<strong>ACK</strong>)</p>
</li>
</ol>
<p>The connection is now closed.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769857118297/a143a735-f5d4-4778-bf18-c3601ad908fe.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conclusion-the-unsung-hero">Conclusion: The Unsung Hero</h3>
<p>TCP is heavy. It has handshakes, acknowledgments, timers, and sequence numbers.</p>
<p>But this "heaviness" is exactly why you can load a webpage without missing words, or download a zip file without it being corrupted.</p>
<p>It works hard in the background so you don't have to.</p>
<p>We have built the road (Cables), found the address (DNS), and established a secure connection (TCP). The journey is complete. Now, we are standing at the server's front door. It's time to actually <strong>ask</strong> for the website.</p>
<p>In the final part of this series, we will stop using the browser and learn how to talk to the server manually using the command line tool <strong>cURL</strong>.</p>
]]></content:encoded></item><item><title><![CDATA[TCP vs UDP, Driving Your Data in a Thar]]></title><description><![CDATA[Introduction
Welcome back to the "From Wire to Web" series!

Part 1: We built the road (Undersea Cables).

Part 2 & 3: We found the address using the GPS (DNS).


Now, we need to actually drive to the destination to deliver the message. We are drivin...]]></description><link>https://blog.mayurbadgujar.me/tcp-vs-udp-driving-your-data-in-a-thar</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/tcp-vs-udp-driving-your-data-in-a-thar</guid><category><![CDATA[networking]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[tcp/ip-model]]></category><category><![CDATA[TCP/IP]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 10:10:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769781384512/970888f1-6ac0-4672-876b-42abf869973b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Welcome back to the "From Wire to Web" series!</p>
<ul>
<li><p><strong>Part 1:</strong> We built the road (Undersea Cables).</p>
</li>
<li><p><strong>Part 2 &amp; 3:</strong> We found the address using the GPS (DNS).</p>
</li>
</ul>
<p>Now, we need to actually drive to the destination to deliver the message. We are driving the heavy-duty SUV of the internet: <strong>The Thar</strong>.</p>
<p>But here is the catch: This car has two driving modes.</p>
<ol>
<li><p><strong>TCP Mode</strong> (Safe &amp; Reliable &amp; Normal mode)</p>
</li>
<li><p><strong>UDP Mode</strong> (Fast &amp; Furious &amp; 4X4 mode)</p>
</li>
</ol>
<p>Which one should you use? Let's find out.</p>
<h3 id="heading-1-tcp-city-drive">1. TCP: "City Drive"</h3>
<p><strong>TCP (Transmission Control Protocol)</strong> is like taking my family on a trip in my Thar. Safety is the #1 priority.</p>
<p><strong>How it works (The 3-Way Handshake):</strong></p>
<p>Before you even start the engine, you call your friend at the destination.</p>
<ul>
<li><p><strong>You (SYN):</strong> "Hello! I am coming over. Are you home?"</p>
</li>
<li><p><strong>Server (SYN-ACK):</strong> "Yes, I am home! Come over."</p>
</li>
<li><p><strong>You (ACK):</strong> "Okay, starting the car now."</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769852475749/344cd977-3456-4b02-8783-582391f19ed8.png" alt class="image--center mx-auto" /></p>
<p><strong>The Journey:</strong></p>
<p>You drive carefully. The data packets are your family members.</p>
<ul>
<li><p><strong>Numbering:</strong> Everyone has a specific seat number.</p>
</li>
<li><p><strong>Reliability:</strong> If "Chintu" (Packet #5) falls out of the car, <strong>the whole car stops.</strong> You go back, pick him up (Retransmission), and then continue.</p>
</li>
<li><p><strong>Conclusion:</strong> The data <em>always</em> arrives perfectly, exactly in order.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769852978994/dc0dd773-62ac-4d7c-89f6-6ea003c55eda.png" alt class="image--center mx-auto" /></p>
<p><strong>When to use TCP?</strong></p>
<ul>
<li><p><strong>Websites (HTTP/HTTPS):</strong> You don't want a webpage to load with missing text.</p>
</li>
<li><p><strong>Emails:</strong> You don't want half a letter.</p>
</li>
<li><p><strong>File Downloads:</strong> You don't want a corrupted game file.</p>
</li>
</ul>
<p>In chat infrastructure, TCP is always used to make sure to delivery each message in order.</p>
<h3 id="heading-2-udp-off-road">2. UDP: "Off-Road"</h3>
<p><strong>UDP (User Datagram Protocol)</strong> is like entering your Thar in a desert rally. Speed is the only thing that matters.</p>
<p><strong>How it works (No Handshake):</strong></p>
<p>You don't call. You don't check if the friend is home. You just drive towards home.</p>
<p><strong>The Journey:</strong></p>
<p>You are flying over speed bumps at 120 km/h.</p>
<ul>
<li><p><strong>No Order:</strong> The packets arrive whenever they arrive.</p>
</li>
<li><p><strong>Unreliable:</strong> If a suitcase falls off the roof rack? <strong>Forget it.</strong> We don't stop. The show must go on.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769853376304/21e07352-9be4-48d4-a9df-a26ba7ad9950.png" alt class="image--center mx-auto" /></p>
<p><strong>When to use UDP?</strong></p>
<ul>
<li><p><strong>Video Calls (Zoom/Meet):</strong> Have you ever seen a video call glitch for a second? That was a lost packet. The app didn't pause to find it; it just skipped to the next frame.</p>
</li>
<li><p><strong>Online Gaming (BGMI/Valorant):</strong> If a bullet is fired, you need to know now. You don't care about the bullet fired 3 seconds ago.</p>
</li>
</ul>
<h3 id="heading-3-comparison-table">3. Comparison Table</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Feature</strong></td><td><strong>TCP (City Mode)</strong></td><td><strong>UDP (4X4 Mode)</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>Priority</strong></td><td>Reliability</td><td>Speed</td></tr>
<tr>
<td><strong>Connection</strong></td><td>Handshake (Call first)</td><td>No Handshake (Just go)</td></tr>
<tr>
<td><strong>If Packet Lost</strong></td><td>Resend it</td><td>Forget it</td></tr>
<tr>
<td><strong>Best For</strong></td><td>Websites, Emails, Files..</td><td>Gaming, Streaming..</td></tr>
</tbody>
</table>
</div><h3 id="heading-4-where-does-http-fit-the-passenger">4. Where does HTTP fit? (The Passenger)</h3>
<p>A common confusion for beginners is: <em>"Is HTTP better than TCP?"</em></p>
<p>That’s like asking: <em>"Is the family member better than the Car?"</em></p>
<ul>
<li><p><strong>TCP</strong> is the <strong>Thar</strong> (The vehicle transporting the goods).</p>
</li>
<li><p><strong>HTTP</strong> is the <strong>Family member</strong> inside (The actual message/content).</p>
</li>
</ul>
<p>HTTP relies on TCP to get it there safely. HTTP says, <em>"I have this HTML file. Please drive it to the user's laptop safely."</em> TCP says, <em>"Don't worry, I will wear my seatbelt."</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769853899447/017d0c84-2066-4a76-b051-3e0a6d848f1c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>So, next time you are building an app, ask yourself:</p>
<ul>
<li><p>Do I need <strong>Safety</strong> (TCP)? (Like sending a bank transfer).</p>
</li>
<li><p>Do I need <strong>Speed</strong> (UDP)? (Like live streaming a cricket match).</p>
</li>
</ul>
<p>Both modes are useful. You just need to know when to switch gears.</p>
<p>We decided that for web browsing, we almost always use the safe <strong>TCP Mode</strong>. But how exactly does the driver ensure safety? How does it number the seats? And how does it politely say goodbye when the trip is over?</p>
<p>In the next blog, we will go behind the scenes and look at the system of the <strong>3-Way Handshake</strong> and <strong>Reliability</strong>.</p>
]]></content:encoded></item><item><title><![CDATA[How DNS Resolution Works]]></title><description><![CDATA[Welcome back! In the last blog, we learned about the "Phonebook" (DNS Records).
When you type a URL, your browser doesn't magically know the IP. It has to ask someone. And if that person doesn't know, they ask someone else. This chain of asking is ca...]]></description><link>https://blog.mayurbadgujar.me/how-dns-resolution-works</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/how-dns-resolution-works</guid><category><![CDATA[dns]]></category><category><![CDATA[networking]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 31 Jan 2026 09:17:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780787767/bea76e93-a409-438b-a31d-651633079a8e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome back! In the last blog, we learned about the "Phonebook" (DNS Records).</p>
<p>When you type a URL, your browser doesn't magically know the IP. It has to ask someone. And if that person doesn't know, they ask someone else. This chain of asking is called <strong>DNS Resolution</strong>.</p>
<p>Today, we are going to be "Detectives". We will use a special command called <code>dig</code> to manually track down an IP address, step by step.</p>
<h3 id="heading-what-is-dns-resolution">What is DNS Resolution?</h3>
<p>Think of it like this: You want to find <strong>"Mayur's House"</strong> (<a target="_blank" href="http://google.com"><code>google.com</code></a>), but you don't know the address.</p>
<ol>
<li><p>You first ask the <strong>Global Chief</strong> (Root). He says, "I don't know, but I know the manager of <code>.com</code>."</p>
</li>
<li><p>Then you ask the <strong>.com Manager</strong> (TLD). He says, "I don't know, but I know who manages <code>google</code>."</p>
</li>
<li><p>Again you ask the <strong>Google Manager</strong> (Authoritative). He says, "Yes! Here is the address."</p>
</li>
</ol>
<p>This chain is how the internet works.</p>
<h3 id="heading-dig"><code>dig</code></h3>
<p>To see this happening live, developers use a command called <code>dig</code> (Domain Information Groper). It is a Linux command that lets us talk directly to DNS servers. <em>(Note for Windows users: This tool isn't installed by default, so we usually run this in a Linux terminal or Cloud Shell).</em></p>
<p>Let’s start our investigation.</p>
<h3 id="heading-root-name-servers">Root Name Servers</h3>
<p>The journey starts at the very top. The <strong>Root Servers</strong>. These are the most important servers on the internet. There are 13 logical root servers in the world.</p>
<p><strong>Command:</strong></p>
<pre><code class="lang-powershell">dig . NS
</code></pre>
<ul>
<li><p><code>.</code> means "Root" (The starting point).</p>
</li>
<li><p><code>NS</code> means "Tell me the Name Servers" (Who is the boss?).</p>
</li>
</ul>
<p><strong>Terminal Output:</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769849582382/7a2ae63d-be27-490a-a969-21219d146481.png" alt class="image--center mx-auto" /></p>
<p><strong>What happened?</strong><br />We asked "Who runs the internet?". The response gave us a list from <a target="_blank" href="http://a.root-servers.net"><code>a.root-servers.net</code></a> to <a target="_blank" href="http://m.root-servers.net"><code>m.root-servers.net</code></a>. These are the <strong>Watchman</strong>. They don't know where <a target="_blank" href="http://google.com"><code>google.com</code></a> is, but they know who runs <code>.com</code>.</p>
<h3 id="heading-tld-name-servers">TLD Name Servers</h3>
<p>Now that we know the Root, we need to find who manages the <code>.com</code> ending. These are called <strong>Top-Level Domain (TLD) Servers</strong>.</p>
<p><strong>Command:</strong></p>
<pre><code class="lang-plaintext">dig com NS
</code></pre>
<p><strong>Terminal Output:</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769849661380/5cdb9277-869e-4791-aa87-8cacdf474e99.png" alt class="image--center mx-auto" /></p>
<p><strong>What happened?</strong><br />The Root server pointed us to the <strong>gTLD servers</strong> (Global Top-Level Domain). These servers manage <em>every single</em> website that ends in <code>.com</code>.</p>
<h3 id="heading-authoritative-name-servers">Authoritative Name Servers</h3>
<p>We are getting closer. The TLD server knows about <code>.com</code>, so now we ask it: "Who specifically handles <a target="_blank" href="http://google.com"><code>google.com</code></a>?" This takes us to the <strong>Authoritative Name Server</strong>. This is the specific server that the owner (Google) configured to handle their traffic.</p>
<p><strong>Command:</strong></p>
<pre><code class="lang-plaintext">dig google.com NS
</code></pre>
<p><strong>Terminal Output:</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769849806575/b75f2449-dacb-40fc-abe9-2c1596e76ee3.png" alt class="image--center mx-auto" /></p>
<p><strong>What happened?</strong><br />The TLD manager said, "Go ask <a target="_blank" href="http://ns1.google.com"><code>ns1.google.com</code></a>. They have the final list."</p>
<h3 id="heading-final-answer-full-resolution">Final Answer (Full Resolution)</h3>
<p>Now we are at the final destination. We ask the Authoritative Server: "Give me the IP address for <a target="_blank" href="http://google.com"><code>google.com</code></a>."</p>
<p><strong>Command:</strong></p>
<pre><code class="lang-plaintext">dig google.com
</code></pre>
<p><em>(Note: By default, dig asks for the 'A Record')</em></p>
<p><strong>Terminal Output:</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769849910039/0bd3a9b2-f049-40ef-b336-1f75bd282d63.png" alt class="image--center mx-auto" /></p>
<p><strong>Result:</strong> We found it! The IP addresses like <code>74.125.68.100</code>…</p>
<h3 id="heading-recursive-vs-iterative">Recursive vs. Iterative:</h3>
<p>You might be thinking, <em>"Wait, my browser does all 4 steps every time I click a link?"</em> No. That would be too slow.</p>
<p>There are two ways to resolve a name:</p>
<ol>
<li><p><strong>Iterative (What we just did):</strong> You run around asking Root -&gt; TLD -&gt; Auth yourself.</p>
</li>
<li><p><strong>Recursive (The Real World):</strong> Your laptop asks <strong>one</strong> server (usually your ISP or Google <code>8.8.8.8</code>) and says, <em>"Bro, go find this for me."</em></p>
</li>
</ol>
<p>Your browser is the "Lazy Friend" (Recursive). It asks the ISP. The ISP does the hard work (Iterative) of running around the internet to find the answer, and then just gives the final IP to your browser.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>So, DNS Resolution is basically a chain of referrals.</p>
<ul>
<li><p><strong>Root (.)</strong> says: "Ask .com"</p>
</li>
<li><p><strong>TLD (.com)</strong> says: "Ask Google"</p>
</li>
<li><p><strong>Authoritative (</strong><a target="_blank" href="http://google.com"><strong>google.com</strong></a><strong>)</strong> says: "Here is the IP: 142.250..."</p>
</li>
</ul>
<p>It’s a beautiful system that keeps the internet organized. Next time your internet is slow, just remember the poor ISP server running around asking all these managers for directions!</p>
<p>Now that we have the IP address, we need to travel there to deliver our data. But how do we drive? Do we take the safe, slow family car? Or the fast, off-road rally jeep?</p>
<p>In the next blog, we will learn about <strong>TCP vs UDP</strong> using a <strong>Mahindra Thar</strong> analogy.</p>
]]></content:encoded></item><item><title><![CDATA[DNS Records Explained]]></title><description><![CDATA[Every tech kid had this question, “How does a browser know where a website lives?“. Somehow the kid knows that “How wires from sea brings internet to home/area?“.But now it’s high time to know, How the domain name returns a IP addresses of any webpag...]]></description><link>https://blog.mayurbadgujar.me/dns-records-explained</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/dns-records-explained</guid><category><![CDATA[dns]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[networking]]></category><category><![CDATA[CS fundamentals]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Fri, 30 Jan 2026 17:46:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780148838/4080168d-e1a1-43e8-9bfc-b2214ff092c1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every tech kid had this question, “How does a browser know where a website lives?“. Somehow the kid knows that “<a target="_blank" href="https://blog.mayurbadgujar.me/from-ocean-to-browser-network-devices-explained">How wires from sea brings internet to home/area</a>?“.<br />But now it’s high time to know, How the domain name returns a IP addresses of any webpage / website.</p>
<p><strong>Problem:</strong> Computer’s don’t speak English “names like <code>google.com</code>“. Speaks Math, only numbers what they understand. In internet each device or online webpage have IP addresses like <code>142.250.1.1</code>, So that they can uniquely identify each distinct resources ( devices, webpages, etc. ).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769791325225/c22fafd7-c3d5-4375-bd91-210ebd04c700.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-dns-domain-name-system">DNS (Domain Name System)</h3>
<p>A DNS record is an information stored on a DNS server that tells the internet how to handle a domain. It’s like phonebook of internet, maintains the domain name of along with the IP addresses. Phonebook of internet is called <strong>Authoritative DNS Servers.</strong><br />This stores instructions like:</p>
<ul>
<li><p>If the domain is <code>google.com</code> then point to <code>142.250.1.1</code> IP address.</p>
</li>
<li><p>How to handle request for that domain, via all the DNS records.</p>
</li>
</ul>
<p>DNS is what maintains and helps in navigate the IP addresses. Using DNS records we can set instruction that, which domain to point on which IP.</p>
<h2 id="heading-lets-explore-dns-record-types"><strong>Let’s explore DNS record types !</strong></h2>
<h3 id="heading-a-amp-aaaa-records">A &amp; AAAA Records</h3>
<p>The ‘<strong>A</strong>’ stands for ‘address‘, not for any house. A record indicates the IP address of a given domain name.<br />For example: If you search <code>google.com</code>, the A record of <code>google.com</code> will point to <code>142.250.1.1</code> IP address.<br />A records only holds IPv4 addresses. If a website has an IPv6 address, it will instead use an ‘AAAA‘ record.</p>
<p>The ‘<strong>AAAA</strong>‘ is new way to address the domains.<br />AAAA records hold IPv6 addresses, why not IPv4 ? It was old way to address the domains, and we ran out of it. IPv4 addresses are no more available for new domains.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769791763329/08c7db1f-93c9-4690-a593-bed94011701c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-cname-record"><strong>CNAME Record</strong></h3>
<p>So, we stopped at Cloudflare. Let’s say I have a blog hosted on Hashnode, but I bought my domain <a target="_blank" href="http://mayurbadgujar.me"><code>mayurbadgujar.me</code></a> from Namecheap. I want people to type <a target="_blank" href="http://blog.mayurbadgujar.me"><code>blog.mayurbadgujar.me</code></a> and see my Hashnode blog.</p>
<p>This is where the <strong>CNAME Record</strong> saves the day. CNAME stands for "Canonical Name," which is just a fancy way of saying "Alias" or "Nickname." It maps one domain name to another domain name, not an IP address.</p>
<p>Why do we do this? Imagine if Hashnode changes their server's IP address tomorrow. If I used an A Record (pointing to their IP), my website would break, and I would have to manually update it. But with a CNAME, I just point <a target="_blank" href="http://blog.mayurbadgujar.me"><code>blog.mayurbadgujar.me</code></a> to <a target="_blank" href="http://hashnode.network"><code>hashnode.network</code></a>. Now, Hashnode manages the IP addresses in the background, and I don't have to worry about anything. It’s like telling the internet, "I don't know where Hashnode lives, just go ask them."</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769792257510/99ae1c49-cb53-4616-9222-edc77fe70d4f.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-mx-record"><strong>MX Record</strong></h3>
<p>Now, let's talk about emails. You have a website at <a target="_blank" href="http://mayurbadgujar.me"><code>mayurbadgujar.me</code></a>, but you also want to receive emails at <a target="_blank" href="mailto:hello@mayur.com"><code>hello@mayurbadgujar.me</code></a>. Does the email go to the same server as your website? Usually, no.</p>
<p>That is why we need the <strong>MX Record</strong> (Mail Exchange). This record tells the internet exactly which server handles emails for your domain. It is responsible for receiving mails.</p>
<p>Think of it like this: Your <strong>A Record</strong> is your home address where you live (your webpage). Your <strong>MX Record</strong> is your P.O. Box at the post office where your letters go (your email). If someone tries to deliver a letter to your house, the MX record tells them, "No, don't leave it here. Take it to the Gmail server down the street." Without this record, your domain cannot receive emails.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769793249851/2608fa15-ce17-4c7a-bd93-2f248d9096af.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-txt-record"><strong>TXT Record</strong></h3>
<p>Next up is the <strong>TXT Record</strong>. This one is literally what it sounds like, Text. It holds text notes.</p>
<p>At first, I wondered, Why do I need to leave text notes on my domain? The biggest use case is <strong>Verification</strong>. Let’s say you want to connect your site to Google Search Console (Login with google). Google needs to know you actually own the domain. They will give you a code and say, "Go paste this in your TXT records." Once you do that, Google checks your DNS, sees the code, and knows you are the real owner. It’s like leaving a sticky note on your front door that says, "Verified Owner: Mayur," so the security guard knows it's actually your house.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769794200625/1d296e21-0c92-44e1-8f06-5ffe950934a6.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-ns-record"><strong>NS Record</strong></h3>
<p>Finally, we have the <strong>NS Record</strong> (Name Server). This is the Manager of your domain.</p>
<p>These records point to the authoritative server where all your other records (A, CNAME, MX) are actually stored. When you buy a domain from GoDaddy but you want to manage it on Cloudflare, you change the NS Records. You are essentially telling the internet, "I bought this domain at GoDaddy, but Cloudflare is my manager now. Go ask them for my IP address." Without correct NS records, none of the other records we talked about will work because the browser won't know who to ask.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769794604105/ece4b95e-c978-4575-b30b-b79a9ab06163.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conclusion"><strong>Conclusion</strong></h3>
<p>So, that is the full journey of the "Internet's Phonebook."</p>
<ul>
<li><p><strong>A Record:</strong> The actual House Address (IP address of webpage).</p>
</li>
<li><p><strong>CNAME:</strong> The Nickname or Alias (subdomains).</p>
</li>
<li><p><strong>MX:</strong> The Post Office for emails.</p>
</li>
<li><p><strong>TXT:</strong> The Sticky Note for verification.</p>
</li>
<li><p><strong>NS:</strong> The Manager who holds the list.</p>
</li>
</ul>
<p>Now we have the Phonebook (Records), but <strong>who</strong> actually looks up the number? In the next blog, we will become Detectives and use the <code>dig</code> command to track down an IP address step-by-step.</p>
]]></content:encoded></item><item><title><![CDATA[From the Ocean Floor to Your Browser: The Internet's Journey]]></title><description><![CDATA[We are going to understand the network from very scratch,Who is the owner of it?How does it available to us?How many devices are included to make this possible?
Go let’s start the trip “From Wires to Web”
Deep Blue Origin (Undersea Cables & AS)
Under...]]></description><link>https://blog.mayurbadgujar.me/from-ocean-to-browser-network-devices-explained</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/from-ocean-to-browser-network-devices-explained</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[networking]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[System Design]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sun, 25 Jan 2026 19:42:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769361790481/4abbc1e4-2313-44b1-9b7b-9d6b46a7732c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We are going to understand the network from very scratch,<br />Who is the owner of it?<br />How does it available to us?<br />How many devices are included to make this possible?</p>
<p>Go let’s start the trip “From Wires to Web”</p>
<h3 id="heading-deep-blue-origin-undersea-cables-amp-as">Deep Blue Origin (Undersea Cables &amp; AS)</h3>
<p>Undersea wires (Fiber Optics Cables) are backbone of network. Large organizations manage them, like <strong>Tata Communication</strong> (they connects 240+ countries and territories, own major share of global backbone traffic).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769362551802/f88352bd-15de-4d4f-bce5-e298269ad38d.png" alt class="image--center mx-auto" /></p>
<p><strong>Autonomous Systems (AS)</strong> is a network under one single administrative control, identified by an unique <strong>Autonomous System Number (ASN)</strong> and using the <strong>Border Gateway Protocol (BGP)</strong> to exchange the routes.</p>
<p><strong>What do AS (Autonomous Systems) do ?</strong></p>
<p>They have there own network through wires or rent wires.<br />Tier-1 ASes don’t buy internet from anyone.<br />They do <strong>Peering</strong> (free or settlement-free), <strong>Paid peering, Transit (paid)</strong>, exchange of routes.<br />They reach to whole world and connects they world</p>
<p>Examples of Tier-1 <strong>ASes</strong> (Autonomous Systems):<br />Tata Communications<br />AT&amp;T<br />Verizon<br />NTT</p>
<h3 id="heading-border-control-bgp-amp-isp">Border Control (BGP &amp; ISP)</h3>
<p>Finally, cable hits land. But still they need to know where to go next.<br />This is where <strong>Border Gateway Protocol (BGP)</strong> comes in picture.<br />The <strong>Border Gateway Protocol (BGP),</strong> exchanges routing information between Autonomous Systems to determine the best path for traffic. BGP allows ASes to interconnect.</p>
<p>An ISP provides <strong>last-mile connectivity</strong> and <strong>IP routing</strong> services to end users, connecting customer networks to the global Internet.</p>
<p>Wires bring data from different sources under oceans to land, Then BGP helps to decides the paths data should take between networks.<br />BGP decides <em>where</em> data should go, but time to send that data to real user. So ISP comes in, helps route data to particular address.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769363521453/6004b6a4-016d-4a2c-afa0-9a4b30c15e4b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-modem-ont"><strong>Modem / ONT</strong></h3>
<p>ISP wire (fiber or copper) reach to your home. Copper/coax and Fiber cables carries electrical / RF and optical signals, but devices speak digital data.<br />This problem is solved by the Modem/ONT. Modem/ONT do signal conversion, they translate signals.</p>
<p><strong>Demodulation</strong>: Incoming signals from cable gets converted into digital data usable by the home network.<br /><strong>Modulation</strong>: Device sends back the digital data, digital data gets converted into analog/optical signals.</p>
<p><strong>Modem VS ONT (Optical Network Terminal):</strong><br />Modem do modulation and demodulation and ONT do signal conversion. Works on different technologies.<br /><strong>Modem</strong>: Handles copper wire / coax cable. These cables bring electrical / RF signals, modem converts that into digital data.<br /><strong>ONT:</strong> Handles Fiber optics cable. These cables bring light signals, ONT converts that into digital data.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769364530326/5ff2ccde-658e-41d5-95f1-c820d8ad18e8.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-router">Router</h3>
<p>Once digital data enters the home through the <strong>Modem or ONT</strong>, it reaches the <strong>Router</strong>.<br />The router acts as the boss of the home network, deciding how data should flow between devices and the Internet.<br />Router connects two different networks:</p>
<p>The <strong>external network</strong> (ISP / Internet)<br />The <strong>internal network</strong> (your home LAN)</p>
<p><strong>What does a Router do?</strong><br />The router share data packets between networks using the IP addresses.</p>
<ul>
<li><p>Incoming Data : Routed to the correct device.</p>
</li>
<li><p>Outgoing Data : Routed to internet.</p>
</li>
</ul>
<p>For assigning the IP address and routing the data packets to the particular address, The NAT(Network Address Translation) and DHCP(Automatic IP Assignment) are responsible.</p>
<p><strong>NAT</strong> (Network Address Translation)<br />Home devices use <strong>private IP addresses</strong> that are not visible on the Internet.</p>
<ul>
<li><p>Router replaces private IPs with <strong>one public IP</strong></p>
</li>
<li><p>Keeps a translation table to send responses back to the correct device</p>
</li>
</ul>
<blockquote>
<p><strong>NAT allows multiple devices to share a single Internet connection</strong></p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769365411213/289a8b8b-dc5e-4156-9929-ab451eec940e.png" alt class="image--center mx-auto" /></p>
<p><strong>DHCP</strong> (Automatic IP Assignment)<br />Instead of manually assigning IPs to every device:</p>
<ul>
<li><p>Router runs a <strong>DHCP server</strong></p>
</li>
<li><p>Automatically assigns:</p>
<ul>
<li><p>IP address</p>
</li>
<li><p>Subnet mask</p>
</li>
<li><p>Gateway</p>
</li>
<li><p>DNS</p>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>“Wi-Fi connect ho gaya” = DHCP succeeded</p>
</blockquote>
<h3 id="heading-switch-vs-hub">Switch vs. Hub</h3>
<p><strong>Hub (Old Technology)</strong></p>
<ul>
<li><p>Sends incoming data to <strong>every connected device</strong></p>
</li>
<li><p>No intelligence, no filtering</p>
</li>
<li><p>Causes collisions and wasted bandwidth</p>
</li>
</ul>
<blockquote>
<p><strong>Result:</strong> Slow and inefficient</p>
</blockquote>
<p><strong>Switch (Modern Technology)</strong></p>
<ul>
<li><p>Sends data <strong>only to the destination MAC address</strong></p>
</li>
<li><p>Learns which device is on which port</p>
</li>
<li><p>Reduces collisions and improves performance</p>
</li>
</ul>
<blockquote>
<p><strong>Result:</strong> Fast and efficient</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769367779705/5fe557f0-7e7d-4ba6-b966-c3d693c62073.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-firewall">Firewall</h3>
<p>Once the traffic passes the Router, we need security. The Internet is full of malicious requests, hackers, and bots. A <strong>Firewall</strong> is a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.</p>
<p><strong>What does a Firewall do?</strong></p>
<ul>
<li><p><strong>Packet Filtering:</strong> It inspects data packets. If a packet comes from a suspicious IP or tries to enter a blocked Port, the Firewall rejects it.</p>
</li>
<li><p><strong>Stateful Inspection:</strong> It remembers active connections. If you didn't ask for a video, it won't let a random video stream enter your network.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769368276410/59c44aeb-1018-4015-8a99-8cb55be56f47.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-load-balancer">Load Balancer</h3>
<p>Now, let's look at the other side, where the website lives (like Google or Netflix). When millions of users hit a website at the same time, one single server cannot handle the pressure. It will crash. A <strong>Load Balancer</strong> acts as a "traffic cop" sitting in front of your servers and distributing client requests across all servers capable of fulfilling those requests.</p>
<p><strong>Why do we need it?</strong></p>
<p>It ensures no single server bears too much demand.</p>
<p>If one server goes down, the Load Balancer detects it and redirects traffic to the remaining online servers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769369744023/ea426195-0648-4705-a4e1-99abb51a26af.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conclusion-the-full-journey">Conclusion, The Full Journey</h3>
<p>So, that is the physical journey of the Internet</p>
<ol>
<li><p><strong>Deep Sea:</strong> Data travels through <strong>Undersea Cables</strong>.</p>
</li>
<li><p><strong>Border:</strong> <strong>BGP</strong> decides the route between countries.</p>
</li>
<li><p><strong>Entry:</strong> <strong>Modem/ONT</strong> translates the signal (Light/Analog to Digital).</p>
</li>
<li><p><strong>Distribution:</strong> <strong>Router</strong> assigns an IP and directs the packet.</p>
</li>
<li><p><strong>Security:</strong> <strong>Firewall</strong> checks if the packet is safe.</p>
</li>
<li><p><strong>Delivery:</strong> <strong>Switch</strong> delivers it to your specific device.</p>
</li>
</ol>
<p>Now that we are connected physically, there is one big problem left. Computers don't speak English. They don't know what <a target="_blank" href="http://google.com"><code>google.com</code></a> is, they only know IP addresses like <code>142.250.1.1</code>.</p>
<p>So, how does your browser translate a name into an IP address? That is where the <strong>Phonebook of the Internet (DNS)</strong> comes in.</p>
]]></content:encoded></item><item><title><![CDATA[How Git Works Internally]]></title><description><![CDATA[We all grind Data Structures and Algorithms(DSA) for interviews and then we switch to Development and think it’s a totally different world.
But here is the truth I found while digging into Git internals: Git is literally just a Linked List.
When we l...]]></description><link>https://blog.mayurbadgujar.me/how-git-works-internally</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/how-git-works-internally</guid><category><![CDATA[Git]]></category><category><![CDATA[data structures]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 10 Jan 2026 16:15:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768061499636/575ecd5b-1397-46d8-b671-df68ba13998b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We all grind Data Structures and Algorithms(DSA) for interviews and then we switch to Development and think it’s a totally different world.</p>
<p>But here is the truth I found while digging into Git internals: <strong>Git is literally just a Linked List.</strong></p>
<p>When we learn about Linked Lists in college, it feels theoretical. But every time you type <code>git commit</code>, you are adding a <strong>Node</strong> to the most famous Linked List in the world.</p>
<h3 id="heading-the-behind-the-scenesbts-logic">The Behind The Scenes(BTS) Logic</h3>
<p>If you look at the raw data inside the <code>.git</code> folder, the mapping is crazy accurate:</p>
<p><strong>The Node:</strong> Your <strong>Commit</strong> is the Node. It holds your metadata or user data (author, message).</p>
<p><strong>The Pointer:</strong> Every commit has a Parent Hash. This is literally the <code>prev</code> pointer in a Linked List. It points to the commit that came before it.</p>
<p><strong>The Head:</strong> You know how we have a <code>head</code> pointer in DSA to track the start? In Git, <strong>HEAD</strong> is a pointer that always points to the last node you worked on.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768058661297/28cbab5b-7b1d-45f6-8f2f-5e676b27eead.jpeg" alt class="image--center mx-auto" /></p>
<h3 id="heading-secret-part-sha-1-amp-trees">Secret Part: SHA-1 &amp; Trees</h3>
<p>This is where it gets cool. How does Git actually save your code inside that Node?</p>
<p>It uses <strong>SHA-1 Hashing</strong>.</p>
<p>Every time you save a file, Git takes the raw content, runs it through an algorithm, and spits out a 40-character unique ID (like <code>a1b2c3 . . .</code>).</p>
<ul>
<li><p>Git doesn't care about the filename here. It only cares about the <strong>content</strong>.</p>
</li>
<li><p>If two files have the exact same code, they share the exact same Hash, Efficiency level: 100.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768058987830/5e61da56-b4ed-402e-b4ff-465e36f18d6c.jpeg" alt class="image--center mx-auto" /></p>
<p>So how does it remember folder structures?</p>
<p>Enter the Tree Object.</p>
<p>Think of a Tree Object as a simple directory list. It maps your filenames to those SHA-1 hashes.</p>
<ul>
<li><p><code>"index.html"</code> - &gt; points to Blob <code>e4f2 . . .</code></p>
</li>
<li><p><code>"styles/"</code> - &gt; points to another Tree <code>89a1 . . .</code></p>
</li>
</ul>
<h3 id="heading-how-changes-spread">How Changes Spread</h3>
<p>When you make a new Commit (node), Git doesn't copy all your files.</p>
<ol>
<li><p>It creates a new <strong>Tree</strong> representing the current state of your folder.</p>
</li>
<li><p>If you only changed one file, Git generates a new SHA-1 for that file.</p>
</li>
<li><p>The new Tree points to the <strong>new</strong> file hash, but keeps pointing to the <strong>old</strong> hashes for everything else that didn't change.</p>
</li>
</ol>
<h3 id="heading-the-conclusion">The Conclusion</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768059571562/2f24b762-a02d-4128-b698-c605b44285c9.jpeg" alt class="image--center mx-auto" /></p>
<p>Stop treating Git like magic. It’s just a database of nodes (Commits) pointing to maps (Trees) pointing to data (Blobs).</p>
<p>If you can reverse a Linked List in an interview, you already understand how Git history works. We are just traversing nodes, bro!</p>
]]></content:encoded></item><item><title><![CDATA[Git for Beginners - Basics and Essential Commands]]></title><description><![CDATA[In the last article, we talked about the nightmare of passing pendrives around. We decided we needed a system that acts like a Time Machine for our code. A system that remembers versions, bugs, and updates.
That system is Git.
What is Git?
This is th...]]></description><link>https://blog.mayurbadgujar.me/git-for-beginners-basics-and-essential-commands</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/git-for-beginners-basics-and-essential-commands</guid><category><![CDATA[Git]]></category><category><![CDATA[version control]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[software development]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 10 Jan 2026 09:48:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768037206687/3eb9bf34-255b-4b7a-986f-f7ba055e78e2.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the last article, we talked about the nightmare of passing pendrives around. We decided we needed a system that acts like a <strong>Time Machine</strong> for our code. A system that remembers versions, bugs, and updates.</p>
<p>That system is <strong>Git</strong>.</p>
<h2 id="heading-what-is-git">What is Git?</h2>
<p>This is the Time Machine. It allows you to go back to yesterday’s code if today’s code breaks. It tracks each line you changed on your laptop itself.</p>
<p><strong>Game Changer: It is Distributed</strong> The tracked history can be shared online on the cloud (GitHub).</p>
<blockquote>
<p>If anyone loses the code, <strong>you still have the entire project history on your laptop</strong>, and all other team members also have that project history.</p>
</blockquote>
<p><strong>Problem solved:</strong> It tracks each line, so now you know <em>what</em> updated and <em>when</em>.</p>
<p><strong>Still an issue:</strong> How do others see the projects? We will see this later. First, let’s setup the Git config.</p>
<hr />
<h2 id="heading-first-time-setup">First-Time Setup</h2>
<p>The setup creates the identity of the developer. We need to answer the manager's question: <em>“Who wrote this code?”</em></p>
<p><strong>1. Set your Name</strong> This is what appears when you make any changes.</p>
<p>Bash</p>
<pre><code class="lang-plaintext">git config --global user.name "Mayur"
</code></pre>
<p><strong>2. Set your Email</strong> <strong>Important:</strong> This must match your GitHub email if you want those green contribution squares in your profile!</p>
<pre><code class="lang-plaintext">git config --global user.email "mayur@example.com"
</code></pre>
<p><strong>3. Verify it worked</strong></p>
<pre><code class="lang-plaintext">git config --list
</code></pre>
<blockquote>
<p><strong>Note:</strong> The <code>--global</code> flag means “apply to every project on my laptop”. You only do this once!</p>
</blockquote>
<p><strong>Problem solved:</strong> Now the manager can see the names and emails of the developers on each contribution.</p>
<hr />
<h2 id="heading-initializing-vs-cloning-a-project">Initializing vs Cloning a Project</h2>
<p><strong>How to initialize a new Git repo (</strong><code>git init</code>) To track your project, Git needs to "see" your project from the local code editor (VS Code). Allow Git to see your project by the command:</p>
<pre><code class="lang-plaintext">git init
</code></pre>
<p>The <code>.git</code> folder is added to your project. It's hidden from you, but all your history is stored inside it.</p>
<p><strong>How to clone an existing Git repo (</strong><code>git clone</code>) If your teammate has already initiated the repo (project) on the cloud (GitHub), you don't init. You use:</p>
<pre><code class="lang-plaintext">git clone &lt;repo url&gt;
</code></pre>
<p><code>git clone</code> is used to create a copy of the version which is already updated on the cloud.</p>
<hr />
<h2 id="heading-saving-changes-the-wedding-photo-analogy">Saving Changes: The "Wedding Photo" Analogy</h2>
<p>Now that you have a repository, you can save file changes. Beginners often get confused about why we need <code>add</code> before <code>commit</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768038098024/3c19f7ab-2fbf-47f1-a03d-5d712878a87a.png" alt class="image--center mx-auto" /></p>
<p><strong>Think of a Wedding Photographer.</strong></p>
<p><strong>1. The Hall (Working Directory)</strong> The wedding hall with all the guests. Some are new, some are eating.</p>
<ul>
<li><p><em>Command to check the hall:</em></p>
<pre><code class="lang-plaintext">  git status
</code></pre>
</li>
</ul>
<p><strong>2. The Stage (</strong><code>git add</code>) You call specific people to the stage. You are <strong>arranging the group</strong> for the picture.</p>
<ul>
<li><p><em>Command to stage files:</em></p>
<pre><code class="lang-plaintext">  git add filename.js
  # OR to add everyone
  git add .
</code></pre>
</li>
</ul>
<p><strong>3. The Shutter Click (</strong><code>git commit</code>) You freeze that moment forever in your camera's memory.</p>
<ul>
<li><p><em>Command to save:</em></p>
<pre><code class="lang-plaintext">  git commit -m "Added the login feature"
</code></pre>
</li>
</ul>
<p><strong>4. Uploading (</strong><code>git push</code>) You upload that photo to Instagram (GitHub) so the family can see it.</p>
<ul>
<li><p><em>Command to sync:</em></p>
<pre><code class="lang-plaintext">  git push origin main
</code></pre>
</li>
</ul>
<hr />
<h2 id="heading-viewing-history">Viewing History</h2>
<p>Git tracks its own history locally. You can walk through the history of the project anytime.</p>
<ul>
<li><p><em>Command to see the Time Machine:</em></p>
<pre><code class="lang-plaintext">  git log
</code></pre>
</li>
</ul>
<p>It shows every version, who made it, and when.</p>
<h3 id="heading-summary-git-vs-github">Summary: Git vs GitHub</h3>
<p>They are totally different:</p>
<ul>
<li><p><strong>Git</strong> helps you track your code <strong>locally</strong> in the project itself.</p>
</li>
<li><p><strong>GitHub</strong> is the <strong>online service</strong> where you push code so that others can collaborate asynchronously with you.</p>
</li>
</ul>
<p><strong>Next Article:</strong> How Git Works Internally</p>
]]></content:encoded></item><item><title><![CDATA[Problems Faced Before Version Control Systems]]></title><description><![CDATA[It's okay to have bugs in code, but it’s not okay to fail to deliver products on time. Especially when the company burns lakhs for the developers.
What was the problem previously? Let's look at the Pendrive Era.
Why We Stopped Using Pendrives ?
Imagi...]]></description><link>https://blog.mayurbadgujar.me/problems-faced-before-version-control-systems</link><guid isPermaLink="true">https://blog.mayurbadgujar.me/problems-faced-before-version-control-systems</guid><category><![CDATA[Git]]></category><category><![CDATA[version control]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mayur Badgujar]]></dc:creator><pubDate>Sat, 10 Jan 2026 08:51:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768060710413/96c1a381-6eda-47a7-b278-746143166be9.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's okay to have bugs in code, but it’s <strong>not okay to fail to deliver products on time.</strong> Especially when the company burns lakhs for the developers.</p>
<p>What was the problem previously? Let's look at the Pendrive Era.</p>
<h2 id="heading-why-we-stopped-using-pendrives">Why We Stopped Using Pendrives ?</h2>
<p>Imagine we start a new project. It's assigned to a team of 3 developers, and the company is paying them <strong>$50/hour each</strong>.</p>
<p>They discuss the architecture. They even give it an internal name <strong>Project Monkey</strong>.</p>
<ol>
<li><p><strong>Dev-1</strong> starts working on the landing page. He completes it roughly in an hour.</p>
</li>
<li><p>To let the other 2 devs review the code, he makes a <code>first_v1.zip</code> folder and shifts the zip folder into the <strong>pendrive</strong>.</p>
</li>
<li><p>Finally, they get to read the code from the pendrive and copy the zip folder to work further on top of that.</p>
</li>
</ol>
<h3 id="heading-the-cost">The Cost</h3>
<p>While the first dev was writing code, the other 2 devs were waiting for the pendrive.</p>
<blockquote>
<p>The company is burning <strong>$100/hour for zero output.</strong></p>
</blockquote>
<p>This Inactive time kills the delivery time of the project.</p>
<p>After an hour, they share the pendrive again.</p>
<ul>
<li><p><strong>Third dev</strong> passed the pendrive to <strong>First dev</strong>.</p>
</li>
<li><p><strong>First dev</strong> was confused: <em>"Bro, you coded a lot, but what changed?"</em></p>
</li>
<li><p><strong>First dev</strong> passed the pendrive to <strong>Second dev</strong>.</p>
</li>
<li><p><strong>Second dev</strong> was again confused: <em>"Guys there’s lots of code, which code is written by whom?"</em></p>
</li>
</ul>
<hr />
<h3 id="heading-issue-1-tracking-amp-accountability">Issue #1: Tracking &amp; Accountability</h3>
<blockquote>
<p><strong>Dev:</strong> "Who wrote this bug?"<br /><strong>Manager:</strong> "How should I pay them? I don’t know who contributed and how."</p>
</blockquote>
<p><strong>🛑 Impact:</strong> Wasted Salaries, We are paying for work we can't track.</p>
<hr />
<h3 id="heading-issue-2-collaboration-and-time">Issue #2: Collaboration and Time</h3>
<p>This is the Serial vs Parallel problem.</p>
<blockquote>
<p><strong>Dev:</strong> "If someone fixed an error, I need to wait for the updated code so I can code further!"<br /><strong>Manager:</strong> "Why is only one dev working at a time?"</p>
</blockquote>
<p><strong>🛑 Impact:</strong> Delivery Time &amp; Code Quality.</p>
<p>By chance, if they started working parallelly, they are still out of sync! If we have 5 or 10 devs in a team, think about the amount of time they will take just to <em>share</em> code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768034308970/c78185c6-7a09-4d1c-83ad-7d154ef5b5b1.jpeg" alt class="image--center mx-auto" /></p>
<hr />
<h3 id="heading-issue-3-versioning-and-backups">Issue #3: Versioning and Backups</h3>
<p>While sharing, everyone is creating an "updated zip folder." It is hard to know which is the correct and newer version.</p>
<blockquote>
<p><strong>Dev:</strong> "An error occurred! I need the old version... but where is it?"<br /><strong>Manager:</strong> "There is no recovery and no backups?"</p>
</blockquote>
<p><strong>🛑 Impact:</strong> High Risk. One corrupted pendrive kills the project.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768034495920/b579c1c5-a311-40a0-955c-9b0f5c0ace8a.png" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-whats-the-solution">What’s the solution?</h2>
<p>We realized we can't scale with pendrives. We need a system that can:</p>
<ol>
<li><p><strong>Track every line:</strong> When was it updated? Who updated it?</p>
</li>
<li><p><strong>Enable Parallel Work:</strong> Allow everyone to see updated code every second.</p>
</li>
<li><p><strong>Auto-Backup:</strong> Save history by tracking every single update.</p>
</li>
</ol>
<p>We needed a way to let 100 developers work on the same project at the exact same second, without costing the company a lot in money and time.</p>
<p>That system is <strong>Git</strong>.</p>
<p><strong>Next Article:</strong> <a target="_blank" href="https://git-exploration-mayur.hashnode.dev/git-for-beginners-basics-and-essential-commands"><strong>What actually is Git?</strong></a></p>
]]></content:encoded></item></channel></rss>