<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ashitosh Lavhate</title>
    <description>The latest articles on DEV Community by Ashitosh Lavhate (@ashitoshh01).</description>
    <link>https://dev.to/ashitoshh01</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4022979%2Fa4d819c3-2cbc-4901-b619-217f960bb733.gif</url>
      <title>DEV Community: Ashitosh Lavhate</title>
      <link>https://dev.to/ashitoshh01</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashitoshh01"/>
    <language>en</language>
    <item>
      <title>I Finally Understood Why Database Indexes Make Queries Faster</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Sun, 23 Aug 2026 05:09:39 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/i-finally-understood-why-database-indexes-make-queries-faster-226k</link>
      <guid>https://dev.to/ashitoshh01/i-finally-understood-why-database-indexes-make-queries-faster-226k</guid>
      <description>&lt;p&gt;I used to think adding an index to a database was basically a magic &lt;strong&gt;“make this query faster”&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;Then I understood what was actually happening underneath.&lt;/p&gt;

&lt;p&gt;Imagine a &lt;code&gt;users&lt;/code&gt; table with 1 million records.&lt;/p&gt;

&lt;p&gt;If we run:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Without an index, the database may have to check rows one by one until it finds the match.&lt;/p&gt;

&lt;p&gt;That's basically:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Let me search through everything.”&lt;/strong&gt; 😭&lt;/p&gt;

&lt;p&gt;Now add an index:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_users_email&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database can use a specialized data structure to locate the matching value much more efficiently.&lt;/p&gt;

&lt;p&gt;It's similar to the difference between:&lt;/p&gt;

&lt;p&gt;📚 Searching every page of a book&lt;br&gt;
vs.&lt;br&gt;
🔖 Using the index at the back of the book&lt;/p&gt;

&lt;p&gt;But here's the part I didn't realize:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Indexes aren't free.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every index takes storage, and when you &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, or &lt;code&gt;DELETE&lt;/code&gt; data, the database may also need to update the indexes.&lt;/p&gt;

&lt;p&gt;So blindly adding indexes isn't the solution.&lt;/p&gt;

&lt;p&gt;A better approach is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find queries that are actually slow.&lt;/li&gt;
&lt;li&gt;Check how the database executes them.&lt;/li&gt;
&lt;li&gt;Add indexes to columns frequently used for filtering, joining, or sorting.&lt;/li&gt;
&lt;li&gt;Measure the improvement.&lt;/li&gt;
&lt;li&gt;Remove indexes that aren't providing value.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, if your application constantly does:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then indexing &lt;code&gt;email&lt;/code&gt; makes a lot of sense.&lt;/p&gt;

&lt;p&gt;But creating indexes on every column?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Probably not.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The lesson I took away
&lt;/h3&gt;

&lt;p&gt;Database performance isn't just about writing faster SQL.&lt;/p&gt;

&lt;p&gt;It's about understanding &lt;strong&gt;how the database finds your data&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And honestly, learning this changed the way I think about backend development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't optimize blindly. Understand what the database is doing first.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>web</category>
      <category>backend</category>
      <category>developer</category>
    </item>
    <item>
      <title>You Press Enter After Typing a URL. Here's Everything That Happens Next.</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Sat, 22 Aug 2026 05:40:43 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/you-press-enter-after-typing-a-url-heres-everything-that-happens-next-3716</link>
      <guid>https://dev.to/ashitoshh01/you-press-enter-after-typing-a-url-heres-everything-that-happens-next-3716</guid>
      <description>&lt;p&gt;You type:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Press &lt;strong&gt;Enter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A few milliseconds later, the website appears.&lt;/p&gt;

&lt;p&gt;Simple, right?&lt;/p&gt;

&lt;p&gt;Not really. 😄&lt;/p&gt;

&lt;p&gt;Behind that single Enter key is a chain of networking, security, server-side processing, and browser rendering.&lt;/p&gt;

&lt;p&gt;Here's what actually happens.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Browser Checks: "Do I Already Know This?"
&lt;/h2&gt;

&lt;p&gt;Before asking the internet anything, your browser checks whether it already has useful information cached.&lt;/p&gt;

&lt;p&gt;It may check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser cache&lt;/li&gt;
&lt;li&gt;Operating system DNS cache&lt;/li&gt;
&lt;li&gt;Router cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the IP address is already available, it can skip a DNS lookup.&lt;/p&gt;

&lt;p&gt;If not, it's time to ask DNS.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. DNS Turns the Domain Into an IP Address
&lt;/h2&gt;

&lt;p&gt;Humans use names like:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Computers need an IP address.&lt;/p&gt;

&lt;p&gt;DNS acts like the internet's phonebook:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Your request may involve multiple DNS servers before the correct IP address is found.&lt;/p&gt;

&lt;p&gt;Now the browser knows &lt;strong&gt;where&lt;/strong&gt; to send the request.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. A Connection Is Established
&lt;/h2&gt;

&lt;p&gt;For most HTTPS websites, the browser needs to establish a connection with the server.&lt;/p&gt;

&lt;p&gt;Traditionally, this begins with TCP's famous three-way handshake:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser → SYN → Server
Browser ← SYN-ACK ← Server
Browser → ACK → Server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now both sides are ready to communicate reliably.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. HTTPS Adds a Security Layer
&lt;/h2&gt;

&lt;p&gt;Because we're visiting:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;the browser also needs to establish an encrypted connection.&lt;/p&gt;

&lt;p&gt;This involves a TLS handshake.&lt;/p&gt;

&lt;p&gt;During this process, the browser verifies the server's certificate and both sides establish encryption keys.&lt;/p&gt;

&lt;p&gt;After this, the data exchanged between your browser and the server is encrypted.&lt;/p&gt;

&lt;p&gt;That's why HTTPS matters.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. The Browser Sends the HTTP Request
&lt;/h2&gt;

&lt;p&gt;Now the browser can finally ask for the page.&lt;/p&gt;

&lt;p&gt;Something conceptually like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;GET&lt;/span&gt; &lt;span class="nn"&gt;/&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt;
&lt;span class="na"&gt;User-Agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Mozilla/5.0&lt;/span&gt;
&lt;span class="na"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;text/html&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That request travels across the internet to the server.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. The Server Starts Doing Its Job
&lt;/h2&gt;

&lt;p&gt;What happens next depends on the application.&lt;/p&gt;

&lt;p&gt;The request might go through:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Load Balancer
      ↓
Web Server
      ↓
Backend Application
      ↓
Database / Cache / External Services
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, in a NestJS application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
  ↓
