<?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: Fares Galal</title>
    <description>The latest articles on DEV Community by Fares Galal (@f-47).</description>
    <link>https://dev.to/f-47</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F816768%2Fe1dbf0c9-7ed4-443a-ac3c-5fad347d60dc.jpg</url>
      <title>DEV Community: Fares Galal</title>
      <link>https://dev.to/f-47</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/f-47"/>
    <language>en</language>
    <item>
      <title>Getting the Absolute Path of a Folder in the Browser Isn't That Easy</title>
      <dc:creator>Fares Galal</dc:creator>
      <pubDate>Mon, 23 Nov 2026 15:07:22 +0000</pubDate>
      <link>https://dev.to/f-47/getting-the-absolute-path-of-a-folder-in-the-browser-isnt-that-easy-2321</link>
      <guid>https://dev.to/f-47/getting-the-absolute-path-of-a-folder-in-the-browser-isnt-that-easy-2321</guid>
      <description>&lt;p&gt;I was working on a local-first project where users needed to import an existing project from their machine. The idea was simple: they provide a project name and select its folder.&lt;/p&gt;

&lt;p&gt;I didn't want users to copy and paste folder paths. I wanted a folder selector, just like the ones we're used to seeing in desktop applications.&lt;/p&gt;

&lt;p&gt;Naturally, my first thought was: why not just use an HTML file input?&lt;/p&gt;

&lt;p&gt;Well, that was where things started getting interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the browser gives you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The file input.&lt;/strong&gt; If you read the value of &lt;code&gt;&amp;lt;input type="file"&amp;gt;&lt;/code&gt;, you get something like this instead of the real path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\fakepath\example.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This isn't a bug. It's an intentional security restriction, defined in the HTML spec. Imagine visiting a random website and having it know the full paths of your files. Those paths could reveal your Windows username, your directory structure, and your project names.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. webkitdirectory.&lt;/strong&gt; It lets users select a whole folder, which sounded promising:&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;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt; &lt;span class="na"&gt;webkitdirectory&lt;/span&gt; &lt;span class="na"&gt;multiple&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;But you only get relative paths through &lt;code&gt;webkitRelativePath&lt;/code&gt;, like &lt;code&gt;my-project/src/index.ts&lt;/code&gt;. It also gives you entries for every file in the selected folder, including &lt;code&gt;node_modules&lt;/code&gt; in a typical JavaScript project. That's a lot of files when all I need is one string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. React Dropzone, or your own drag and drop.&lt;/strong&gt; They have the same limits. If you handle the drop yourself with &lt;code&gt;webkitGetAsEntry()&lt;/code&gt;, the entry has a property called &lt;code&gt;fullPath&lt;/code&gt;. That must be it, right? Not really. You get something like &lt;code&gt;/my-project&lt;/code&gt;, which starts from a virtual root that the browser creates. It isn't the absolute path on the user's disk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. showDirectoryPicker().&lt;/strong&gt; This one opens a real native picker:&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="n"&gt;directoryHandle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;showDirectoryPicker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&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="n"&gt;directoryHandle&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="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// my-project&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Looks like exactly what we need, right? Well, almost. It returns a handle, not a path.&lt;/p&gt;

&lt;p&gt;If your goal is to read files in the browser, this is a good option. It needs a secure context, and it works in Chromium-based browsers, but not in Firefox or Safari. But I needed the path itself, so my local NestJS backend could work with the project.&lt;/p&gt;
&lt;h2&gt;
  
  
  So, what actually works?
&lt;/h2&gt;

&lt;p&gt;If all you have is browser code, the only way to get the absolute path is to ask the user to type it. That works everywhere, but it's not the best experience.&lt;/p&gt;

&lt;p&gt;Once you have something running outside the browser's sandbox, you have more options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A backend that lists folders:&lt;/strong&gt; you build the UI, and the API can browse the disk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A native dialog from a local backend:&lt;/strong&gt; you need code for each operating system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Electron or Tauri:&lt;/strong&gt; they have dialog APIs, but you need to ship a desktop app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A browser extension with native messaging:&lt;/strong&gt; users need to install two things.
And if your backend is remote, the path is useless to it anyway, because it can't reach the user's disk. Upload the files instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Moving the dialog to the backend
&lt;/h2&gt;

