<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vinodyatharuki on Medium]]></title>
        <description><![CDATA[Stories by Vinodyatharuki on Medium]]></description>
        <link>https://medium.com/@vinodyatharuki?source=rss-a4e8bb5f48cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pM91i0z5y8BcGZv_</url>
            <title>Stories by Vinodyatharuki on Medium</title>
            <link>https://medium.com/@vinodyatharuki?source=rss-a4e8bb5f48cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:38:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vinodyatharuki/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Git Was Confusing Until I Understood These 5 Ideas]]></title>
            <link>https://medium.com/@vinodyatharuki/git-was-confusing-until-i-understood-these-5-ideas-9042ac9a3fa7?source=rss-a4e8bb5f48cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9042ac9a3fa7</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vinodyatharuki]]></dc:creator>
            <pubDate>Fri, 04 Sep 2026 15:09:07 GMT</pubDate>
            <atom:updated>2026-09-04T15:09:07.667Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RsUId_1pVNtNSKziuqq77w.png" /></figure><h3>A beginner-friendly way to understand working directories, staging, commits, branches, merge conflicts, and remote repositories</h3><p>When I first started using Git, I mostly memorized commands.</p><pre>git add .<br>git commit -m &quot;update&quot;<br>git push</pre><p>Sometimes they worked perfectly.</p><p>Sometimes Git gave me an error I didn’t understand.</p><p>And sometimes I had no idea whether my code was saved, committed, pushed, or somehow about to disappear. 😅</p><p>For a while, I thought I just needed to memorize more Git commands.But that wasn’t really the problem.</p><p><strong>The problem was that I didn’t understand what Git was actually doing.</strong></p><p>Once I understood a few core ideas, commands like git add, git commit, git branch, git merge, and git push finally started to make sense.</p><p>Here are the five ideas that changed the way I understand Git.</p><h3>1. Your Working Directory Is Just Your Current Work</h3><p>Let’s start with the simplest part.</p><p>Your <strong>working directory</strong> is basically the project you currently have open and are editing.</p><p>Imagine my project looks like this:</p><pre>project/<br>├── index.html<br>├── app.js<br>└── style.css</pre><p>Now I open app.js and change some code. Git can detect that app.js is different from the last committed version.</p><p>But here’s the important part:</p><p><strong>Changing a file does not automatically create a new version in Git.</strong></p><p>I’ve simply changed a file in my working directory. I like to think of it as:</p><pre>Working Directory<br>       =<br>What I&#39;m currently working on</pre><p>Whenever I’m unsure about what’s happening in my repository, one of the first commands I use is:</p><pre>git status</pre><p>It tells me which files have changed, which files are staged, and what Git currently knows about my work.</p><p>Understanding this made git status one of the most useful Git commands for me.</p><h3>2. Staging Means “Put This in My Next Commit”</h3><p>This was probably one of the most confusing Git concepts for me as a beginner.</p><p>Why do we run:</p><pre>git add .</pre><p>and then:</p><pre>git commit -m &quot;message&quot;</pre><p>Why can’t Git just commit my changes directly? The answer is the <strong>staging area</strong>. The staging area is like a preparation area for your next commit.</p><p>Suppose I changed three files:</p><pre>app.js<br>style.css<br>README.md</pre><p>But my changes to README.md aren&#39;t finished yet. I don’t have to commit everything.</p><p>I can stage only:</p><pre>git add app.js<br>git add style.css</pre><p>Now I’m basically telling Git:</p><blockquote><strong><em>“These are the changes I want to include in my next commit.”</em></strong></blockquote><p>The flow becomes:</p><pre>Working Directory<br>       ↓<br>    git add<br>       ↓<br>  Staging Area<br>       ↓<br>   git commit<br>       ↓<br> Commit History</pre><p>This was the moment git add finally made sense to me.</p><p>It’s not really about “adding files to Git” every single time.</p><p>It’s about <strong>choosing what goes into the next commit</strong>.</p><h3>3. A Commit Is a Checkpoint, Not the Same as a Push</h3><p>Another thing that confused me was the difference between:</p><pre>git commit</pre><p>and:</p><pre>git push</pre><p>I used to think they were almost the same thing. They’re not. A <strong>commit</strong> creates a checkpoint in your <strong>local Git repository</strong>.</p><p>For example:</p><pre>git commit -m &quot;Add login form validation&quot;</pre><p>Git records the staged changes as a new point in the project’s history. You can imagine your history like this:</p><pre>Initial project<br>      ↓<br>Add login page<br>      ↓<br>Add form validation<br>      ↓<br>Fix login error</pre><p>Each of those can be a commit. And good commit messages make this history much easier to understand.</p><p>Instead of:</p><pre>git commit -m &quot;update&quot;</pre><p>I now prefer something meaningful like:</p><pre>git commit -m &quot;Add product search filter&quot;</pre><p>or:</p><pre>git commit -m &quot;Fix mobile navigation issue&quot;</pre><p>But here’s the important part:</p><p><strong>A commit can still exist only on my computer.</strong></p><p>That’s where git push comes in.</p><pre>git commit<br>     ↓<br>Saves a checkpoint locally</pre><pre>git push<br>     ↓<br>Sends local commits to a remote repository</pre><p>This distinction cleared up a lot of my early confusion.</p><h3>4. Branches Let Us Work Without Breaking Everything Else</h3><p>Branches started making much more sense when I began working on larger and group projects. Imagine our project has a development branch:</p><pre>dev</pre><p>I need to build a shopping cart feature. Instead of directly changing dev, I can create my own branch:</p><pre>git checkout -b feature/cart</pre><p>Now I can work on the cart without immediately affecting the code other developers are using. Another developer might be working on authentication:</p><pre>feature/auth</pre><p>while someone else works on the profile:</p><pre>feature/profile</pre><p>So our project might look conceptually like this:</p><pre>feature/cart<br>                /<br>main ─── dev ──┼── feature/auth<br>                \<br>                 feature/profile</pre><p>Everyone can work on different features while still being part of the same project. When my cart feature is ready, it can be merged back into dev.</p><p>For example:</p><pre>git checkout dev<br>git pull origin dev<br>git merge feature/cart<br>git push origin dev</pre><p>The important idea here is that I first switch to the branch that should <strong>receive</strong> the changes.</p><p>In this example:</p><pre>feature/cart<br>      │<br>      │ merge<br>      ↓<br>     dev</pre><p>In many team projects, we don’t directly merge into dev ourselves.</p><p>Instead, we push the feature branch:</p><pre>git push origin feature/cart</pre><p>and create a <strong>Pull Request</strong> to merge:</p><pre>feature/cart<br>      ↓<br> Pull Request<br>      ↓<br>Code Review<br>      ↓<br>     dev</pre><p>This allows teammates to review the changes before they become part of the shared development branch.</p><p>A common team workflow might look like:</p><pre>Feature Branches<br>       ↓<br>      dev<br>       ↓<br>Integration &amp; Testing<br>       ↓<br>      main</pre><p>Once I understood branches as <strong>separate lines of development</strong>, they stopped feeling mysterious.</p><h3>5. Merge Conflicts Aren’t Git Breaking Your Code</h3><p>Then comes the part almost every beginner is afraid of:</p><p><strong>Merge conflicts.</strong> 😭</p><p>The first time I saw something like this:</p><pre>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD<br>const title = &quot;Welcome&quot;;<br>=======<br>const title = &quot;Hello&quot;;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; feature/home</pre><p>I thought I had completely broken the project. But a merge conflict doesn’t mean Git is broken.</p><p>It usually means Git found <strong>two different changes and doesn’t know which one you want to keep</strong>.</p><p>For example, imagine I change:</p><pre>const buttonText = &quot;Add to Cart&quot;;</pre><p>to:</p><pre>const buttonText = &quot;Add Product&quot;;</pre><p>Meanwhile, another developer changes the same line to:</p><pre>const buttonText = &quot;Add Item&quot;;</pre><p>When Git tries to combine both versions, it can’t confidently decide which one is correct. So instead of guessing, Git asks <strong>us</strong>.</p><p>That’s a merge conflict. Conceptually:</p><pre>My version<br>      \<br>       → Same part of file → CONFLICT<br>      /<br>Their version</pre><p>I then decide what the final code should be, remove the conflict markers, save the file, and stage the resolved version.</p><p>For example:</p><pre>git add app.js<br>git commit -m &quot;Resolve merge conflict&quot;</pre><p>The exact steps can vary depending on the merge/rebase workflow, but the important lesson is:</p><blockquote><strong><em>A merge conflict isn’t necessarily an error. It’s Git asking for a human decision.</em></strong></blockquote><p>That changed how I felt about conflicts completely.</p><h3>Where Does GitHub Fit Into All This?</h3><p>There was one more thing I had to understand.</p><p><strong>Git and GitHub are not the same thing.</strong></p><p>Git is the version-control system managing the history of my project. GitHub is one service that can host a <strong>remote Git repository</strong>.</p><p>My computer can have:</p><pre>Local Repository</pre><p>while GitHub has:</p><pre>Remote Repository</pre><p>Commands like:</p><pre>git push</pre><p>send my commits to the remote repository.</p><p>And:</p><pre>git pull</pre><p>brings remote changes into my local work.</p><p>So a simplified picture is:</p><pre>My Computer                    Remote Repository</pre><pre>Working Directory<br>       ↓<br>   git add<br>       ↓<br>Staging Area<br>       ↓<br>  git commit<br>       ↓<br>Local Repository<br>       │<br>       │ git push<br>       ↓<br>Remote Repository<br>       │<br>       │ git pull / fetch<br>       ↓<br>My Computer</pre><p>This also explains why committing code doesn’t automatically mean my teammates can see it. If I only commit locally and never push, those commits are still on my machine.</p><h3>The Mental Model That Finally Made Git Click</h3><p>After learning all of this, I stopped seeing Git as a random collection of commands.</p><p>I started seeing it as a flow:</p><pre>Edit my files<br>      ↓<br>Working Directory<br>      ↓<br>   git add<br>      ↓<br>Staging Area<br>      ↓<br>  git commit<br>      ↓<br>Local Repository<br>      ↓<br>   git push<br>      ↓<br>Remote Repository</pre><p>And when working with a team:</p><pre>Create Feature Branch<br>        ↓<br>     Make Changes<br>        ↓<br>      git add<br>        ↓<br>     git commit<br>        ↓<br>      git push<br>        ↓<br>    Pull Request<br>        ↓<br>    Merge into dev<br>        ↓<br> Integration / Testing<br>        ↓<br>    Merge into main</pre><p>Of course, different teams use different branching strategies.</p><p>But understanding this basic flow made it much easier for me to understand <strong>why</strong> I was running each command.</p><h3>What I Learned</h3><p>The biggest mistake I made while learning Git was trying to memorize commands before understanding the ideas behind them.</p><p>I knew:</p><pre>git add .<br>git commit -m &quot;update&quot;<br>git push</pre><p>But I didn’t really know what happened between those commands.</p><p>Now, before running a Git command, I try to think about what I’m actually trying to do.</p><p><strong>Am I changing files?</strong></p><p>That’s my working directory.</p><p><strong>Am I selecting changes for the next checkpoint?</strong></p><p>That’s staging.</p><p><strong>Am I creating a checkpoint?</strong></p><p>That’s a commit.</p><p><strong>Am I working separately from other development?</strong></p><p>That’s a branch.</p><p><strong>Is Git unable to automatically combine two changes?</strong></p><p>That’s a merge conflict.</p><p><strong>Am I sending my commits somewhere my team can access them?</strong></p><p>That’s the remote repository.</p><p>Once those ideas became clear, the commands became much easier to remember.</p><h3>Final Thoughts</h3><p>Git can feel intimidating when you’re starting out because even a simple workflow seems to involve several commands.</p><p>But I don’t think the best way to learn Git is to memorize a giant cheat sheet.</p><p>Start by understanding what Git is doing to your code.</p><pre>Working Directory → Staging → Commit → Branch → Remote</pre><p>Then understand how your work joins everyone else’s:</p><pre>Feature → Merge → dev → Test → main</pre><p>Once the mental model makes sense, the commands stop looking so random.</p><p>And that’s when Git finally started making sense to me too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9042ac9a3fa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Use React Bits to Make My Frontends Feel More Alive]]></title>
            <link>https://medium.com/@vinodyatharuki/how-i-use-react-bits-to-make-my-frontends-feel-more-alive-582362e37456?source=rss-a4e8bb5f48cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/582362e37456</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Vinodyatharuki]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 03:19:10 GMT</pubDate>
            <atom:updated>2026-09-03T03:19:10.850Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qVbvZdQcckKiboAyQDTuhw.png" /></figure><blockquote>How I use small interactive components and effects to make a normal React interface feel more polished.</blockquote><p>When I first started building frontend interfaces, most of my attention went toward one thing:</p><p><strong>Does everything work?</strong></p><p>Does the button navigate to the correct page? Is the layout responsive? Does the API data display correctly? Does the form submit?</p><p>Once I became more comfortable with those things, I started noticing something else.My interfaces worked, but sometimes they still felt a little <strong>static</strong>.</p><p>A hero section could have the right content and layout, but nothing really caught the user’s attention. Cards could look clean but have no sense of interaction. Headings could communicate the right information while still feeling visually plain.</p><p>That’s when I started experimenting more with animations and interactive components.One resource I came across was <strong>React Bits</strong>.</p><h3>What Is React Bits?</h3><p>React Bits is a collection of animated and interactive React components that can be used to add more personality to an interface.</p><p>Instead of creating every animation from scratch, I can start with an existing component and customize it to match my own design.</p><p>There are components for things like:</p><ul><li>animated text</li><li>interactive cards</li><li>background effects</li><li>hover interactions</li><li>cursor effects</li><li>scroll animations</li><li>visual transitions</li></ul><p>What I like most isn’t simply that the components look cool.</p><p>They give me a starting point.</p><p>Instead of spending a lot of time building an effect from zero, I can focus more on <strong>how that effect fits into the rest of my interface.</strong></p><h3>How I Actually Use React Bits</h3><p>I don’t start a project by thinking:</p><blockquote><em>“Where can I put React Bits?”</em></blockquote><p>I normally design the interface first.</p><p>Once I have the basic layout, typography, colors, spacing, and components working, I look at areas that could benefit from a little more interaction.</p><p>My process usually looks something like this:</p><pre>Build the basic UI<br>        ↓<br>Identify an important section<br>        ↓<br>Find a suitable effect<br>        ↓<br>Add the component<br>        ↓<br>Customize it<br>        ↓<br>Check if it improves the experience</pre><p>That last step is important.</p><p>Just because an animation looks good by itself doesn’t mean it belongs in the interface.</p><h3>For Example: Making a Hero Section More Interesting</h3><p>Imagine a portfolio hero section with a heading:</p><pre>export default function Hero() {<br>  return (<br>    &lt;section&gt;<br>      &lt;h1&gt;Building Digital Experiences&lt;/h1&gt;<br>      &lt;p&gt;<br>        Full-stack developer creating modern and<br>        interactive web experiences.<br>      &lt;/p&gt;<br>    &lt;/section&gt;<br>  );<br>}</pre><p>There’s nothing wrong with this.</p><p>But the main heading is usually one of the first things I want visitors to notice.</p><p>Instead of leaving it completely static, I could use an animated text component such as SplitText.</p><pre>import SplitText from &quot;./components/SplitText&quot;;<br>export default function Hero() {<br>  return (<br>    &lt;section&gt;<br>      &lt;SplitText<br>        text=&quot;Building Digital Experiences&quot;<br>      /&gt;<br>      &lt;p&gt;<br>        Full-stack developer creating modern and<br>        interactive web experiences.<br>      &lt;/p&gt;<br>    &lt;/section&gt;<br>  );<br>}</pre><p>It’s a relatively small change.</p><p>But visually, it can make the hero section feel much more intentional.</p><p>And that’s generally how I like to use these components: <strong>to emphasize something that already matters</strong>, rather than adding animation simply because I can.</p><h3>I Don’t Use Animation Everywhere</h3><p>This is probably the biggest lesson I’ve learned while experimenting with animated interfaces.</p><p>When you discover a library full of interesting effects, it’s tempting to use everything.</p><p>Animated heading?</p><p>Add it.</p><p>Glowing card?</p><p>Add it.</p><p>Cursor effect?</p><p>Add it.</p><p>Animated background?</p><p>Why not?</p><p>And suddenly the page looks like every element is competing for attention. 😅</p><p>That’s when animation stops improving the interface.</p><p>I now think about it like this:</p><pre>Good animation<br>      ↓<br>Guides attention<br>      ↓<br>Creates visual hierarchy<br>      ↓<br>Provides feedback<br>      ↓<br>Supports the experience</pre><p>But:</p><pre>Too much animation<br>      ↓<br>Competes for attention<br>      ↓<br>Distracts the user<br>      ↓<br>Makes the UI feel busy<br>      ↓<br>Can hurt usability</pre><p>The goal isn’t to make users notice every animation. The goal is to make the interface <strong>feel better to use</strong>.</p><h3>Customization Matters</h3><p>Another thing I try to avoid is copying a component and leaving it exactly as it appears in a demo.</p><p>The effect still needs to belong to <strong>my design</strong>.</p><p>That means I may adjust things such as:</p><ul><li>animation speed</li><li>text size</li><li>spacing</li><li>interaction behavior</li><li>responsiveness</li><li>surrounding layout</li></ul><p>The component should support the visual language of the application rather than making the page look like a collection of unrelated effects.</p><p>I think of React Bits as a <strong>starting point rather than the finished design</strong>.</p><h3>Performance Still Matters</h3><p>Animations aren’t free.</p><p>Some effects are much heavier than a normal heading, button, or card.</p><p>Adding multiple complex animations, background effects, or continuous interactions can increase the amount of work the browser has to perform.</p><p>So I try to ask:</p><blockquote><em>Does this animation add enough value to justify being here?</em></blockquote><p>If the answer is no, I probably don’t need it.</p><p>A simpler animation in the right place can often look better than five impressive effects competing on the same screen.</p><h3>What React Bits Actually Taught Me</h3><p>Interestingly, using React Bits didn’t only teach me about animation.It changed the way I think about frontend design.Before, I often thought about UI mainly in terms of:</p><pre>Layout<br>Typography<br>Colors<br>Components<br>Responsiveness</pre><p>Now I also think about:</p><pre>Movement<br>Feedback<br>Attention<br>Timing<br>Interaction</pre><p>A user interface isn’t just something users <strong>look at</strong>. It’s something they <strong>interact with</strong>. Animation can be part of communicating that interaction.</p><p>A button reacting to a hover, a heading appearing as the page loads, or a card responding to the cursor can make an interface feel more responsive and alive.</p><p>But only when those effects have a purpose.</p><h3>Final Thoughts</h3><p>React Bits has become one of the resources I like exploring when I want to add a little more personality to a React interface.</p><p>But the biggest lesson I’ve learned isn’t:</p><blockquote><strong><em>“Use more animations.”</em></strong></blockquote><p>It’s almost the opposite.</p><blockquote><strong><em>Use animation intentionally.</em></strong></blockquote><p>Start with a good interface.</p><p>Make sure the layout works.</p><p>Make sure it’s responsive.</p><p>Make sure users can understand and navigate it.</p><p>Then use animation where it can guide attention, communicate interaction, or make an important part of the experience more engaging.</p><p>Because a polished frontend isn’t the one with the most effects.</p><p><strong>It’s the one where every effect feels like it belongs there.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=582362e37456" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The .env File Isn’t Magic: How Environment Variables Actually Work]]></title>
            <link>https://medium.com/@vinodyatharuki/the-env-file-isnt-magic-how-environment-variables-actually-work-d3a981fb2412?source=rss-a4e8bb5f48cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a981fb2412</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[env]]></category>
            <category><![CDATA[web-project]]></category>
            <category><![CDATA[configuration]]></category>
            <dc:creator><![CDATA[Vinodyatharuki]]></dc:creator>
            <pubDate>Wed, 02 Sep 2026 18:47:18 GMT</pubDate>
            <atom:updated>2026-09-02T18:47:18.736Z</atom:updated>
            <content:encoded><![CDATA[<h3>A beginner-friendly guide to environment variables, secrets, frontend configuration, and deployment</h3><p>When I first started using .env files, they felt a little like magic.I would create a file:</p><pre>PORT=5000<br>DATABASE_URL=...<br>API_KEY=...</pre><p>Then somewhere in my Node.js application:</p><pre>process.env.PORT</pre><p>And somehow, my application knew the value.</p><p>Later, things became even more confusing when I started seeing variables like:</p><pre>VITE_API_URL=...<br>EXPO_PUBLIC_API_URL=...<br>NEXT_PUBLIC_API_URL=...</pre><p>Why do they have different prefixes? Is everything inside .env secret? And if .env isn&#39;t uploaded to GitHub, how does a deployed application get those values?</p><p>Once I started building and deploying full-stack applications, the idea became much simpler.</p><p><strong>A </strong><strong>.env file isn&#39;t magic. It&#39;s just one way to keep configuration separate from your application code.</strong></p><h3>Why Do We Need Environment Variables?</h3><p>Imagine writing this directly in your application:</p><pre>const databaseUrl = &quot;postgresql://user:password@localhost:5432/mydb&quot;;<br>const apiSecret = &quot;my-secret-key&quot;;</pre><p>This creates two problems.</p><p>First, sensitive credentials can accidentally end up in GitHub.Second, configuration changes between environments.</p><p>During development, your API might be:</p><pre>http://localhost:5000</pre><p>But in production:</p><pre>https://api.example.com</pre><p>Your application logic hasn’t really changed. <strong>The environment has.</strong></p><p>Instead of hardcoding those values, we can provide them through environment variables.</p><h3>So What Is .env?</h3><p>A .env file is simply a text file containing key-value pairs:</p><pre>PORT=5000<br>DATABASE_URL=postgresql://...<br>JWT_SECRET=...</pre><p>A Node.js application can then access them through:</p><pre>process.env.PORT<br>process.env.DATABASE_URL<br>process.env.JWT_SECRET</pre><p>Libraries such as dotenv, or functionality provided by frameworks and runtimes, can make these values available to the application.</p><p>A simple mental model is:</p><pre>.env<br> ↓<br>Environment variables<br> ↓<br>Application</pre><p>But here’s something important:</p><blockquote><strong><em>Environment variables don’t require a </em></strong><strong><em>.env file.</em></strong></blockquote><p>.env is simply a convenient way to provide them, especially during local development.</p><h3>.env Does NOT Automatically Mean Secret</h3><p>This was one of the most important things I learned.</p><p>It’s easy to think:</p><blockquote><em>“It’s inside </em><em>.env, so users can&#39;t see it.”</em></blockquote><p>That’s not always true.</p><p>Consider a backend variable:</p><pre>JWT_SECRET=...</pre><p>The backend can use it internally:</p><pre>process.env.JWT_SECRET</pre><p>If it’s kept server-side, the browser doesn’t need to receive that value.</p><p>Now consider a Vite frontend:</p><pre>VITE_API_URL=https://api.example.com</pre><p>The frontend accesses it using:</p><pre>import.meta.env.VITE_API_URL</pre><p>Frontend code eventually runs on the user’s device. Therefore, values intentionally exposed to frontend code should be considered <strong>public configuration</strong>.</p><p>A useful rule is:</p><pre>BACKEND</pre><pre>DATABASE_URL<br>JWT_SECRET<br>API_SECRET</pre><pre>→ Can remain private<br></pre><pre>FRONTEND</pre><pre>VITE_API_URL<br>NEXT_PUBLIC_...<br>EXPO_PUBLIC_...</pre><pre>→ Treat as public</pre><p>So never do something like:</p><pre>VITE_DATABASE_PASSWORD=my-secret-password</pre><p>just because it’s inside .env.</p><p><strong>The filename doesn’t make a value secure. Where that value is used matters.</strong></p><h3>Why the Different Prefixes?</h3><p>This explains variables such as:</p><pre>VITE_API_URL=...<br>NEXT_PUBLIC_API_URL=...<br>EXPO_PUBLIC_API_URL=...</pre><p>Frontend frameworks use naming conventions to identify variables that are intentionally available to client-side code.</p><p>For example, with Vite:</p><pre>import.meta.env.VITE_API_URL</pre><p>can access:</p><pre>VITE_API_URL=https://api.example.com</pre><p>The API URL can be public because the browser needs to know where to send requests.</p><p>But your database password or private API secret should stay on the backend.</p><h3>Why Is .env in .gitignore?</h3><p>Most projects contain:</p><pre>.env</pre><p>This is because .env often contains sensitive or environment-specific values.</p><p>You don’t want to accidentally publish:</p><pre>DATABASE_URL=...<br>JWT_SECRET=...<br>API_SECRET=...</pre><p>to GitHub.</p><p>But if .env isn&#39;t committed, how does another developer know what variables the project needs?</p><p>That’s where .env.example is useful.</p><pre>DATABASE_URL=<br>JWT_SECRET=<br>PORT=5000</pre><p>Your project can then look like:</p><pre>project/<br>├── src/<br>├── .env          ← ignored<br>├── .env.example  ← committed<br>└── package.json</pre><p>The example file documents the required variables without exposing the real values.</p><h3>What Happens When We Deploy?</h3><p>This was another concept that confused me at first.</p><p>Locally, I had:</p><pre>.env</pre><p>But if .env isn&#39;t in GitHub, how does the production server get those values?</p><p>Usually, the hosting platform provides a way to configure environment variables.</p><p>You might configure:</p><pre>DATABASE_URL = ...<br>JWT_SECRET = ...<br>API_SECRET = ...</pre><p>through the platform’s environment or secret settings.</p><p>Your application still does:</p><pre>process.env.DATABASE_URL</pre><p>It doesn’t really care whether the value came from a local .env file or the production environment.</p><p>So you can think of it like this:</p><pre>Development<br>.env<br>   ↓<br>Environment Variables<br>   ↓<br>Application<br></pre><pre>Production<br>Hosting Configuration<br>   ↓<br>Environment Variables<br>   ↓<br>Application</pre><p>This allows the <strong>same application code</strong> to run with different configurations.</p><h3>A Few Mistakes That Taught Me a Lot</h3><p>One common mistake is changing .env and wondering why nothing changed.</p><p>Depending on the framework, you may need to restart the development server or rebuild the application.</p><p>Another is forgetting that environment variables are commonly provided as strings.</p><p>For example:</p><pre>PORT=5000</pre><p>You may explicitly convert it when you need a number:</p><pre>const port = Number(process.env.PORT || 5000);</pre><p>And finally, environment variables don’t protect you from incorrect values.</p><p>For example:</p><pre>API_URL=http://localhost:5000</pre><p>might work on your laptop but fail when a mobile application running on a physical phone tries to use it, because localhost refers to the device itself in that context.</p><p>.env gives us a better place to manage configuration.</p><p>It doesn’t automatically make that configuration correct.</p><h3>The Mental Model That Finally Made Sense</h3><p>Instead of thinking:</p><pre>.env = secrets</pre><p>I now think:</p><pre>CONFIGURATION<br>                    │<br>          ┌─────────┴─────────┐<br>          │                   │<br>    Development           Production<br>          │                   │<br>       .env file        Hosting settings<br>          │                   │<br>          └─────────┬─────────┘<br>                    ↓<br>          Environment Variables<br>                    ↓<br>               Application</pre><p>And then ask one more question:</p><pre>Is this used only by the backend?<br>        ↓<br>It may be kept private.<br></pre><pre>Is this exposed to frontend code?<br>        ↓<br>Treat it as public.</pre><p>That distinction made environment variables much easier for me to understand.</p><h3>Final Thoughts</h3><p>The .env file isn&#39;t magic.</p><p>It isn’t a secure vault, and putting something inside it doesn’t automatically make that value secret.</p><p>Its main purpose is much simpler:</p><blockquote><strong><em>Keep configuration separate from application code.</em></strong></blockquote><p>The important questions are not only:</p><blockquote><em>“Should I put this in </em><em>.env?”</em></blockquote><p>Instead, ask:</p><p><strong>Where will this value be used? Who can see it? Does it need to remain secret? Will the value change between development and production?</strong></p><p>Once I started thinking about environment variables this way, .env stopped feeling like something I was using just because every tutorial told me to.</p><p>It finally made sense.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a981fb2412" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Uploading Images Is More Complicated Than It Looks]]></title>
            <link>https://medium.com/@vinodyatharuki/why-uploading-images-is-more-complicated-than-it-looks-a4cc44d70b78?source=rss-a4e8bb5f48cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4cc44d70b78</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[cloudinary]]></category>
            <category><![CDATA[full-stack-development]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vinodyatharuki]]></dc:creator>
            <pubDate>Sun, 30 Aug 2026 07:05:41 GMT</pubDate>
            <atom:updated>2026-09-03T03:20:05.437Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOhE4S8Pa0d-j2E609JpZA.png" /></figure><h4>How deploying my full-stack application exposed a hidden storage problem — and how Cloudinary helped me solve it</h4><p>“Just let the user upload an image.” It sounds simple, right?</p><p>When I first implemented product image uploads in one of my full-stack projects, I thought the process would be straightforward:</p><ol><li>Let the user select an image.</li><li>Send it to the backend.</li><li>Save the image.</li><li>Store its path in the database.</li><li>Display it on the frontend.</li></ol><p>And during development, that was exactly what happened.Everything worked perfectly on my local machine.Then I deployed the application.That was when I realized that <strong>uploading an image and storing an image permanently are two very different problems.</strong></p><h3>The Project Behind This Problem</h3><p>The application was <strong>FreshRoute</strong>, a fleet and fresh-produce delivery platform I was working on.</p><p>One part of the system allows sellers to add products such as fruits and vegetables. When creating a product listing, a seller can provide information such as the product name, category, price, available stock, and an image.</p><p>From the user’s perspective, uploading that image is just one small part of a form.From the developer’s perspective, however, there is an important question hiding behind that upload button:</p><blockquote><strong><em>Where does the image actually live?</em></strong></blockquote><p>I didn’t fully appreciate the importance of that question until deployment.</p><h3>The First Approach: Store It Locally</h3><p>My backend was built with Node.js and Express, and I used Multer to handle multipart/form-data.</p><p>A simple Multer configuration can store uploaded files in a local directory:</p><pre>const upload = multer({<br>  dest: &quot;uploads/&quot;,<br>});</pre><p>The project could then have a structure similar to:</p><pre>backend/<br>│<br>├── src/<br>├── uploads/<br>│   ├── tomatoes.jpg<br>│   ├── carrots.jpg<br>│   └── apples.jpg<br>│<br>└── package.json</pre><p>Express could expose that directory so the frontend could access the uploaded files:</p><pre>app.use(<br>  &quot;/uploads&quot;,<br>  express.static(path.join(process.cwd(), &quot;uploads&quot;))<br>);</pre><p>The database only needed to store something like:</p><pre>/uploads/tomatoes.jpg</pre><p>It seemed like a complete solution. The seller uploaded an image. Multer saved it. PostgreSQL stored its path. React displayed it. Problem solved. Or so I thought.</p><h3>Everything Worked… Until Deployment</h3><p>Things became more interesting when the backend was deployed.</p><p>My database records were still there. Product names, prices, quantities and even image paths remained perfectly fine.</p><p>But the actual uploaded images weren’t as reliable as I expected.</p><p>After a redeployment or service restart, a previously uploaded image could disappear.</p><p>At first, this was confusing.</p><p>The database might still contain:</p><pre>/uploads/tomatoes.jpg</pre><p>So according to the database, the product still had an image. But when the frontend tried to display it, the actual file was no longer available.That’s when something clicked for me.</p><p><strong>The database wasn’t storing the image.</strong></p><p>It was storing directions to the image. Imagine saving someone’s home address.</p><pre>123 Example Street</pre><p>Now imagine that the house at that address disappears. You still have the address. But the address doesn’t lead to anything useful anymore.</p><p>The same thing was happening with my image paths.</p><h3>Why Did the Images Disappear?</h3><p>The problem came from treating the application’s runtime filesystem as permanent file storage.</p><p>On many cloud hosting environments, files generated while the application is running shouldn’t automatically be treated as durable application data.</p><p>My application code could be deployed again, the backend could restart, or the runtime environment could change.</p><p>That meant a folder like:</p><pre>/uploads</pre><p>wasn’t the right place for me to rely on for permanent product media.</p><p>This wasn’t really a Multer problem. Multer was doing exactly what I asked it to do. The problem was <strong>where I asked Multer to store the files</strong>.That distinction became one of the most important things I learned from this issue.</p><h3>So… Why Not Store the Image in PostgreSQL?</h3><p>My next question was obvious:</p><p><strong>Why not just put the entire image inside the database?</strong></p><p>Technically, that is possible.</p><p>Images can be stored as binary data, and there are situations where storing files directly in a database makes sense. But it wasn’t the architecture I wanted for FreshRoute.</p><p>Product images could become relatively large, and putting all of that media into the application database would increase things such as database size, backup size, transferred data and overall complexity.</p><p>More importantly, my PostgreSQL database already had a clear job.</p><p>It stored application data such as:</p><pre>Product<br>├── id<br>├── name<br>├── category<br>├── price<br>├── stock<br>├── unit<br>└── imageUrl</pre><p>What I actually needed was somewhere designed to store and deliver the <strong>image itself</strong>.</p><p>Then PostgreSQL could simply remember where that image was located.</p><p>That led me to Cloudinary.</p><h3>Enter Cloudinary ☁️</h3><p>Cloudinary is a cloud-based platform for managing and delivering media such as images and videos.</p><p>Instead of saving uploaded images inside my application’s local filesystem, I could upload them to Cloudinary.</p><p>Cloudinary would store the actual file. My database would store the image URL.</p><p>The responsibilities became much clearer:</p><pre>PostgreSQL<br>     ↓<br>Stores product information<br>and image URL<br></pre><pre>Cloudinary<br>     ↓<br>Stores and delivers<br>the actual image<br></pre><pre>Backend<br>     ↓<br>Handles application logic<br>and connects everything</pre><p>This small architectural change solved the main persistence problem.</p><h3>The New Image Upload Flow</h3><p>Previously, the upload flow looked roughly like this:</p><pre>User<br>  ↓<br>Frontend<br>  ↓<br>Express + Multer<br>  ↓<br>Local uploads/ folder<br>  ↓<br>Database stores local path</pre><p>After integrating Cloudinary, it became:</p><pre>User selects an image<br>          ↓<br>Frontend creates FormData<br>          ↓<br>Backend receives the request<br>          ↓<br>Multer processes the upload<br>          ↓<br>Cloudinary stores the image<br>          ↓<br>Cloudinary returns the image URL<br>          ↓<br>Backend stores the URL in PostgreSQL<br>          ↓<br>Frontend displays the image using the URL</pre><p>Now the actual image wasn’t dependent on the backend’s local filesystem.</p><h3>Connecting Cloudinary to the Backend</h3><p>The first step was configuring Cloudinary in the backend.</p><pre>import { v2 as cloudinary } from &quot;cloudinary&quot;;</pre><pre>cloudinary.config({<br>  cloud_name: process.env.CLOUDINARY_CLOUD_NAME,<br>  api_key: process.env.CLOUDINARY_API_KEY,<br>  api_secret: process.env.CLOUDINARY_API_SECRET,<br>  secure: true,<br>});</pre><pre>export default cloudinary;</pre><p>Notice that the credentials aren’t written directly into the source code.</p><p>Instead, they come from environment variables:</p><pre>CLOUDINARY_CLOUD_NAME=your_cloud_name<br>CLOUDINARY_API_KEY=your_api_key<br>CLOUDINARY_API_SECRET=your_api_secret</pre><p>This is especially important for the API secret.</p><p>Secrets should not be committed to GitHub or exposed inside frontend code. When deploying the application, those environment variables can be configured separately in the hosting environment.</p><h3>Multer Didn’t Have to Go Anywhere</h3><p>Something else I learned was that moving to cloud storage didn’t necessarily mean removing Multer.</p><p>I was already using Multer to process multipart/form-data.Instead of asking Multer to write the uploaded file to:</p><pre>/uploads</pre><p>I could change its storage engine so the media was sent to Cloudinary.Using multer-storage-cloudinary, the configuration looked like this:</p><pre>import multer from &quot;multer&quot;;<br>import { CloudinaryStorage } from &quot;multer-storage-cloudinary&quot;;<br>import cloudinary from &quot;../config/cloudinary.config.js&quot;;</pre><pre>const storage = new CloudinaryStorage({<br>  cloudinary,<br>  params: async () =&gt; ({<br>    folder: &quot;freshroute&quot;,<br>    resource_type: &quot;auto&quot;,<br>  }),<br>});</pre><pre>export const upload = multer({<br>  storage,<br>  limits: {<br>    fileSize: 5 * 1024 * 1024,<br>  },<br>});</pre><p>This changed one very important thing:</p><pre>BEFORE</pre><pre>Browser<br>   ↓<br>Express<br>   ↓<br>Multer<br>   ↓<br>Local filesystem<br></pre><pre>AFTER</pre><pre>Browser<br>   ↓<br>Express<br>   ↓<br>Multer<br>   ↓<br>Cloudinary ☁️</pre><p>The upload experience for the user could remain almost identical.But the storage architecture behind it was completely different.</p><h3>Saving the Cloudinary URL</h3><p>After Cloudinary successfully stores an image, the uploaded file information contains a URL.</p><p>In my implementation, I could retrieve those URLs with:</p><pre>const imageUrls = files.map((file) =&gt; file.path);</pre><p>Then I could use the uploaded image when creating the product data:</p><pre>const productData = {<br>  name,<br>  category,<br>  price,<br>  stock,<br>  imageUrl: imageUrls[0] ?? null,<br>};</pre><p>Instead of storing:</p><pre>/uploads/tomatoes.jpg</pre><p>the database could now contain a Cloudinary URL similar to:</p><pre>https://res.cloudinary.com/.../freshroute/tomatoes.jpg</pre><p>The actual image lives in Cloudinary.PostgreSQL only stores the reference.And the frontend doesn’t need to know much about any of this.</p><p>It can simply do:</p><pre>&lt;img<br>  src={product.imageUrl}<br>  alt={product.name}<br>/&gt;</pre><p>That’s one of my favorite things about this architecture.The frontend still sees an image URL.</p><p>But behind that URL, image storage is now separated from the application server.</p><h3>Don’t Forget File Validation</h3><p>Getting the upload working isn’t the end of the problem.</p><p>An upload endpoint accepts data from users, which means it needs validation.</p><p>At minimum, I wanted to think about:</p><ul><li>allowed file types</li><li>file size</li><li>the number of files</li><li>authentication</li><li>error handling</li></ul><p>For example, I limited uploaded files to 5 MB:</p><pre>export const upload = multer({<br>  storage,<br>  limits: {<br>    fileSize: 5 * 1024 * 1024,<br>  },<br>});</pre><p>File type validation can also reject formats the application doesn’t expect.</p><p>For a product image feature, for example, the application may decide to accept:</p><pre>.jpg<br>.jpeg<br>.png<br>.webp</pre><p>Checking extensions and MIME types provides useful basic validation, although applications with stricter security requirements may also inspect the actual file contents rather than trusting metadata alone.</p><p>This made me realize something else:</p><p><strong>“Upload an image” is not one operation.</strong></p><p>It is a pipeline.</p><h3>The Frontend and Backend Must Agree</h3><p>Another small issue that can waste a surprising amount of debugging time is the form-data field name.</p><p>Suppose the backend expects:</p><pre>upload.array(&quot;images&quot;)</pre><p>Then the frontend should send:</p><pre>formData.append(&quot;images&quot;, selectedFile);</pre><p>If the frontend sends:</p><pre>formData.append(&quot;image&quot;, selectedFile);</pre><p>while the backend expects:</p><pre>images</pre><p>the upload can fail even though Cloudinary, Multer and the rest of the configuration are completely fine.</p><p>It sounds obvious once you find it.It is much less obvious while debugging it.</p><h3>Error Handling Matters Too</h3><p>Getting an image successfully uploaded is only part of the process. The application also needs to handle situations where an upload fails.</p><p>For example, if the application allows a maximum file size of 5 MB and a user tries to upload a larger image, Multer can reject the request.</p><p>Instead of returning an unclear server error, the backend should return a response that the frontend can understand:</p><pre>{<br>  &quot;message&quot;: &quot;File too large&quot;<br>}</pre><p>This allows the frontend to show a meaningful message to the user instead of simply displaying something like “Upload failed.”</p><p>This part of the implementation reminded me that a feature isn’t complete just because the successful scenario works. The application also needs to handle incorrect files, oversized uploads, and unexpected errors properly.</p><h3>What This Challenge Taught Me</h3><p>Before working on this feature, I thought image uploading was mostly about adding a file input to the frontend and configuring Multer on the backend.</p><p>But after deploying the application, I realized that even a simple image upload can involve several different parts of a full-stack system:</p><ul><li>multipart request handling</li><li>authentication</li><li>file validation</li><li>file-size limits</li><li>cloud storage</li><li>environment variables</li><li>database references</li><li>error handling</li><li>frontend image rendering</li></ul><p>The biggest lesson for me was understanding the difference between <strong>storing an image and storing a reference to an image</strong>.</p><p>In my final implementation, each part of the system had a clear responsibility:</p><pre>Frontend<br>   ↓<br>Allows the seller to select<br>and upload an image</pre><pre>Backend + Multer<br>   ↓<br>Receives and processes<br>the uploaded file</pre><pre>Cloudinary<br>   ↓<br>Stores and delivers<br>the actual image</pre><pre>PostgreSQL<br>   ↓<br>Stores the product data<br>and Cloudinary image URL</pre><p>Instead of depending on the backend’s local uploads directory, the actual media became independent of the application server.</p><p>That made much more sense for a deployed application.</p><h3>Final Thoughts</h3><p>One of the most interesting things about full-stack development is discovering how much can exist behind a feature that looks simple from the user’s perspective.</p><p>For a seller using the application, the process is simply:</p><pre>Choose Image → Upload → Done</pre><p>But behind that action, my application has to answer several questions.</p><p>Where should the image be stored?</p><p>Will it still exist after the application is redeployed?</p><p>Should the image itself be stored in PostgreSQL?</p><p>How does the backend receive the file?</p><p>How does the frontend access it later?</p><p>How should credentials be protected?</p><p>What happens when an invalid or oversized file is uploaded?</p><p>Working through these questions helped me understand that image uploading isn’t only a frontend feature. It involves the frontend, backend, storage service, database, deployment environment, and security considerations working together.</p><p>For FreshRoute, separating those responsibilities gave me a much cleaner architecture:</p><pre>User<br>  ↓<br>Frontend<br>  ↓<br>Node.js + Express + Multer<br>  ↓<br>Cloudinary<br>  ↓<br>Image URL<br>  ↓<br>PostgreSQL</pre><p>PostgreSQL stores the information about the product.</p><p>Cloudinary stores and delivers the image.</p><p>The backend connects the two.</p><p>And the frontend simply uses the resulting URL to display the image.</p><p>What started as a small requirement — <strong>“allow sellers to upload product images”</strong> — ended up teaching me much more about how file storage works in a deployed full-stack application.</p><p>Uploading images still looks simple from the user’s perspective. They select a file and click a button.</p><p><strong>But behind that button is a small distributed system.</strong></p><p>And that is exactly why uploading images is more complicated than it looks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4cc44d70b78" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>