Middleware
  ↓
Guard
  ↓
Controller
  ↓
Service
  ↓
Database
  ↓
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server processes the request and sends something back.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. The Browser Receives HTML
&lt;/h2&gt;

&lt;p&gt;Imagine the server returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/styles.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello World&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/app.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser doesn't just instantly display this.&lt;/p&gt;

&lt;p&gt;It starts parsing it.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. HTML Becomes the DOM
&lt;/h2&gt;

&lt;p&gt;The browser converts HTML into the &lt;strong&gt;DOM (Document Object Model)&lt;/strong&gt;.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML
 ↓
Parser
 ↓
DOM Tree
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the same time, it discovers other resources.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;styles.css
app.js
images
fonts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And begins fetching them.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. CSS Builds the CSSOM
&lt;/h2&gt;

&lt;p&gt;CSS is also parsed into a structure called the:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS Object Model (CSSOM)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So now the browser has:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DOM + CSSOM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are combined to determine what should actually appear on the screen.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. The Browser Creates the Page You See
&lt;/h2&gt;

&lt;p&gt;The browser goes through several rendering steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DOM + CSSOM
        ↓
    Render Tree
        ↓
      Layout
        ↓
      Paint
        ↓
    Compositing
        ↓
   🎉 Website appears
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Layout
&lt;/h3&gt;

&lt;p&gt;The browser calculates:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where should every element go?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Paint
&lt;/h3&gt;

&lt;p&gt;It draws:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Text, colors, borders, shadows, images...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Compositing
&lt;/h3&gt;

&lt;p&gt;Different layers are combined and displayed on your screen.&lt;/p&gt;

&lt;p&gt;And finally...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You see the website.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  The Crazy Part?
&lt;/h1&gt;

&lt;p&gt;All of this happens after you press one key:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Your browser may perform DNS resolution, establish secure connections, send requests, receive responses, download resources, execute JavaScript, calculate layouts, and render pixels...&lt;/p&gt;

&lt;p&gt;Often in less than a second.&lt;/p&gt;

&lt;p&gt;The next time a website takes "just a few seconds" to load, remember:&lt;/p&gt;

&lt;p&gt;A lot has to happen before even one pixel appears on your screen.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Full Journey
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Type URL
   ↓
Check Cache
   ↓
DNS Lookup
   ↓
Connect to Server
   ↓
TLS Handshake
   ↓
HTTP Request
   ↓
Server Processing
   ↓
HTTP Response
   ↓
Parse HTML → DOM
   ↓
Parse CSS → CSSOM
   ↓
Fetch JS / Images / Fonts
   ↓
Render Tree
   ↓
Layout
   ↓
Paint
   ↓
Compositing
   ↓
Website 🎉
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding this flow changed the way I think about web development.&lt;/p&gt;

&lt;p&gt;A frontend isn't just "sending an API request."&lt;/p&gt;

&lt;p&gt;A backend isn't just "returning JSON."&lt;/p&gt;

&lt;p&gt;And a browser isn't just "showing a page."&lt;/p&gt;

&lt;p&gt;They're all part of one incredibly coordinated system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The web feels simple because an absurd amount of complexity is hidden behind one URL.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;💬 &lt;strong&gt;What part of this journey do you find the most interesting: DNS, HTTPS, backend processing, or browser rendering?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>browser</category>
      <category>logic</category>
      <category>web</category>
    </item>
    <item>
      <title>Why Does Go Have Goroutines? Understanding Go’s Lightweight Concurrency</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Sat, 15 Aug 2026 15:46:42 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/why-does-go-have-goroutines-understanding-gos-lightweight-concurrency-341p</link>
      <guid>https://dev.to/ashitoshh01/why-does-go-have-goroutines-understanding-gos-lightweight-concurrency-341p</guid>
      <description>&lt;p&gt;When I started exploring Go, one feature immediately stood out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just adding &lt;code&gt;go&lt;/code&gt; before a function call can run it concurrently.&lt;/p&gt;

&lt;p&gt;That got me thinking: &lt;strong&gt;what exactly is a goroutine, and why does Go need it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, I decided to learn the basics. Here's what I found. 👇&lt;/p&gt;

&lt;h2&gt;
  
  
  First, what is concurrency?
&lt;/h2&gt;

&lt;p&gt;Imagine you have multiple tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetching data from an API&lt;/li&gt;
&lt;li&gt;Processing a file&lt;/li&gt;
&lt;li&gt;Handling user requests&lt;/li&gt;
&lt;li&gt;Writing data to a database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your program handles them one after another, one task may spend a lot of time waiting while everything else is blocked.&lt;/p&gt;

&lt;p&gt;Concurrency allows a program to make progress on multiple tasks during overlapping periods of time.&lt;/p&gt;

&lt;p&gt;This is especially useful when programs need to handle lots of work efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a goroutine?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;goroutine&lt;/strong&gt; is a function that runs concurrently with other goroutines.&lt;/p&gt;

&lt;p&gt;Creating one is surprisingly simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"fmt"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;sayHello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello from a goroutine!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;sayHello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello from main!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only difference is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;sayHello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;go&lt;/code&gt; keyword tells Go to start &lt;code&gt;sayHello()&lt;/code&gt; as a goroutine.&lt;/p&gt;

&lt;h2&gt;
  
  
  But there's a problem 👀
&lt;/h2&gt;

&lt;p&gt;If you run the previous example, you might not always see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello from a goroutine!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Because once &lt;code&gt;main()&lt;/code&gt; finishes, the program exits.&lt;/p&gt;

&lt;p&gt;The goroutine may not get enough time to complete.&lt;/p&gt;

&lt;p&gt;A simple way to wait for goroutines is using &lt;code&gt;sync.WaitGroup&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"sync"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;wg&lt;/span&gt; &lt;span class="n"&gt;sync&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WaitGroup&lt;/span&gt;

    &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Task 1 completed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}()&lt;/span&gt;

    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Task 2 completed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}()&lt;/span&gt;

    &lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wait&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"All tasks completed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;wg.Add(2)&lt;/code&gt; tells the WaitGroup to wait for 2 tasks.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;go&lt;/code&gt; starts each function as a goroutine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;defer wg.Done()&lt;/code&gt; signals that a task has finished.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wg.Wait()&lt;/code&gt; prevents &lt;code&gt;main()&lt;/code&gt; from exiting until both tasks are complete.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why not just create multiple threads?
&lt;/h2&gt;