&lt;p&gt;I already had a local NestJS backend. So, instead of asking the browser for the path, why not let the backend open the dialog?&lt;/p&gt;

&lt;p&gt;My users were on Windows, so that's where I started. Everything below is Windows-specific.&lt;/p&gt;

&lt;p&gt;I created a &lt;code&gt;POST /projects/select-folder&lt;/code&gt; endpoint that runs a small PowerShell script:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Type&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;AssemblyName&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Windows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Forms&lt;/span&gt;
&lt;span class="nv"&gt;$dialog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Windows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Forms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;FolderBrowserDialog&lt;/span&gt;
&lt;span class="nv"&gt;$dialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Select a project folder"&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ShowDialog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;eq&lt;/span&gt; &lt;span class="s1"&gt;'OK'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;# First version. This breaks on some folder names (more on that below).&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SelectedPath&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;And I executed it from Node:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;execFile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:child_process'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;promisify&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:util'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;execFileAsync&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;promisify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;execFile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;execFileAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'powershell.exe'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s1"&gt;'-NoProfile'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'-STA'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'-Command'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;FOLDER_PICKER_SCRIPT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Windows Forms dialogs need a single-threaded apartment. That's already the default since PowerShell 3.0, but I pass &lt;code&gt;-STA&lt;/code&gt; explicitly so it doesn't depend on that. The script is constant, and &lt;code&gt;execFile&lt;/code&gt; runs without a shell, so a request can't inject a command.&lt;/p&gt;

&lt;p&gt;It worked. But "it works" and "it's done" are two different things.&lt;/p&gt;
&lt;h2&gt;
  
  
  The cases I didn't think about
&lt;/h2&gt;
&lt;h3&gt;
  
  
  The dialog opened behind the application
&lt;/h3&gt;

&lt;p&gt;Windows doesn't let a background process steal focus, and the PowerShell process has no visible window of its own. So the dialog often appeared behind the browser, and users thought nothing happened.&lt;/p&gt;

&lt;p&gt;I created a small hidden form that is always on top, and made it the owner of the dialog:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$owner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Windows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Forms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;
&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TopMost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$true&lt;/span&gt;
&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ShowInTaskbar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$false&lt;/span&gt;
&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WindowState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Minimized'&lt;/span&gt;
&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$dialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ShowDialog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Folder names with non-ASCII characters
&lt;/h3&gt;

&lt;p&gt;I selected a folder named "café" followed by an Arabic word (&lt;code&gt;C:\café مصر&lt;/code&gt;), and it came back to Node 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;C:\caf� ???
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Why? Because a process doesn't really send text to another process. It sends bytes. PowerShell was writing them using the console's old encoding, while Node was reading them as UTF-8. And you can't fix it from Node, because the Arabic letters were already replaced with &lt;code&gt;?&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, I made PowerShell write the UTF-8 bytes itself:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Encoding&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;UTF8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;GetBytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SelectedPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;OpenStandardOutput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$bytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$bytes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Flush&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;h3&gt;
  
  
  Two dialogs at the same time
&lt;/h3&gt;

&lt;p&gt;I was disabling the Browse button, so I thought that was enough. But open another tab, click Browse again, and now you have two dialogs. The dialog is a shared resource on the user's machine, so the backend needs to protect it with a lock.&lt;/p&gt;
&lt;h3&gt;
  
  
  The dialog that stays open forever
&lt;/h3&gt;

&lt;p&gt;What if the user clicks Browse and then closes the tab? The request is gone, but the dialog is still there. So, I abort the process when the connection closes, and I added a timeout in case the user just forgot about it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Which PowerShell are we running?
&lt;/h3&gt;

&lt;p&gt;I was running &lt;code&gt;powershell.exe&lt;/code&gt; by its name, so Windows had to search for it. And on Windows, Node checks the &lt;strong&gt;current working directory&lt;/strong&gt; before PATH. A &lt;code&gt;powershell.exe&lt;/code&gt; dropped into the folder the backend runs from, or placed earlier in PATH, would run instead of the real one. Now I use its full path, built from &lt;code&gt;%SystemRoot%\System32\WindowsPowerShell\v1.0\&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  So, I made it a package
&lt;/h2&gt;