&lt;p&gt;This is where Go becomes particularly interesting.&lt;/p&gt;

&lt;p&gt;Goroutines are &lt;strong&gt;not simply traditional OS threads&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;They are lightweight units of concurrent execution managed by the Go runtime. The runtime schedules goroutines onto OS threads, which means you can work with large numbers of goroutines without manually creating and managing a thread for every task.&lt;/p&gt;

&lt;p&gt;That's one of the reasons Go is popular for systems and services that need to handle many concurrent operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concurrency vs Parallelism
&lt;/h2&gt;

&lt;p&gt;One thing I also learned while reading about goroutines:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concurrency and parallelism are not exactly the same thing.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency:&lt;/strong&gt; Structuring a program so multiple tasks can make progress independently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallelism:&lt;/strong&gt; Actually executing multiple tasks at the same time using multiple processing resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A program can be concurrent without every task literally running at the exact same instant.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bigger picture
&lt;/h2&gt;

&lt;p&gt;Goroutines become even more powerful when combined with &lt;strong&gt;channels&lt;/strong&gt;, which allow goroutines to communicate and synchronize.&lt;/p&gt;

&lt;p&gt;So the Go concurrency model is not just:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Run everything at the same time."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's about making concurrent programs easier to structure using tools built directly into the language and its runtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned today
&lt;/h2&gt;

&lt;p&gt;My biggest takeaway was this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Goroutines make concurrency feel simple, but Go's runtime is doing a lot of work behind the scenes to manage them efficiently.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What starts with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;opens the door to learning about scheduling, synchronization, channels, race conditions, parallelism, and scalable systems.&lt;/p&gt;

&lt;p&gt;I'm still learning Go, but this was a really interesting first step into understanding how it handles concurrency. 🚀&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Go concept should I explore next: Channels, Interfaces, &lt;code&gt;defer&lt;/code&gt;, or something else?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>go</category>
    </item>
    <item>
      <title>Your Database Is Probably Doing More Work Than It Needs To 🗄️⚡</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Wed, 12 Aug 2026 17:13:51 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/your-database-is-probably-doing-more-work-than-it-needs-to-1p89</link>
      <guid>https://dev.to/ashitoshh01/your-database-is-probably-doing-more-work-than-it-needs-to-1p89</guid>
      <description>&lt;p&gt;When an application becomes slow, developers often look at the frontend first.&lt;/p&gt;

&lt;p&gt;Maybe the React component is rendering too many times.&lt;/p&gt;

&lt;p&gt;Maybe the API is slow.&lt;/p&gt;

&lt;p&gt;Maybe the server needs more CPU.&lt;/p&gt;

&lt;p&gt;But sometimes the real problem is much simpler:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your database is doing way more work than necessary.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And the scary part?&lt;/p&gt;

&lt;p&gt;Your application can work perfectly while still making terrible database queries.&lt;/p&gt;

&lt;p&gt;Here are some common mistakes I've started paying much more attention to.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Stop Using &lt;code&gt;SELECT *&lt;/code&gt; Everywhere
&lt;/h2&gt;

&lt;p&gt;This is probably one of the easiest things to overlook.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ask for only what you actually need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Imagine your &lt;code&gt;users&lt;/code&gt; table contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;profile images&lt;/li&gt;
&lt;li&gt;addresses&lt;/li&gt;
&lt;li&gt;preferences&lt;/li&gt;
&lt;li&gt;metadata&lt;/li&gt;
&lt;li&gt;timestamps&lt;/li&gt;
&lt;li&gt;large JSON fields&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you only need the user's name and email, fetching everything is unnecessary work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple rule:
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Fetch what you need, not everything available.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. Indexes Can Change Everything
&lt;/h2&gt;

&lt;p&gt;Imagine you have a table containing millions of users.&lt;/p&gt;

&lt;p&gt;You frequently search by email:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Without an appropriate index, the database may need to inspect a huge number of rows.&lt;/p&gt;

&lt;p&gt;An index can make this dramatically more efficient:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_users_email&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;strong&gt;Don't index every column.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Indexes also consume storage and add overhead when rows are inserted or updated.&lt;/p&gt;

&lt;p&gt;Index columns that you frequently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search&lt;/li&gt;
&lt;li&gt;filter&lt;/li&gt;
&lt;li&gt;sort&lt;/li&gt;
&lt;li&gt;join&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And verify your assumptions with query plans.&lt;/p&gt;

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

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

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Beware of the N+1 Query Problem
&lt;/h2&gt;

&lt;p&gt;This one can quietly destroy performance.&lt;/p&gt;

&lt;p&gt;Imagine you fetch 100 posts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get 100 posts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then your application separately asks the database for the author of each post:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get author 1
Get author 2
Get author 3
...
Get author 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you've potentially made:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;101 database queries.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of doing that, use a proper join or ORM relation loading strategy.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One query can often replace dozens or hundreds of database calls.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Don't Query the Same Data Repeatedly
&lt;/h2&gt;

&lt;p&gt;Sometimes the database isn't slow.&lt;/p&gt;

&lt;p&gt;We're just asking it the same question again and again.&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;If the data doesn't change frequently, caching can help.&lt;/p&gt;

&lt;p&gt;A simplified architecture might look like:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The application checks the cache first.&lt;/p&gt;

&lt;p&gt;If the data exists there, the database doesn't need to do the work again.&lt;/p&gt;

&lt;p&gt;Tools such as Redis are commonly used for this kind of caching.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Caching is not a replacement for fixing bad queries.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  5. Pagination Is Not Optional at Scale
&lt;/h2&gt;

&lt;p&gt;Imagine your API returns every user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That might work when you have 100 users.&lt;/p&gt;

&lt;p&gt;What happens when you have:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10 million users?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your database has to retrieve a massive amount of data, and your server then has to process and send it.&lt;/p&gt;

&lt;p&gt;Instead, paginate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="k"&gt;OFFSET&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Page 1 → 20 records
Page 2 → 20 records
Page 3 → 20 records
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For very large datasets, cursor-based pagination can be more efficient than large offsets.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Don't Optimize Blindly
&lt;/h2&gt;

&lt;p&gt;One of the biggest lessons in performance optimization:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't guess. Measure.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before changing your query, find out what the database is actually doing.&lt;/p&gt;

&lt;p&gt;Use tools such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;EXPLAIN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;EXPLAIN&lt;/span&gt; &lt;span class="k"&gt;ANALYZE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on your database.&lt;/p&gt;

&lt;p&gt;Look for things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full table scans&lt;/li&gt;
&lt;li&gt;Missing indexes&lt;/li&gt;
&lt;li&gt;Expensive joins&lt;/li&gt;
&lt;li&gt;Sorting large datasets&lt;/li&gt;
&lt;li&gt;Excessive rows being examined&lt;/li&gt;
&lt;li&gt;Slow execution time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optimization becomes much easier when you can see the actual problem.&lt;/p&gt;




&lt;h1&gt;
  
  
  A Simple Performance Checklist 🚀
&lt;/h1&gt;

&lt;p&gt;Before blaming your backend for a slow application, ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Am I fetching unnecessary columns?&lt;/li&gt;
&lt;li&gt;[ ] Do frequently searched columns have appropriate indexes?&lt;/li&gt;
&lt;li&gt;[ ] Am I accidentally creating N+1 queries?&lt;/li&gt;
&lt;li&gt;[ ] Am I making the same query repeatedly?&lt;/li&gt;
&lt;li&gt;[ ] Am I returning too many records?&lt;/li&gt;
&lt;li&gt;[ ] Do I need pagination?&lt;/li&gt;
&lt;li&gt;[ ] Have I checked the query execution plan?&lt;/li&gt;
&lt;li&gt;[ ] Am I optimizing based on measurements rather than assumptions?&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  The Bigger Lesson
&lt;/h1&gt;

&lt;p&gt;Database performance isn't always about buying a bigger server.&lt;/p&gt;

&lt;p&gt;Sometimes the biggest improvement comes from simply asking the database to do &lt;strong&gt;less work&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A query that takes 2 seconds might become 200ms.&lt;/p&gt;

&lt;p&gt;A query that runs 100 times might become one query.&lt;/p&gt;

&lt;p&gt;A response containing 50 unnecessary fields might become 5 useful ones.&lt;/p&gt;

&lt;p&gt;That's why database optimization often starts with a surprisingly simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Does the database really need to do all of this?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Before adding more infrastructure, check the query.&lt;/p&gt;

&lt;p&gt;You might already have enough power.&lt;/p&gt;

&lt;p&gt;You just might be using it inefficiently. ⚡&lt;/p&gt;




&lt;h2&gt;
  
  
  What database optimization trick has saved you the most performance?
&lt;/h2&gt;

&lt;p&gt;I'd love to hear what you've encountered in your own projects. 👇&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>showdev</category>
    </item>
    <item>
      <title>⚡ Stop Writing Code Immediately — Plan First, Code Faster</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Tue, 11 Aug 2026 13:42:53 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/stop-writing-code-immediately-plan-first-code-faster-1fm8</link>
      <guid>https://dev.to/ashitoshh01/stop-writing-code-immediately-plan-first-code-faster-1fm8</guid>
      <description>&lt;p&gt;One of the biggest mistakes I made as a developer was thinking that &lt;strong&gt;good developers code faster.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They don't necessarily code faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;They spend less time coding the wrong thing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When I first started building projects, my approach was pretty simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Open VS Code → Start coding → Get stuck → Search Google → Change things → Break something else → Rewrite it 😭&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And honestly, this works... until your projects become bigger.&lt;/p&gt;

&lt;p&gt;That's when I realized something important:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before writing code, I should spend some time understanding what I'm actually building.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Step 1: Understand the Problem
&lt;/h2&gt;

&lt;p&gt;Before touching the keyboard, ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What exactly am I trying to build?&lt;/li&gt;
&lt;li&gt;Who is going to use it?&lt;/li&gt;
&lt;li&gt;What should happen when the user performs an action?&lt;/li&gt;
&lt;li&gt;What data do I need?&lt;/li&gt;
&lt;li&gt;What should the final result look like?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It sounds obvious.&lt;/p&gt;

&lt;p&gt;But skipping this step can lead to writing a lot of code for the wrong problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧩 Step 2: Break It Into Smaller Problems
&lt;/h2&gt;

&lt;p&gt;Instead of thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I need to build a messaging system."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Break it down:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Messaging System
│
├── Authentication
├── Conversations
├── Sending Messages
├── Receiving Messages
├── Message Storage
├── File Uploads
├── Notifications
└── Error Handling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suddenly, the huge problem becomes a collection of smaller problems.&lt;/p&gt;

&lt;p&gt;And smaller problems are much easier to solve.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚠️ Step 3: Think About Edge Cases
&lt;/h2&gt;

&lt;p&gt;Don't only think about the &lt;strong&gt;happy path&lt;/strong&gt;.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User sends message
        ↓
      Works ✅
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's great.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No internet connection?
Empty message?
Server error?
User logged out?
Database unavailable?
Message too large?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thinking about these cases &lt;strong&gt;before coding&lt;/strong&gt; can save you from a lot of debugging later.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Step 4: Choose the Simplest Solution
&lt;/h2&gt;

&lt;p&gt;Developers love building complicated things.&lt;/p&gt;

&lt;p&gt;Sometimes unnecessarily complicated things. 😂&lt;/p&gt;

&lt;p&gt;Before implementing something, ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Is there a simpler way to solve this?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You don't always need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;another library&lt;/li&gt;
&lt;li&gt;another abstraction&lt;/li&gt;
&lt;li&gt;another database&lt;/li&gt;
&lt;li&gt;another design pattern&lt;/li&gt;
&lt;li&gt;500 lines of code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sometimes the simplest solution is the best solution.&lt;/p&gt;




&lt;h2&gt;
  
  
  💻 Step 5: Then Start Coding
&lt;/h2&gt;

&lt;p&gt;Now open VS Code.&lt;/p&gt;

&lt;p&gt;At this point, you aren't blindly writing code.&lt;/p&gt;

&lt;p&gt;You already know:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What → Why → How → Edge cases&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So the coding process becomes much more focused.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Code → Problem → Rewrite → Problem → Rewrite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you move closer to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Understand
    ↓
Plan
    ↓
Build
    ↓
Test
    ↓
Improve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 The Biggest Lesson
&lt;/h2&gt;

&lt;p&gt;Planning doesn't mean spending hours designing everything before writing a single line of code.&lt;/p&gt;

&lt;p&gt;Sometimes &lt;strong&gt;5–10 minutes of thinking can save an hour of coding.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The goal isn't to predict every possible problem.&lt;/p&gt;

&lt;p&gt;The goal is to &lt;strong&gt;reduce uncertainty before you start.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because being a good developer isn't just about knowing how to write code.&lt;/p&gt;

&lt;p&gt;It's also about knowing:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What code actually needs to be written.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  💭 What about you?
&lt;/h3&gt;