&lt;p&gt;At this point, my "small script" wasn't small anymore. It had grown into something reusable, and none of it really belonged to my project.&lt;/p&gt;

&lt;p&gt;So, I extracted it into its own npm package: &lt;a href="https://www.npmjs.com/package/native-folder-picker" rel="noopener noreferrer"&gt;native-folder-picker&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install native-folder-picker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Using it is one function:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;pickFolder&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'native-folder-picker'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;pickFolder&lt;/span&gt;&lt;span class="p"&gt;(&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="s1"&gt;'Select a project folder'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// C:\Users\Fares\Desktop\my-project&lt;/span&gt;
&lt;span class="c1"&gt;// or null if the user cancels&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;All the cases above are handled inside it. It has no dependencies, it opens one dialog at a time, it closes itself after 5 minutes by default, and its errors have a code you can check. Pass it a signal, and the dialog also closes when the HTTP connection closes.&lt;/p&gt;

&lt;p&gt;Here's the endpoint:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'select-folder'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;selectFolder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@Res&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;passthrough&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AbortController&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;once&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'close'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;writableFinished&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projectsService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;selectFolder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And the service:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;selectFolder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;pickFolder&lt;/span&gt;&lt;span class="p"&gt;(&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="s1"&gt;'Select a project folder'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aborted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nf"&gt;toFolderPickerException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;toFolderPickerException&lt;/code&gt; is a small function in my project that turns the error codes into HTTP errors, like 409 when a dialog is already open.&lt;/p&gt;

&lt;p&gt;It only works on Windows for now, and it needs Node.js 22 or newer. macOS and Linux are next.&lt;/p&gt;
&lt;h2&gt;
  
  
  What the package can't do for you
&lt;/h2&gt;

&lt;p&gt;A web page that can make your machine open a dialog sounds scary. The package opens the dialog, but protecting the endpoint is your job. In my case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The backend only listens on &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The endpoint needs a token. Because it's sent in a custom header, the browser also has to send a preflight request first.&lt;/li&gt;
&lt;li&gt;Only my frontend's origin is trusted, with CSRF protection. CORS alone isn't enough, because some cross-origin requests are still sent even when the calling page can't read the response.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;Host&lt;/code&gt; header is checked, which protects from DNS rebinding.
And remember that the path can be typed too, so the dialog isn't what makes this secure. I was only checking that the path exists and that it's a directory. But &lt;code&gt;\\server\share&lt;/code&gt; is a network path, and just checking whether it exists can make Windows try to authenticate with that server and send an NTLM response derived from the user's password hash.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;path.isAbsolute()&lt;/code&gt; accepts network paths as well. So, I check the path before touching the disk:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;isAbsolute&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:path'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;WINDOWS_DRIVE_PATH&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;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;\\&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isLocalAbsolutePath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;platform&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'win32'&lt;/span&gt;
    &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="no"&gt;WINDOWS_DRIVE_PATH&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;isAbsolute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It's not perfect. A network drive with a letter, like &lt;code&gt;Z:\&lt;/code&gt;, still passes, and so does a local symlink or junction that points to a network share. It also refuses WSL folders like &lt;code&gt;\\wsl$\…&lt;/code&gt; and &lt;code&gt;\\wsl.localhost\…&lt;/code&gt;, so allow them if your users need them.&lt;/p&gt;

&lt;p&gt;One last thing: I kept the text field as a fallback. The dialog needs a desktop session, so it won't work on a remote server or in a Docker container. If it doesn't open for any reason, the user can still continue.&lt;/p&gt;
&lt;h2&gt;
  
  
  Available now
&lt;/h2&gt;

&lt;p&gt;The package is published on npm and open source:&lt;/p&gt;

&lt;p&gt;📦 npm: &lt;a href="https://www.npmjs.com/package/native-folder-picker" rel="noopener noreferrer"&gt;native-folder-picker&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/F-47" rel="noopener noreferrer"&gt;
        F-47
      &lt;/a&gt; / &lt;a href="https://github.com/F-47/native-folder-picker" rel="noopener noreferrer"&gt;
        native-folder-picker
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Open the native folder picker from Node.js and get the absolute path. No dependencies, cancellable, Unicode-safe.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;native-folder-picker&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;Open the native folder picker from Node.js and get the absolute path of the selected folder. It works on Windows for now.&lt;/p&gt;

&lt;p&gt;Browsers never expose absolute paths, so a local-first app has to open the dialog from its own backend. This package does that part.&lt;/p&gt;

&lt;p&gt;The story behind it: &lt;a href="https://medium.com/@faresgalal09/getting-the-absolute-path-of-a-folder-in-the-browser-isnt-that-easy-63a4d3d2784d" rel="nofollow noopener noreferrer"&gt;Getting the Absolute Path of a Folder in the Browser Isn't That Easy&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No dependencies and no native builds&lt;/li&gt;
&lt;li&gt;Cancellable with an &lt;code&gt;AbortSignal&lt;/code&gt;, and closes itself after a timeout&lt;/li&gt;
&lt;li&gt;Keeps folder names in any language intact&lt;/li&gt;
&lt;li&gt;One dialog at a time&lt;/li&gt;
&lt;li&gt;Errors with a &lt;code&gt;code&lt;/code&gt; you can check&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Install&lt;/h2&gt;
&lt;/div&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;npm install native-folder-picker&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Requirements&lt;/h2&gt;
&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Node.js 22 or newer (the package is ESM only)&lt;/li&gt;
&lt;li&gt;Windows, in a desktop session&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;/p&gt;&lt;div class="table-wrapper-paragraph"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;table&gt;

&lt;thead&gt;

&lt;tr&gt;

&lt;th&gt;Platform&lt;/th&gt;

&lt;th&gt;Status&lt;/th&gt;

&lt;/tr&gt;

&lt;/thead&gt;

&lt;tbody&gt;

&lt;tr&gt;

&lt;td&gt;Windows&lt;/td&gt;

&lt;td&gt;Supported&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;macOS&lt;/td&gt;

&lt;td&gt;Planned (&lt;code&gt;UNSUPPORTED&lt;/code&gt; now)&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;Linux&lt;/td&gt;

&lt;td&gt;Planned (&lt;code&gt;UNSUPPORTED&lt;/code&gt; now)&lt;/td&gt;

&lt;/tr&gt;

&lt;/tbody&gt;

&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;

&lt;div class="highlight highlight-source-ts notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;import&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt; &lt;span class="pl-s1"&gt;pickFolder&lt;/span&gt; &lt;span class="pl-kos"&gt;}&lt;/span&gt; &lt;span class="pl-k"&gt;from&lt;/span&gt; &lt;span class="pl-s"&gt;'native-folder-picker'&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
&lt;span class="pl-k"&gt;const&lt;/span&gt; &lt;span class="pl-s1"&gt;path&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-k"&gt;await&lt;/span&gt; &lt;span class="pl-en"&gt;pickFolder&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt; &lt;span class="pl-c1"&gt;title&lt;/span&gt;: &lt;/pre&gt;…
&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/F-47/native-folder-picker" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Try it and tell me what breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;The solution wasn't to find a better React library or another HTML attribute. It was to understand why the browser doesn't expose this information in the first place, and move the responsibility to the environment that actually has permission to access it.&lt;/p&gt;

&lt;p&gt;But moving the responsibility also means owning it. The browser was handling a lot for me, and once I left it, the encoding, the cleanup, and the security became mine.&lt;/p&gt;

&lt;p&gt;Sometimes, the hardest part of development isn't implementing the feature itself. It's discovering that the straightforward approach isn't available for a good reason.&lt;/p&gt;

&lt;p&gt;And sometimes, solving a frontend problem means going a little beyond the frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://html.spec.whatwg.org/multipage/input.html#fakepath-srsly" rel="noopener noreferrer"&gt;HTML Standard: the value of file inputs ("fakepath")&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath" rel="noopener noreferrer"&gt;File.webkitRelativePath, MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry/fullPath" rel="noopener noreferrer"&gt;FileSystemEntry.fullPath, MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/showDirectoryPicker" rel="noopener noreferrer"&gt;Window.showDirectoryPicker(), MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.folderbrowserdialog" rel="noopener noreferrer"&gt;FolderBrowserDialog, Microsoft Learn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Don't just let AI fix it. Learn from it.</title>
      <dc:creator>Fares Galal</dc:creator>
      <pubDate>Sun, 28 Jun 2026 10:41:47 +0000</pubDate>
      <link>https://dev.to/f-47/dont-just-let-ai-fix-it-learn-from-it-538h</link>
      <guid>https://dev.to/f-47/dont-just-let-ai-fix-it-learn-from-it-538h</guid>
      <description>&lt;h2&gt;
  
  
  I’m building Fixmind, a local-first MCP tool for developers
&lt;/h2&gt;

&lt;p&gt;I’m working on &lt;strong&gt;Fixmind&lt;/strong&gt;, an MCP tool for developers.&lt;/p&gt;

&lt;p&gt;The idea is simple:&lt;/p&gt;

&lt;p&gt;AI can help you fix a bug once, but that does not always mean you actually learn from it.&lt;/p&gt;

&lt;p&gt;Sometimes you understand the fix in the moment, move on, and then repeat the same mistake weeks later in a slightly different form. Fixmind is my attempt to close that loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Fixmind does
&lt;/h2&gt;

&lt;p&gt;Fixmind helps turn AI-assisted fixes into lessons you can come back to later.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;remember repeated mistakes and fixes&lt;/li&gt;
&lt;li&gt;capture the root cause behind a bug&lt;/li&gt;
&lt;li&gt;save the lesson behind the fix&lt;/li&gt;
&lt;li&gt;ask a short follow-up question when more context is needed&lt;/li&gt;
&lt;li&gt;store lessons locally by default&lt;/li&gt;
&lt;li&gt;sync lessons across devices for Pro users&lt;/li&gt;
&lt;li&gt;help developers build a personal memory of what they learned from past fixes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why local-first?
&lt;/h2&gt;

&lt;p&gt;I’m keeping Fixmind local-first because I think most developers care about speed, privacy, and control.&lt;/p&gt;

&lt;p&gt;I do not want developers to manually save notes after every fix.&lt;/p&gt;

&lt;p&gt;I also do not want the tool to feel like another SaaS dashboard that only works after creating an account, connecting five services, accepting cookies, and sacrificing a keyboard to the cloud gods.&lt;/p&gt;

&lt;p&gt;By default, Fixmind stores lessons locally.&lt;/p&gt;

&lt;p&gt;The goal is to make learning from fixes feel automatic, private, and lightweight.&lt;/p&gt;

&lt;h2&gt;
  
  
  The workflow
&lt;/h2&gt;

&lt;p&gt;A typical flow looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You run into a bug&lt;/li&gt;
&lt;li&gt;Your AI coding agent helps fix it&lt;/li&gt;
&lt;li&gt;Fixmind captures what happened&lt;/li&gt;
&lt;li&gt;The root cause and lesson are saved locally&lt;/li&gt;
&lt;li&gt;You can review that lesson later when the same pattern appears again&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So instead of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Bug → AI fix → forgotten
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fixmind tries to make it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Bug → AI fix → saved lesson → reusable knowledge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I’m trying to figure out
&lt;/h2&gt;

&lt;p&gt;I’d love honest feedback from developers on a few things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does this solve a real problem?&lt;/li&gt;
&lt;li&gt;Is remembering past fixes actually useful in your workflow?&lt;/li&gt;
&lt;li&gt;What would make you trust a tool like this?&lt;/li&gt;
&lt;li&gt;Is local-first with optional sync the right model?&lt;/li&gt;
&lt;li&gt;What kind of lessons would be worth saving?&lt;/li&gt;
&lt;li&gt;What would make this annoying instead of helpful?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The hardest part is not saving more.&lt;/p&gt;

&lt;p&gt;It is saving only what is actually worth remembering.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Website: &lt;a href="https://fixmind.dev" rel="noopener noreferrer"&gt;https://fixmind.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re a developer, I’d really appreciate blunt feedback.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I Turned a Small Lazy Moment into a Chrome Extension</title>
      <dc:creator>Fares Galal</dc:creator>
      <pubDate>Fri, 10 Apr 2026 07:50:42 +0000</pubDate>
      <link>https://dev.to/f-47/i-turned-a-small-lazy-moment-into-a-chrome-extension-22jc</link>
      <guid>https://dev.to/f-47/i-turned-a-small-lazy-moment-into-a-chrome-extension-22jc</guid>
      <description>&lt;p&gt;I was watching a YouTube video (around 2 hours long) when I noticed something annoying: I kept moving my mouse just to check how much time had passed.&lt;/p&gt;

&lt;p&gt;It’s such a small thing, but it kept breaking my focus. And honestly, it felt ridiculous that there wasn’t a simpler solution for this.&lt;/p&gt;

&lt;p&gt;So I built one myself.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I created a Chrome Extension that shows the current timestamp as a persistent overlay in the top-right corner while watching videos in fullscreen mode.&lt;/p&gt;

&lt;p&gt;No mouse movement needed. No interruptions. Just always visible progress.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2fjkyyhyeuuz25fht3k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2fjkyyhyeuuz25fht3k.png" alt="Preview for the overlay 1" width="393" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnxmoatxfmossohm6cmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnxmoatxfmossohm6cmy.png" alt="Preview for the overlay 2" width="244" height="124"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Shortcuts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Press &lt;code&gt;Y&lt;/code&gt;&lt;/strong&gt; → Toggle the overlay on/off&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Press &lt;code&gt;Shift + Y&lt;/code&gt;&lt;/strong&gt; → Change the overlay style&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;This wasn’t some big product idea. It started as pure frustration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Watching long videos&lt;/li&gt;
&lt;li&gt;Constantly moving the mouse just to check progress&lt;/li&gt;
&lt;li&gt;Breaking immersion every time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So instead of tolerating it, I built a fix in a few hours.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ Simple, but Useful
&lt;/h2&gt;

&lt;p&gt;It’s not complex, but that’s the point.&lt;/p&gt;

&lt;p&gt;Sometimes the best tools are the ones that remove a tiny annoyance you didn’t realize was draining your attention.&lt;/p&gt;

&lt;p&gt;Now I can watch long content without constantly interacting with the UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It Out
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://chromewebstore.google.com/detail/kaicajfaonlbgnmodfalclemdfpnbnen" rel="noopener noreferrer"&gt;https://chromewebstore.google.com/detail/kaicajfaonlbgnmodfalclemdfpnbnen&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;Chrome Extensions API&lt;/li&gt;
&lt;li&gt;DOM manipulation&lt;/li&gt;
&lt;li&gt;Fullscreen overlay handling&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>web</category>
      <category>extensions</category>
      <category>youtube</category>
      <category>ui</category>
    </item>
    <item>
      <title>Tracking File Upload Progress on AWS S3 – Lessons from Large File Uploads</title>
      <dc:creator>Fares Galal</dc:creator>
      <pubDate>Wed, 14 Jan 2026 12:32:33 +0000</pubDate>
      <link>https://dev.to/f-47/tracking-file-upload-progress-on-aws-s3-lessons-from-large-file-uploads-4imn</link>
      <guid>https://dev.to/f-47/tracking-file-upload-progress-on-aws-s3-lessons-from-large-file-uploads-4imn</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyhutvhdqsz90rf9h4u4.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyhutvhdqsz90rf9h4u4.jpeg" alt="Post Thumbnail" width="800" height="533"&gt;&lt;/a&gt;Have you ever tried uploading a large file to AWS S3 and wanted to &lt;strong&gt;show progress reliably&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;I recently worked on a feature that involved &lt;strong&gt;uploading videos and large files&lt;/strong&gt;, and I learned a lot about &lt;strong&gt;browser limitations, multipart uploads, and UX improvements&lt;/strong&gt;. Here’s a breakdown of what I discovered.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why &lt;code&gt;onUploadProgress&lt;/code&gt; Alone Isn't Enough
&lt;/h2&gt;

&lt;p&gt;For small files, &lt;code&gt;Axios&lt;/code&gt; gives us a handy &lt;code&gt;onUploadProgress&lt;/code&gt; callback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;uploadUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;onUploadProgress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;progressEvent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;percent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;progressEvent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loaded&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;progressEvent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Progress:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;percent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;%&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Works perfectly for &lt;strong&gt;files ≤ 20MB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But when we tried &lt;strong&gt;large files&lt;/strong&gt; (150MB+):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Progress either &lt;strong&gt;lagged behind&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Or jumped &lt;strong&gt;directly to 100%&lt;/strong&gt; at the end&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why? Because the browser &lt;strong&gt;sends the file in a single request&lt;/strong&gt;, making &lt;code&gt;onUploadProgress&lt;/code&gt; unreliable.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: Multipart Upload (Chunking)
&lt;/h2&gt;

&lt;p&gt;With &lt;strong&gt;large files&lt;/strong&gt;, the file must be split into &lt;strong&gt;chunks&lt;/strong&gt; before uploading:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each chunk is a separate request&lt;/li&gt;
&lt;li&gt;Progress is tracked per chunk&lt;/li&gt;
&lt;li&gt;Failed chunks can be retried individually&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 500MB file with 20MB chunks → 25 requests&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CHUNK_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Some might ask: Isn’t 25 requests a lot?&lt;br&gt;
Not really. Each request is &lt;strong&gt;short-lived&lt;/strong&gt; and uploaded with &lt;strong&gt;controlled concurrency&lt;/strong&gt;.&lt;br&gt;
This makes uploads &lt;strong&gt;predictable&lt;/strong&gt;, &lt;strong&gt;faster&lt;/strong&gt;, and easier to retry on network failures.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Choosing the Right Chunk Size
&lt;/h2&gt;

&lt;p&gt;AWS S3 requires &lt;strong&gt;minimum 5MB per chunk&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We define:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MIN_CHUNK_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;       &lt;span class="c1"&gt;// 5MB&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DESIRED_CHUNK_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 20MB&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then check the file size:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;≤ 20MB&lt;/strong&gt; → Upload normally (no multipart)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&amp;gt; 20MB&lt;/strong&gt; → Split into chunks and start multipart upload&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Why 20MB? There’s &lt;strong&gt;no magic number&lt;/strong&gt; where uploads fail. Factors like &lt;strong&gt;network speed, connection stability, and device performance&lt;/strong&gt; all play a role.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Backend Workflow for Multipart Uploads
&lt;/h2&gt;

&lt;p&gt;Previously, the backend returned a single S3 URL:&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;"uploadUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://my-bucket.s3.amazonaws.com/file.mp4"&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 it returns:&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;"uploadId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UPLOAD_ID_PLACEHOLDER"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/FILE_NAME_PLACEHOLDER"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"parts"&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;span class="nl"&gt;"partNumber"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"uploadUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://my-bucket.s3.amazonaws.com/KEY_PLACEHOLDER"&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="nl"&gt;"expiresAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"EXPIRATION_DATE_PLACEHOLDER"&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;ul&gt;
&lt;li&gt;Each chunk is uploaded to its corresponding &lt;code&gt;uploadUrl&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;S3 returns an &lt;strong&gt;ETag&lt;/strong&gt; for each chunk → acts as a fingerprint to confirm the chunk was uploaded successfully&lt;/li&gt;
&lt;li&gt;ETags + part numbers are required for &lt;code&gt;CompleteMultipartUpload&lt;/code&gt; to assemble the file in order&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Tracking Progress for Large Files
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Small files&lt;/strong&gt; → browser events track progress by bytes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Large files&lt;/strong&gt; → track progress based on the number of chunks uploaded&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Benefits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Progress is &lt;strong&gt;stable and predictable&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Better &lt;strong&gt;UX&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;No sudden &lt;strong&gt;jumps or delays&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Failed chunks can &lt;strong&gt;retry individually&lt;/strong&gt;, no need to restart the entire upload&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Final Step: Complete the Upload
&lt;/h2&gt;

&lt;p&gt;Once all chunks are uploaded, send a final request with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;uploadId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;key&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;All &lt;code&gt;ETags&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The backend calls &lt;code&gt;CompleteMultipartUpload&lt;/code&gt; → file is assembled in S3 as if it were uploaded in a single request.&lt;/p&gt;




&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;p&gt;Switching to &lt;strong&gt;chunked uploads with progress tracking&lt;/strong&gt; dramatically improves the experience for large files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Predictable progress&lt;/li&gt;
&lt;li&gt;Stable uploads&lt;/li&gt;
&lt;li&gt;Retry for individual chunks&lt;/li&gt;
&lt;li&gt;Better UX for your users&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>frontend</category>
      <category>tutorial</category>
      <category>typescript</category>
    </item>
    <item>
      <title>FormCN: Generate React Forms in Seconds</title>
      <dc:creator>Fares Galal</dc:creator>
      <pubDate>Sun, 28 Dec 2025 22:35:10 +0000</pubDate>
      <link>https://dev.to/f-47/formcn-generate-react-forms-in-seconds-1nfc</link>
      <guid>https://dev.to/f-47/formcn-generate-react-forms-in-seconds-1nfc</guid>
      <description>&lt;p&gt;Forms are one of the most common components in web applications. Whether it’s a &lt;strong&gt;login form&lt;/strong&gt;, &lt;strong&gt;registration&lt;/strong&gt;, or a &lt;strong&gt;multi-step wizard&lt;/strong&gt;, we often find ourselves writing the same boilerplate code over and over again.&lt;/p&gt;

&lt;p&gt;I wanted to change that, so I built &lt;strong&gt;FormCN&lt;/strong&gt;, my first CLI tool designed to &lt;strong&gt;generate fully-typed, validated React forms in seconds&lt;/strong&gt;, integrating &lt;strong&gt;ShadCN UI&lt;/strong&gt;, &lt;strong&gt;React Hook Form&lt;/strong&gt;, and &lt;strong&gt;Zod&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Build FormCN?
&lt;/h2&gt;

&lt;p&gt;In most projects, forms are a repetitive task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We either &lt;strong&gt;rewrite them from scratch&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Or &lt;strong&gt;copy &amp;amp; tweak old code&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Or &lt;strong&gt;rely on AI generators&lt;/strong&gt;, which aren’t always precise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;FormCN&lt;/strong&gt; solves this problem by automating form creation, giving you a &lt;strong&gt;ready-to-use structure&lt;/strong&gt; while keeping full control over the design and validation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single-step or Multi-step forms&lt;/strong&gt; — Generate forms for simple or complex workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ready-made templates&lt;/strong&gt; — Login, registration, or custom forms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling presets&lt;/strong&gt; — Predefined UI styles using ShadCN components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual mode&lt;/strong&gt; — Step-by-step configuration if you want full control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic folder &amp;amp; file generation&lt;/strong&gt; — Creates the component folder with all schemas and files ready to use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart CLI checks&lt;/strong&gt; — Prevents duplicate forms, checks empty fields, ensures required dependencies like Zod, React Hook Form, and resolvers are installed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;After installing FormCN via npm:&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; &lt;span class="nt"&gt;-g&lt;/span&gt; formcn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;formcn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll be prompted to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Enter form name&lt;/strong&gt; — e.g., &lt;code&gt;register&lt;/code&gt; → creates &lt;code&gt;RegisterForm&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose form type&lt;/strong&gt; — single-step or multi-step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick a template&lt;/strong&gt; — ready template or manual configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Select a styling preset&lt;/strong&gt; — default, minimal, or custom.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After that, FormCN generates a complete folder with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/components/forms/{FormName}/
├── schema.ts
└── form.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, for multi-step forms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/components/forms/{FormName}/
├── step1-schema.ts
├── step1Step.tsx
└── {FormName}Form.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything is &lt;strong&gt;ready to use or tweak&lt;/strong&gt; in seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Developers Will Love It
&lt;/h2&gt;

&lt;p&gt;FormCN is built for &lt;strong&gt;React developers who want to focus on features instead of boilerplate&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript-first&lt;/strong&gt; with Zod validation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beautiful UI&lt;/strong&gt; with ShadCN components&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Professional CLI&lt;/strong&gt; that prevents errors and guides the developer&lt;/li&gt;
&lt;li&gt;Saves &lt;strong&gt;hours of repetitive work&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Now
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NPM:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/formcn" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/formcn&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/F-47/formcn" rel="noopener noreferrer"&gt;https://github.com/F-47/formcn&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FormCN is &lt;strong&gt;actively maintained&lt;/strong&gt;, and I’d love to get your &lt;strong&gt;feedback, ideas, or contributions&lt;/strong&gt;. If you try it out, let me know what templates or presets you’d like to see next!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>shadcn</category>
      <category>react</category>
      <category>zod</category>
    </item>
  </channel>
</rss>