&lt;p&gt;Do you usually:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; Start coding immediately and figure things out along the way?&lt;/p&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B)&lt;/strong&gt; Plan everything first and then start coding?&lt;/p&gt;

&lt;p&gt;I'm somewhere in between — and I'm slowly learning that &lt;strong&gt;a little planning saves a LOT of debugging.&lt;/strong&gt; 😭&lt;/p&gt;

</description>
      <category>programming</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>थाळी — An Interactive Thali, Built Entirely in CSS</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Mon, 10 Aug 2026 22:14:14 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/thaalii-an-interactive-thali-built-entirely-in-css-21cl</link>
      <guid>https://dev.to/ashitoshh01/thaalii-an-interactive-thali-built-entirely-in-css-21cl</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/frontend-2026-07-29"&gt;Frontend Challenge - Comfort Food Edition, CSS Art&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspiration
&lt;/h2&gt;

&lt;p&gt;I'm Maharashtrian, and in our homes food never really arrives one dish at a time, it arrives as a थाळी. A steel plate, rice in the center, a ring of vaatis around it holding varan, bhaji, koshimbir, amti, a curl of lonche on the side, and always something to drink alongside — a glass of taak or lassi. That's what "comfort food" has always meant to me. Not one hero ingredient on a plate, but the whole spread landing in front of you at once, still steaming.&lt;/p&gt;

&lt;p&gt;So when this challenge said "comfort food," I didn't want to draw one bowl of something. I wanted to draw the &lt;em&gt;entire thali&lt;/em&gt; — the way it actually lands on the table at home — and build it purely out of CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/editor/Ashitosh-Lavhate/embed/019fedb1-38a8-70c7-be2a-87dbeabb809e?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Hover over any dish for a quick description of what's in it, and try dragging one item onto another — they'll swap places on the plate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;Every piece of this — the brushed-gold steel plate, the katoris, the rice mound, the naan on its banana leaf, the lassi tumbler — is built from gradients, box-shadows, and clip-paths. No images anywhere. A few techniques I leaned on a lot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Layered &lt;code&gt;conic-gradient&lt;/code&gt; + &lt;code&gt;radial-gradient&lt;/code&gt;&lt;/strong&gt; for the brushed metal look of the plate and steel bowls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stacked &lt;code&gt;box-shadow&lt;/code&gt; values&lt;/strong&gt; as a cheap way to scatter garnish — cilantro flecks, chili flakes, pistachio bits — without extra markup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;clip-path&lt;/code&gt;&lt;/strong&gt; for the tapered lassi tumbler and its ridged, fluted sides&lt;/li&gt;
&lt;li&gt;Irregular &lt;code&gt;border-radius&lt;/code&gt; values (different on every corner) so the rice mound and naan feel hand-shaped instead of like perfect circles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The one feature that pushed past "pure CSS" was letting people &lt;strong&gt;drag a dish and drop it on another to swap their places&lt;/strong&gt;, with a smooth spring-like transition. The contest rules allow a light sprinkle of JS for CSS Art as long as the visuals stay CSS-driven, so I used Pointer Events just to track drag position and swap two items' coordinates — nothing about how the dishes actually &lt;em&gt;look&lt;/em&gt; comes from JS.&lt;/p&gt;

&lt;p&gt;The best bug of the whole build: after wiring up hover tooltips and drag, &lt;em&gt;nothing&lt;/em&gt; responded — no hover cards, no dragging. Turned out a decorative etched-rim pattern on the plate, built as a &lt;code&gt;::after&lt;/code&gt; pseudo-element and masked down to a thin ring, was still sitting on top of everything in paint order. CSS &lt;code&gt;mask&lt;/code&gt; makes pixels transparent, but it doesn't stop an element from intercepting clicks — so an "invisible" ring was quietly blocking every dish underneath it. One &lt;code&gt;pointer-events: none&lt;/code&gt; later, everything came alive.&lt;/p&gt;

&lt;p&gt;This one felt personal to build. Thanks for putting this challenge together! 🍛&lt;/p&gt;

</description>
      <category>frontendchallenge</category>
      <category>devchallenge</category>
      <category>css</category>
    </item>
    <item>
      <title>The Bug Wasn't in My Code --- It Was in My Assumptions 🤯</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Mon, 10 Aug 2026 21:10:10 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/the-bug-wasnt-in-my-code-it-was-in-my-assumptions-5bbb</link>
      <guid>https://dev.to/ashitoshh01/the-bug-wasnt-in-my-code-it-was-in-my-assumptions-5bbb</guid>
      <description>&lt;p&gt;We've all been there.&lt;/p&gt;

&lt;p&gt;The code &lt;em&gt;looks&lt;/em&gt; correct.&lt;/p&gt;

&lt;p&gt;No obvious syntax errors.&lt;br&gt;
The logic seems fine.&lt;br&gt;
You read the same function 10 times.&lt;/p&gt;

&lt;p&gt;And somehow...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It still doesn't work.&lt;/strong&gt; 😭&lt;/p&gt;

&lt;p&gt;After wasting way too much time debugging situations like this, I&lt;br&gt;
realized something:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Sometimes the bug isn't in your code. It's in what you &lt;em&gt;assumed&lt;/em&gt; about&lt;br&gt;
your code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  The classic debugging trap
&lt;/h2&gt;

&lt;p&gt;Imagine you're calling an API and expecting this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ash"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So naturally, you write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything looks perfectly reasonable.&lt;/p&gt;

&lt;p&gt;But the actual response is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ash"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you're staring at your JavaScript wondering:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Why is &lt;code&gt;user&lt;/code&gt; undefined?!"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The JavaScript isn't necessarily the problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your assumption about the API response was.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  This happens everywhere
&lt;/h2&gt;

&lt;p&gt;It's not just API responses.&lt;/p&gt;

&lt;p&gt;You can make incorrect assumptions about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  What data a function receives&lt;/li&gt;
&lt;li&gt;  Whether a value can be &lt;code&gt;null&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  What an API actually returns&lt;/li&gt;
&lt;li&gt;  Environment variables being available&lt;/li&gt;
&lt;li&gt;  File paths&lt;/li&gt;
&lt;li&gt;  Database records&lt;/li&gt;
&lt;li&gt;  Authentication state&lt;/li&gt;
&lt;li&gt;  Time zones&lt;/li&gt;
&lt;li&gt;  User input&lt;/li&gt;
&lt;li&gt;  Production vs development environments&lt;/li&gt;
&lt;li&gt;  What a third-party library actually does&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And these assumptions can create some seriously confusing bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  My new debugging approach
&lt;/h2&gt;

&lt;p&gt;Instead of immediately changing the code, I try to verify my assumptions&lt;br&gt;
first.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. What do I &lt;em&gt;think&lt;/em&gt; is happening?
&lt;/h3&gt;

&lt;p&gt;Write down your assumption.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;"The API is returning the user object."&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  2. What is &lt;em&gt;actually&lt;/em&gt; happening?
&lt;/h3&gt;

&lt;p&gt;Inspect the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't guess.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Look at it.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Where does reality differ from my assumption?
&lt;/h3&gt;

&lt;p&gt;Maybe the API response changed.&lt;/p&gt;

&lt;p&gt;Maybe the value is &lt;code&gt;undefined&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Maybe the environment variable isn't loaded.&lt;/p&gt;

&lt;p&gt;Maybe the backend is returning an error that the frontend isn't&lt;br&gt;
handling.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. Fix the actual problem
&lt;/h3&gt;

&lt;p&gt;Only after understanding the mismatch should you change the code.&lt;/p&gt;

&lt;p&gt;This saves a surprising amount of time.&lt;/p&gt;
&lt;h2&gt;
  
  
  The debugging rule I now follow
&lt;/h2&gt;

&lt;p&gt;When something doesn't make sense, I ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"What am I assuming right now that I haven't verified?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question is surprisingly powerful.&lt;/p&gt;

&lt;p&gt;Because debugging isn't always about finding the broken line.&lt;/p&gt;

&lt;p&gt;Sometimes it's about finding the &lt;strong&gt;wrong mental model&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  A simple debugging checklist
&lt;/h2&gt;

&lt;p&gt;Next time you're stuck, check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;☐ What input am I actually receiving?
☐ What output am I actually getting?
☐ Did I verify the API response?
☐ Could this value be undefined/null?
☐ Are my environment variables loaded?
☐ Am I testing the same environment as production?
☐ Did the data structure change?
☐ Am I assuming something instead of checking it?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final takeaway
&lt;/h2&gt;

&lt;p&gt;Good debugging isn't just:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Find the broken code."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Find the difference between what I expected and what is actually&lt;br&gt;
happening."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you start debugging your &lt;strong&gt;assumptions&lt;/strong&gt;, some of those&lt;br&gt;
"impossible" bugs become surprisingly easy to solve.&lt;/p&gt;

&lt;p&gt;And honestly...&lt;/p&gt;

&lt;p&gt;Sometimes the most useful debugging tool isn't another &lt;code&gt;console.log&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It's asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Wait... how do I know that's actually true?"&lt;/strong&gt; 👀&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  What about you?
&lt;/h3&gt;

&lt;p&gt;What's a bug that took you way too long to fix because you were making&lt;br&gt;
the wrong assumption?&lt;/p&gt;

&lt;p&gt;Drop it in the comments 👇&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>Before You Add Another npm Package, Ask Yourself These 5 Questions</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Sun, 09 Aug 2026 04:18:35 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/before-you-add-another-npm-package-ask-yourself-these-5-questions-2mbe</link>
      <guid>https://dev.to/ashitoshh01/before-you-add-another-npm-package-ask-yourself-these-5-questions-2mbe</guid>
      <description>&lt;h2&gt;
  
  
  Installing an npm package takes a few seconds.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;some-package
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's exactly why it's so easy to overuse them.&lt;/p&gt;

&lt;p&gt;Need a date formatter? Install one.&lt;/p&gt;

&lt;p&gt;Need a UUID? Install one.&lt;/p&gt;

&lt;p&gt;Need to validate an email? Install one.&lt;/p&gt;

&lt;p&gt;Need to check if an array contains something? 😭&lt;/p&gt;

&lt;p&gt;There's probably a package for that too.&lt;/p&gt;

&lt;p&gt;But every dependency you add becomes part of your project.&lt;/p&gt;

&lt;p&gt;So before running &lt;code&gt;npm install&lt;/code&gt;, I started asking myself five questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Do I actually need a package?
&lt;/h2&gt;

&lt;p&gt;This is the first question.&lt;/p&gt;

&lt;p&gt;Sometimes the functionality you need is already available in JavaScript.&lt;/p&gt;

&lt;p&gt;For example, you don't need a package just to remove duplicates from an array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;unique&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or to check whether an array contains a value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The point isn't:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Never use packages."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The point is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't add a dependency just because it saves you three lines of code.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If a package solves a genuinely complex problem, absolutely use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Is the package actively maintained?
&lt;/h2&gt;

&lt;p&gt;Before installing something, check its repository.&lt;/p&gt;

&lt;p&gt;Look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Last release&lt;/li&gt;
&lt;li&gt;Open issues&lt;/li&gt;
&lt;li&gt;Pull requests&lt;/li&gt;
&lt;li&gt;Recent commits&lt;/li&gt;
&lt;li&gt;Number of maintainers&lt;/li&gt;
&lt;li&gt;Documentation&lt;/li&gt;
&lt;li&gt;Compatibility with your version of Node.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A package with millions of downloads isn't automatically a good package.&lt;/p&gt;

&lt;p&gt;What matters is whether the project is healthy enough for your use case.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. How many dependencies does it bring with it?
&lt;/h2&gt;

&lt;p&gt;You install one package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;package-a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But that package might depend on dozens of other packages.&lt;/p&gt;

&lt;p&gt;Your dependency tree can quickly become:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your-app
 └── package-a
      ├── package-b
      │    ├── package-c
      │    └── package-d
      ├── package-e
      └── package-f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're not only trusting &lt;code&gt;package-a&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You're also trusting the ecosystem underneath it.&lt;/p&gt;

&lt;p&gt;You can inspect your dependency tree with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. What does this dependency cost my project?
&lt;/h2&gt;

&lt;p&gt;"Cost" doesn't only mean money.&lt;/p&gt;

&lt;p&gt;A dependency can cost you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bundle size&lt;/strong&gt; — especially important for frontend applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt; — some libraries do far more work than you actually need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; — every dependency is another piece of third-party code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance&lt;/strong&gt; — packages can become deprecated or abandoned.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complexity&lt;/strong&gt; — a tiny utility shouldn't require an entire library.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Does this package work?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Is this package worth having in my project?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  5. Can I remove it later?
&lt;/h2&gt;

&lt;p&gt;This is probably the question developers ask the least.&lt;/p&gt;

&lt;p&gt;Imagine your project has 80 dependencies.&lt;/p&gt;

&lt;p&gt;Then one day you realize that five of them are only being used for tiny utility functions.&lt;/p&gt;

&lt;p&gt;Removing them can become surprisingly difficult because you have to figure out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where they're used&lt;/li&gt;
&lt;li&gt;Whether they're used indirectly&lt;/li&gt;
&lt;li&gt;What breaks after removal&lt;/li&gt;
&lt;li&gt;Whether another package depends on them&lt;/li&gt;
&lt;li&gt;Whether the replacement changes behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A dependency is easiest to remove when you never needed it in the first place.&lt;/p&gt;

&lt;h1&gt;
  
  
  A Simple Rule I Follow
&lt;/h1&gt;

&lt;p&gt;Before installing a package, I try this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Can JavaScript already do this?
        ↓
      YES → Use native JavaScript
        ↓
       NO
        ↓
Is the problem complex enough to justify a dependency?
        ↓
      YES
        ↓
Is the package maintained and trustworthy?
        ↓
      YES
        ↓
Check size + dependencies + license
        ↓
      Install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This doesn't mean you should reinvent everything.&lt;/p&gt;

&lt;p&gt;If you're building authentication, payments, database access, validation, image processing, or other complex functionality, established libraries can save enormous amounts of time.&lt;/p&gt;

&lt;p&gt;The goal is simply to &lt;strong&gt;make dependencies intentional&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  The &lt;code&gt;npm install&lt;/code&gt; Reflex
&lt;/h1&gt;

&lt;p&gt;One thing I've noticed while building projects is how easy it is to develop an &lt;code&gt;npm install&lt;/code&gt; reflex.&lt;/p&gt;

&lt;p&gt;You encounter a problem.&lt;/p&gt;

&lt;p&gt;You search Google.&lt;/p&gt;

&lt;p&gt;You find a package.&lt;/p&gt;

&lt;p&gt;You install it.&lt;/p&gt;

&lt;p&gt;Problem solved.&lt;/p&gt;

&lt;p&gt;But sometimes the better engineering decision is to stop for 30 seconds and ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Do I really want this dependency in my project?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That 30-second decision can save you hours of maintenance later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;Dependencies are not bad.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unnecessary dependencies are.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use packages when they provide real value.&lt;/p&gt;

&lt;p&gt;But don't turn every small problem into another entry in &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Your future self — the one debugging the project six months from now — will probably thank you. 😭&lt;/p&gt;




&lt;h3&gt;
  
  
  What's one npm package you can't live without?
&lt;/h3&gt;

&lt;p&gt;Drop it in the comments. I'm curious what everyone is using. 👇&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I Deployed My Backend to Render… and Then Everything Broke 💀</title>
      <dc:creator>Ashitosh Lavhate</dc:creator>
      <pubDate>Sat, 08 Aug 2026 03:02:28 +0000</pubDate>
      <link>https://dev.to/ashitoshh01/i-deployed-my-backend-to-render-and-then-everything-broke-i0o</link>
      <guid>https://dev.to/ashitoshh01/i-deployed-my-backend-to-render-and-then-everything-broke-i0o</guid>
      <description>&lt;h1&gt;
  
  
  I Deployed My Django App to Render… and Then Everything Broke 💀
&lt;/h1&gt;

&lt;p&gt;Deploying an application sounds simple.&lt;/p&gt;

&lt;p&gt;Push the code.&lt;br&gt;&lt;br&gt;
Configure the service.&lt;br&gt;&lt;br&gt;
Deploy it.&lt;br&gt;&lt;br&gt;
Done.&lt;/p&gt;

&lt;p&gt;Yeah… not exactly. 💀&lt;/p&gt;

&lt;p&gt;I recently deployed one of my Django applications to Render, and the deployment itself looked successful.&lt;/p&gt;

&lt;p&gt;The service was live.&lt;/p&gt;

&lt;p&gt;Gunicorn started.&lt;/p&gt;

&lt;p&gt;Render gave me a live URL.&lt;/p&gt;

&lt;p&gt;But when I actually opened the application and started making requests…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;500 Internal Server Errors.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And that's where the real debugging started.&lt;/p&gt;


&lt;h2&gt;
  
  
  🚀 Deploying the Application to Render
&lt;/h2&gt;

&lt;p&gt;My application had a frontend and a Django backend.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
  ↓
Frontend
  ↓
Django Backend
  ↓
Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything was working correctly on my local machine.&lt;/p&gt;

&lt;p&gt;So I connected the repository to Render and configured the deployment.&lt;/p&gt;

&lt;p&gt;The build completed successfully, and the server started with Gunicorn.&lt;/p&gt;

&lt;p&gt;Render even showed the service as live.&lt;/p&gt;

&lt;p&gt;At this point, I thought:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Okay, we're done."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I was very wrong. 😭&lt;/p&gt;




&lt;h2&gt;
  
  
  💥 The Actual Problem Started After Deployment
&lt;/h2&gt;

&lt;p&gt;Once the application was live, I started seeing requests returning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;500 Internal Server Error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There were also other requests returning &lt;code&gt;400&lt;/code&gt; errors.&lt;/p&gt;

&lt;p&gt;The important part was that the deployment itself wasn't necessarily failing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The application was running, but the application was failing when handling requests.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That distinction was important.&lt;/p&gt;

&lt;p&gt;Instead of immediately changing random code, I went back to the Render logs.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 The Render Logs Were the First Place I Looked
&lt;/h2&gt;

&lt;p&gt;The logs showed that Gunicorn was starting successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gunicorn starting
Listening for requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the server process itself was alive.&lt;/p&gt;

&lt;p&gt;But then requests started showing errors like:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This made me realize something:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A deployment being marked as "Live" doesn't mean every part of the application is working correctly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The next step was to find out &lt;strong&gt;why the requests were failing&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  📁 Then I Found a Frontend Build Problem
&lt;/h2&gt;

&lt;p&gt;One of the warnings in the logs was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No directory at: /opt/render/project/src/frontend/dist/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This immediately caught my attention.&lt;/p&gt;

&lt;p&gt;My project did have a &lt;code&gt;frontend&lt;/code&gt; directory in the repository.&lt;/p&gt;

&lt;p&gt;So I initially thought:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"But the folder exists. Why is Render saying it doesn't?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And that's where deployment environments become interesting.&lt;/p&gt;

&lt;p&gt;Having the source directory in your repository doesn't necessarily mean the &lt;strong&gt;production build output&lt;/strong&gt; exists at the exact path your backend expects.&lt;/p&gt;

&lt;p&gt;The backend was expecting:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;But that directory wasn't available in the deployed environment at runtime.&lt;/p&gt;

&lt;p&gt;So I had to look at the actual build process.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧩 Source Code vs Build Output
&lt;/h2&gt;

&lt;p&gt;This was an important distinction for me.&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;in your repository is one thing.&lt;strong&gt;The application was running, but the application was failing when handling requests.&lt;/strong&gt;&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;after the production build is another.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project
├── frontend/
│   ├── src/
│   ├── package.json
│   └── ...
│
└── backend/
    ├── manage.py
    └── ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;doesn't automatically mean:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;will exist.&lt;/p&gt;

&lt;p&gt;The build process has to actually generate it.&lt;/p&gt;

&lt;p&gt;That means your deployment configuration needs to make sure the frontend build happens before Django tries to serve those files.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ The Build Command Matters
&lt;/h2&gt;

&lt;p&gt;This made me look much more carefully at the Render build command.&lt;/p&gt;

&lt;p&gt;A deployment isn't simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push → Render → done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There can be multiple steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install dependencies
        ↓
Build frontend
        ↓
Collect/build backend assets
        ↓
Start application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If one of those steps is missing, the application can start successfully but still fail later.&lt;/p&gt;

&lt;p&gt;That's exactly the kind of problem that is easy to miss when everything works locally.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔐 Environment Variables Were Another Important Part
&lt;/h2&gt;

&lt;p&gt;Production also has a completely different environment from my local machine.&lt;/p&gt;

&lt;p&gt;Locally, Django might be using values from my &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;On Render, those values need to be configured as environment variables in the service.&lt;/p&gt;

&lt;p&gt;Things such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SECRET_KEY=...
DATABASE_URL=...
ALLOWED_HOSTS=...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;need to be correctly configured for production.&lt;/p&gt;

&lt;p&gt;For example, Django needs to know which hosts are allowed to access the application.&lt;/p&gt;

&lt;p&gt;So configuration is just as important as the code itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 The "Works on My Machine" Problem
&lt;/h2&gt;

&lt;p&gt;This deployment taught me why developers joke about:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"But it works on my machine." 😂&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because technically, it did.&lt;/p&gt;

&lt;p&gt;My local environment had:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The dependencies&lt;/li&gt;
&lt;li&gt;The environment variables&lt;/li&gt;
&lt;li&gt;The generated files&lt;/li&gt;
&lt;li&gt;The local database configuration&lt;/li&gt;
&lt;li&gt;The expected directory structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Production was different.&lt;/p&gt;

&lt;p&gt;The server had to build the application from scratch and use only what I explicitly configured.&lt;/p&gt;

&lt;p&gt;So a better mental model is:&lt;br&gt;
&lt;/p&gt;

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

Code
 ↓
Dependencies
 ↓
Environment
 ↓
Application


PRODUCTION

Repository
 ↓
Build commands
 ↓
Environment variables
 ↓
Generated files
 ↓
Server
 ↓
Actual requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every step can introduce a new failure.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ How I Started Debugging It
&lt;/h2&gt;

&lt;p&gt;Instead of randomly changing things, I started checking the deployment layer by layer.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Check whether the service starts
&lt;/h3&gt;

&lt;p&gt;If Gunicorn isn't starting, the problem is with the application startup.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Check the Render build logs
&lt;/h3&gt;

&lt;p&gt;Look for failed commands, missing packages, or missing build output.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Check the runtime logs
&lt;/h3&gt;

&lt;p&gt;A service can start successfully while requests still return &lt;code&gt;500&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Check generated files
&lt;/h3&gt;

&lt;p&gt;If Django expects:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;make sure the deployment actually creates it.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Check environment variables
&lt;/h3&gt;

&lt;p&gt;Make sure production variables are present and correct.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Check Django configuration
&lt;/h3&gt;

&lt;p&gt;Things like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ALLOWED_HOSTS&lt;/span&gt;
&lt;span class="n"&gt;DATABASE_URL&lt;/span&gt;
&lt;span class="n"&gt;SECRET_KEY&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;need to work in production.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Test the backend directly
&lt;/h3&gt;

&lt;p&gt;Don't only look at the frontend.&lt;/p&gt;

&lt;p&gt;Test the API itself and identify exactly which request is failing.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 The Biggest Lesson
&lt;/h2&gt;

&lt;p&gt;The biggest lesson I got from this wasn't:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How to deploy Django to Render."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It was:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Deployment is another environment that your application has to work in.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your local machine can hide a lot of assumptions.&lt;/p&gt;

&lt;p&gt;Production exposes them.&lt;/p&gt;

&lt;p&gt;A missing environment variable.&lt;/p&gt;

&lt;p&gt;A wrong file path.&lt;/p&gt;

&lt;p&gt;A frontend that wasn't built.&lt;/p&gt;

&lt;p&gt;A database configuration that doesn't exist.&lt;/p&gt;

&lt;p&gt;A host that isn't allowed.&lt;/p&gt;

&lt;p&gt;All of these can turn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Works perfectly locally
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;500 Internal Server Error 💀
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 What I Would Do Differently Next Time
&lt;/h2&gt;

&lt;p&gt;Before deploying another application, I would check these things first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;☑ Build command
☑ Start command
☑ Environment variables
☑ Database configuration
☑ Generated frontend files
☑ Static files
☑ Allowed hosts
☑ Production logs
☑ API endpoints
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most importantly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I won't consider a deployment finished just because the service says "Live".&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'll actually test the application.&lt;/p&gt;




&lt;h2&gt;
  
  
  👨‍💻 Final Thought
&lt;/h2&gt;

&lt;p&gt;One of the best ways to learn development is to actually deploy the things you build.&lt;/p&gt;

&lt;p&gt;Because locally, everything can look perfect.&lt;/p&gt;

&lt;p&gt;Then production comes along and says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Let's see about that." 💀&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And suddenly you're reading logs, checking environment variables, tracing file paths, and learning things you never had to think about before.&lt;/p&gt;

&lt;p&gt;But that's exactly where the learning happens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build → Deploy → Break → Debug → Learn → Repeat.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And honestly?&lt;/p&gt;

&lt;p&gt;I'm starting to think the broken deployments teach me more than the successful ones. 🚀&lt;/p&gt;




&lt;p&gt;Have you ever had an application that worked perfectly locally but broke immediately after deployment?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What was the problem?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Drop it in the comments — I want to know I'm not the only one. 😂&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>deployment</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
