<?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: Aashutosh Bairagi</title>
    <description>The latest articles on DEV Community by Aashutosh Bairagi (@aashutosh_bairagi_31).</description>
    <link>https://dev.to/aashutosh_bairagi_31</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%2F3604420%2Fef46fc80-d2fe-485e-b921-ea76f5ac10bb.png</url>
      <title>DEV Community: Aashutosh Bairagi</title>
      <link>https://dev.to/aashutosh_bairagi_31</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aashutosh_bairagi_31"/>
    <language>en</language>
    <item>
      <title>How to delete ChatGPT conversations in bulk — without handing a stranger your chat history</title>
      <dc:creator>Aashutosh Bairagi</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:35:45 +0000</pubDate>
      <link>https://dev.to/aashutosh_bairagi_31/how-to-delete-chatgpt-conversations-in-bulk-without-handing-a-stranger-your-chat-history-1ggj</link>
      <guid>https://dev.to/aashutosh_bairagi_31/how-to-delete-chatgpt-conversations-in-bulk-without-handing-a-stranger-your-chat-history-1ggj</guid>
      <description>&lt;p&gt;If you've used ChatGPT for a year, your sidebar is a graveyard. Old debugging sessions, half-finished ideas, conversations you'd rather not keep. And OpenAI gives you exactly one way to deal with them: hover a row, open the menu, click delete, confirm. One at a time. Forever.&lt;/p&gt;

&lt;p&gt;There are extensions that fix this. I didn't install any of them.&lt;/p&gt;

&lt;p&gt;Not because they're malicious — I have no evidence of that. Because of what they ask for. An extension that manages your chats needs to run on &lt;code&gt;chatgpt.com&lt;/code&gt; with your session active. That is the same page that holds every conversation you've ever had. If the code is minified and the permissions are broad, "trust me" is the only thing on offer.&lt;/p&gt;

&lt;p&gt;So I built my own, and made it boring on purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bulk Delete for ChatGPT&lt;/strong&gt; is now live on Mozilla's add-on site: &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/bulk-delete-for-chatgpt/" rel="noopener noreferrer"&gt;addons.mozilla.org/en-US/firefox/addon/bulk-delete-for-chatgpt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is unofficial, MIT licensed, and at the time of writing has exactly zero users. That's the honest state of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The constraint I started with
&lt;/h2&gt;

&lt;p&gt;The feature is trivial. &lt;code&gt;GET&lt;/code&gt; the conversation list, &lt;code&gt;DELETE&lt;/code&gt; the ones selected. That's maybe 40 lines.&lt;/p&gt;

&lt;p&gt;The hard part is everything around it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do you prove the extension can't delete something you didn't tick?&lt;/li&gt;
&lt;li&gt;How do you stop a misclick from wiping a year of history?&lt;/li&gt;
&lt;li&gt;What happens when the session expires halfway through 200 deletions?&lt;/li&gt;
&lt;li&gt;How do you know the deletes actually happened, instead of the UI just saying so?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those questions produced most of the design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six decisions that matter
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. It is a dry run until you say otherwise
&lt;/h3&gt;

&lt;p&gt;The first button press does nothing. It walks the whole flow, logs what it &lt;em&gt;would&lt;/em&gt; delete, and changes no state.&lt;/p&gt;

&lt;p&gt;You have to press a second time, in a different mode, to delete anything. That single extra step has caught every accidental click I've made while testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. There is no "delete all"
&lt;/h3&gt;

&lt;p&gt;No "select all", no "delete filtered", no date rules. The codebase contains one deletion loop, and it iterates over a &lt;code&gt;Set&lt;/code&gt; of IDs that came from checkboxes.&lt;/p&gt;

&lt;p&gt;"Select all shown" exists, but it only applies to the current search filter and it tells you the count before you commit — &lt;code&gt;Select all 47 shown&lt;/code&gt;. If the number looks wrong, you stop.&lt;/p&gt;

&lt;p&gt;That distinction matters. A "delete everything older than 30 days" button is one bad regex away from a very bad afternoon.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The token is never stored
&lt;/h3&gt;

&lt;p&gt;The extension doesn't ask you to paste an API key, and it doesn't have a login screen. At the start of each run it reads the session token from the page's own &lt;code&gt;/api/auth/session&lt;/code&gt; endpoint, keeps it in memory for the duration of the run, and lets it go.&lt;/p&gt;

&lt;p&gt;Nothing is written to &lt;code&gt;localStorage&lt;/code&gt;, &lt;code&gt;chrome.storage&lt;/code&gt;, or a cookie. There is no server to send it to — there is no server at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. It stops on the errors that mean stop
&lt;/h3&gt;

&lt;p&gt;Auth failures and rate limits are not retried. They abort the run and tell you what happened:&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;401&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;unauthorized&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;429&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;rateLimited&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;Transient failures get exactly one retry. A &lt;code&gt;404&lt;/code&gt; on that retry is treated as success — the chat is already gone, which is the outcome you wanted:&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ok&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="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;alreadyGone&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sounds obvious until you've watched a naive script hammer a rate-limited API for 300 requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. It verifies the result, not the promises
&lt;/h3&gt;

&lt;p&gt;After a run, the extension re-reads the server's own conversation total and compares:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Server total 312 → 300 (Δ12)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If 12 chats were reported deleted, the total must have dropped by 12. If it didn't, you see that immediately instead of assuming it worked.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. You type the number to confirm
&lt;/h3&gt;

&lt;p&gt;The final confirmation requires typing the count of selected chats. Not clicking "OK" — typing &lt;code&gt;12&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It's slightly annoying. That's the point. It's the difference between a misclick and a decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test I actually care about
&lt;/h2&gt;

&lt;p&gt;Unit tests would prove the loop counts correctly. The thing I wanted to prove was different: &lt;strong&gt;that only ticked conversations get deleted.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So the repo has an end-to-end suite that runs the real extension in a real browser against a fake &lt;code&gt;chatgpt.com&lt;/code&gt; — a local server that mimics the session endpoint, the list endpoint, and the delete endpoint, behind a self-signed certificate. It ticks a subset, runs a delete, and asserts on the server side that the deleted IDs are exactly the ticked IDs.&lt;/p&gt;

&lt;p&gt;Every safety claim above is a test, not a comment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;p&gt;Firefox gets a one-click install:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/bulk-delete-for-chatgpt/" rel="noopener noreferrer"&gt;Bulk Delete for ChatGPT →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the page, press &lt;strong&gt;Add to Firefox&lt;/strong&gt;, then &lt;strong&gt;Add&lt;/strong&gt;. Reload &lt;code&gt;chatgpt.com&lt;/code&gt;. There's a small "Bulk delete" button in the bottom-right corner.&lt;/p&gt;

&lt;p&gt;Chrome, Edge, and Brave work too, but by hand — the Chrome Web Store charges a one-time developer fee and I haven't paid it. The releases page has the zip; &lt;code&gt;chrome://extensions&lt;/code&gt; with Developer mode on will load it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Back up first.&lt;/strong&gt; ChatGPT → Settings → Data controls → Export data. Deleting a conversation is permanent, the extension has no undo, and the export is the only way back.&lt;/p&gt;

&lt;h2&gt;
  
  
  The limitations, honestly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It depends on ChatGPT's private endpoints.&lt;/strong&gt; If OpenAI changes them, it breaks. It's a small codebase, but it's still a moving target.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Firefox on Android is untested.&lt;/strong&gt; I deliberately left it out of the listing rather than claim support I haven't verified.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No undo.&lt;/strong&gt; By design — a "recently deleted" bin would mean the extension keeps a copy of your chats, which defeats the point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero users.&lt;/strong&gt; This is a v1.0.0 that just passed review. If something is broken, an issue on GitHub is the fastest way to get it fixed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why publish it at all
&lt;/h2&gt;

&lt;p&gt;Because the alternative was another minified extension asking for broad permissions on a page where people keep their most private conversations. The source is four files and about a thousand lines, with no build step. You can read all of it in one sitting and decide for yourself.&lt;/p&gt;

&lt;p&gt;That's the whole pitch. Not "fastest", not "smartest". Small enough to check.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Aashutosh31/bulk-delete-for-chatgpt" rel="noopener noreferrer"&gt;github.com/Aashutosh31/bulk-delete-for-chatgpt&lt;/a&gt;&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>firefox</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Your dotfiles installer should be able to repair itself</title>
      <dc:creator>Aashutosh Bairagi</dc:creator>
      <pubDate>Mon, 16 Nov 2026 12:52:29 +0000</pubDate>
      <link>https://dev.to/aashutosh_bairagi_31/your-dotfiles-installer-should-be-able-to-repair-itself-j7h</link>
      <guid>https://dev.to/aashutosh_bairagi_31/your-dotfiles-installer-should-be-able-to-repair-itself-j7h</guid>
      <description>&lt;p&gt;Every dotfiles repo starts the same way: one &lt;code&gt;install.sh&lt;/code&gt;, a list of packages, and a &lt;code&gt;cp -r&lt;/code&gt; into &lt;code&gt;~/.config&lt;/code&gt;. It works exactly once, on the machine where you wrote it.&lt;/p&gt;

&lt;p&gt;Mine broke in the places nobody warns you about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A fresh install half-succeeds, then the terminal opens with an error on every prompt.&lt;/li&gt;
&lt;li&gt;Re-running the installer overwrites configs I had edited by hand.&lt;/li&gt;
&lt;li&gt;A package gets renamed upstream, and now the whole script dies at step 3.&lt;/li&gt;
&lt;li&gt;The desktop session is live, &lt;code&gt;~/.config/hypr&lt;/code&gt; is briefly empty, and Hyprland panics.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I stopped trying to write a better installer. I split the job into four scripts that each do one thing, and made every one of them safe to run twice.&lt;/p&gt;

&lt;p&gt;That's the whole idea: &lt;strong&gt;an installer you run once is a liability. A repair tool you can run any time is an asset.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The four scripts
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Script&lt;/th&gt;
&lt;th&gt;Job&lt;/th&gt;
&lt;th&gt;Touches your system?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bootstrap.sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Get a bare Arch install to the point where &lt;code&gt;install.sh&lt;/code&gt; can run&lt;/td&gt;
&lt;td&gt;Yes — installs git and &lt;code&gt;yay&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;install.sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;4 stages: packages, AUR, configs, shell environment&lt;/td&gt;
&lt;td&gt;Yes — backs up first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;doctor.sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read-only health check; exit code 1 on failure&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;repair.sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fix a partial install without reinstalling&lt;/td&gt;
&lt;td&gt;Yes — only what's broken&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;bootstrap&lt;/code&gt; is for a machine that doesn't have the repo yet. &lt;code&gt;install&lt;/code&gt; is the normal path. &lt;code&gt;doctor&lt;/code&gt; tells you what's wrong. &lt;code&gt;repair&lt;/code&gt; fixes it.&lt;/p&gt;

&lt;p&gt;The important part isn't the number four. It's that &lt;strong&gt;installation and diagnosis are separate programs&lt;/strong&gt;. When they're the same script, the only way to find out what's broken is to run the thing that changes your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 1: read-only beats "just re-run it"
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;doctor.sh&lt;/code&gt; checks, and touches nothing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;required packages present&lt;/li&gt;
&lt;li&gt;every command &lt;code&gt;.zshrc&lt;/code&gt; depends on actually resolves on &lt;code&gt;$PATH&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/bin/zsh&lt;/code&gt; and &lt;code&gt;/usr/bin/zsh&lt;/code&gt; exist, and zsh is listed in &lt;code&gt;/etc/shells&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;the login shell is zsh&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;~/.local/bin/env&lt;/code&gt; and &lt;code&gt;env.fish&lt;/code&gt; exist&lt;/li&gt;
&lt;li&gt;the zsh plugin files are where zsh expects them&lt;/li&gt;
&lt;li&gt;broken symlinks under &lt;code&gt;~/.config&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;drift between the repo and the installed configs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It exits non-zero when something required is missing, so it's usable outside a human session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./doctor.sh &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"environment is broken — run ./repair.sh"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Diagnosis without mutation is the single highest-value thing in the repo. Half the "my dotfiles are broken" posts online are really "I don't know which of forty things is missing."&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 2: idempotent means &lt;code&gt;[SKIP]&lt;/code&gt;, not "it didn't crash"
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;repair.sh&lt;/code&gt; is designed to be run fifty times. Unchanged state prints &lt;code&gt;[SKIP]&lt;/code&gt; and moves on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;==&amp;gt; Step 1/5: Checking required packages...
[SKIP]     all 12 required packages already installed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two rules make that possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never delete a config directory.&lt;/strong&gt; &lt;code&gt;cp -r repo/hypr ~/.config/hypr&lt;/code&gt; while Hyprland is running can leave the compositor reading a half-written file. Instead, back up and replace file by file, in place:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;install_cfg&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;tool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$1"&lt;/span&gt;
    &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$REPO/$tool/.config/$tool"&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt; -d &lt;span class="s2"&gt;"$src"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 0
    mkdir -p &lt;span class="s2"&gt;"$HOME/.config/$tool"&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; -r -d &lt;span class="s1"&gt;''&lt;/span&gt; file&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
        &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${file#"&lt;/span&gt;&lt;span class="nv"&gt;$src&lt;/span&gt;&lt;span class="s2"&gt;"/}"&lt;/span&gt;
        backup_item &lt;span class="s2"&gt;"$HOME/.config/$tool/$rel"&lt;/span&gt;
        mkdir -p &lt;span class="s2"&gt;"$(dirname "&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;/.config/&lt;span class="nv"&gt;$tool&lt;/span&gt;/&lt;span class="nv"&gt;$rel&lt;/span&gt;&lt;span class="s2"&gt;")"&lt;/span&gt;
        cp -f &lt;span class="s2"&gt;"$file"&lt;/span&gt; &lt;span class="s2"&gt;"$HOME/.config/$tool/$rel"&lt;/span&gt;
    &lt;span class="k"&gt;done&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;find &lt;span class="s2"&gt;"$src"&lt;/span&gt; -type f -print0&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The directory is never missing, so a live session never sees a hole.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never run &lt;code&gt;chsh&lt;/code&gt; when the shell is already correct.&lt;/strong&gt; &lt;code&gt;chsh&lt;/code&gt; is interactive, needs a password, and fails in scripts. Check first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ensure_login_shell_is_zsh&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    login_shell_is_zsh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 0
    &lt;span class="c"&gt;# ... only now change it&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Lesson 3: don't fight the distro's package manager
&lt;/h2&gt;

&lt;p&gt;I run Arch with &lt;a href="https://github.com/basecamp/omarchy" rel="noopener noreferrer"&gt;Omarchy&lt;/a&gt;. Omarchy enforces a rule: system upgrades go through &lt;code&gt;omarchy update&lt;/code&gt;, not &lt;code&gt;pacman -Syu&lt;/code&gt;. There's an ALPM hook that will stop you if you try.&lt;/p&gt;

&lt;p&gt;My first installer did &lt;code&gt;pacman -Syu --needed &amp;lt;201 packages&amp;gt;&lt;/code&gt;. On Omarchy that's not just rude — it's blocked, and it makes the install non-reproducible on a machine that's mid-update.&lt;/p&gt;

&lt;p&gt;The fix is to only ever ask for what's missing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; -v omarchy-pkg-add &lt;span class="o"&gt;&amp;amp;&amp;gt;&lt;/span&gt;/dev/null&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    omarchy-pkg-add &lt;span class="s2"&gt;"${official_pkgs[@]}"&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; -v pacman &lt;span class="o"&gt;&amp;amp;&amp;gt;&lt;/span&gt;/dev/null&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    sudo pacman -S --needed --noconfirm &lt;span class="s2"&gt;"${official_pkgs[@]}"&lt;/span&gt;    
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;201 official packages, 10 AUR packages, zero upgrades. The distro stays in charge of its own state; the dotfiles repo only fills gaps.&lt;/p&gt;

&lt;p&gt;That distinction is worth internalising: &lt;strong&gt;installer = converge to a desired state. Upgrader = move the system forward.&lt;/strong&gt; Mixing them is why "just re-run the installer" has a reputation for breaking systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 4: the dependency that isn't in your package list
&lt;/h2&gt;

&lt;p&gt;This one cost me the most time, and it's invisible in every dotfiles guide.&lt;/p&gt;

&lt;p&gt;The last line of my &lt;code&gt;.zshrc&lt;/code&gt; sources &lt;code&gt;~/.local/bin/env&lt;/code&gt;. That file isn't created by zsh, by pacman, by mise, or by my repo. It's created by &lt;strong&gt;uv's standalone installer&lt;/strong&gt;. On a fresh machine, every shell start printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/home/you/.local/share/../bin/env: No such file or directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copying &lt;code&gt;.zshrc&lt;/code&gt; correctly is not the same as having a working shell. So &lt;code&gt;install.sh&lt;/code&gt; and &lt;code&gt;repair.sh&lt;/code&gt; both recreate the file with uv's exact template when it's missing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ensure_local_bin_env&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt; -f &lt;span class="s2"&gt;"$HOME/.local/bin/env"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 0
    mkdir -p &lt;span class="s2"&gt;"$HOME/.local/bin"&lt;/span&gt;
    uv_env_sh_content &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$HOME/.local/bin/env"&lt;/span&gt;
    chmod +x &lt;span class="s2"&gt;"$HOME/.local/bin/env"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The general lesson: &lt;strong&gt;a shell config has runtime dependencies that aren't packages.&lt;/strong&gt; Grep your own &lt;code&gt;.zshrc&lt;/code&gt; for &lt;code&gt;source&lt;/code&gt; and &lt;code&gt;eval "$(... init ...)"&lt;/code&gt;, and make the installer responsible for every one of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 5: back up before every overwrite, and say where
&lt;/h2&gt;

&lt;p&gt;Every file that gets replaced is copied first into a timestamped directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.dotfiles-backup/20261114-153012/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not a &lt;code&gt;cp -r&lt;/code&gt; of the whole home directory. Just the specific files about to be touched, preserving paths. The installer prints the path at the end.&lt;/p&gt;

&lt;p&gt;That single behaviour turns "I lost my config" into "I lost four minutes." And because the backups are gitignored, they never end up in the repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the whole thing looks like now
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bootstrap.sh   → fresh Arch: git + yay + clone + hand off to install.sh
install.sh     → 4 stages, backs up first, never upgrades, validates Hyprland config
doctor.sh      → read-only, exit 1 on failure, safe in CI
repair.sh      → idempotent, [SKIP] on unchanged, fixes only what's broken
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;130 tracked files, including the Hyprland config written in Lua, a custom Quickshell bar plugin, and the terminal, editor, and shell configs. 791 lines of shell across the four scripts.&lt;/p&gt;

&lt;p&gt;And the workflow after a reinstall is now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/Aashutosh31/dotfiles.git ~/dotfiles
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/dotfiles &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ./install.sh
&lt;span class="c"&gt;# if anything looks off:&lt;/span&gt;
./doctor.sh
./repair.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I'd do differently
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write &lt;code&gt;doctor.sh&lt;/code&gt; first.&lt;/strong&gt; I wrote it after the third time I couldn't tell why a shell was broken. Every check in it is a bug I hit once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep a required-vs-recommended split.&lt;/strong&gt; &lt;code&gt;fzf&lt;/code&gt;, &lt;code&gt;uv&lt;/code&gt;, and &lt;code&gt;fish&lt;/code&gt; are recommended, not required. The installer warns and continues instead of failing, which means it works on machines that aren't mine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate the compositor config, not just the files.&lt;/strong&gt; &lt;code&gt;hyprctl configerrors&lt;/code&gt; after install catches a Lua syntax error that would otherwise show up as a black screen:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; -v hyprctl &lt;span class="o"&gt;&amp;amp;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pgrep -x Hyprland &lt;span class="o"&gt;&amp;amp;&amp;gt;&lt;/span&gt;/dev/null&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nv"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(hyprctl configerrors 2&amp;gt;/dev/null)"&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt; -n &lt;span class="s2"&gt;"$errors"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"WARNING: $errors"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Treat every error message as documentation.&lt;/strong&gt; The installer now tells you what to run next, not just that something failed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Steal the structure, not the files
&lt;/h2&gt;

&lt;p&gt;You don't need my theme, my bar, or my keybindings. You need the split:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;doctor&lt;/code&gt; — read-only, exits non-zero, tells the truth.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;repair&lt;/code&gt; — idempotent, prints &lt;code&gt;[SKIP]&lt;/code&gt;, fixes only what's broken.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;install&lt;/code&gt; — converges state, never upgrades, backs up every overwrite.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bootstrap&lt;/code&gt; — gets a machine to the point where the other three exist.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If your dotfiles only have step 3, you have an installer. You don't yet have something you can trust on a machine that isn't yours.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Aashutosh31/dotfiles" rel="noopener noreferrer"&gt;github.com/Aashutosh31/dotfiles&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>archlinux</category>
      <category>opensource</category>
      <category>bash</category>
    </item>
    <item>
      <title>From a Fresh Arch Install to a Fully Configured Development Environment in One Command</title>
      <dc:creator>Aashutosh Bairagi</dc:creator>
      <pubDate>Mon, 20 Jul 2026 18:31:55 +0000</pubDate>
      <link>https://dev.to/aashutosh_bairagi_31/from-a-fresh-arch-install-to-a-fully-configured-development-environment-in-one-command-4cg5</link>
      <guid>https://dev.to/aashutosh_bairagi_31/from-a-fresh-arch-install-to-a-fully-configured-development-environment-in-one-command-4cg5</guid>
      <description>&lt;p&gt;&lt;em&gt;How I automated my Arch Linux + Omarchy + Hyprland setup with reproducible dotfiles, backups, and a single bootstrap script.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/VLXFC8DVdHk" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Like many Arch Linux users, I've reinstalled my system more times than I'd like to admit.&lt;/p&gt;

&lt;p&gt;Every reinstall meant spending hours installing packages, configuring Hyprland, tweaking Waybar, setting up Ghostty, restoring VS Code settings, copying wallpapers, and hoping I didn't forget some tiny configuration that I'd eventually notice days later.&lt;/p&gt;

&lt;p&gt;I wanted my development environment to be reproducible.&lt;/p&gt;

&lt;p&gt;So I built a repository that can recreate my entire setup—from packages to desktop configuration—with a single command while safely backing up any existing configuration before making changes.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub Repository:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/Aashutosh31/dotfiles" rel="noopener noreferrer"&gt;https://github.com/Aashutosh31/dotfiles&lt;/a&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  Why I Built This
&lt;/h1&gt;

&lt;p&gt;I wanted a setup that could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Recreate my workstation in minutes&lt;/li&gt;
&lt;li&gt;Install required packages automatically&lt;/li&gt;
&lt;li&gt;Restore all configurations&lt;/li&gt;
&lt;li&gt;Never overwrite files without creating a backup&lt;/li&gt;
&lt;li&gt;Stay version-controlled in Git&lt;/li&gt;
&lt;li&gt;Be easy to maintain and extend&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of manually configuring everything after every reinstall, I wanted to simply run one command.&lt;/p&gt;


&lt;h1&gt;
  
  
  What's Included
&lt;/h1&gt;
&lt;h2&gt;
  
  
  Desktop
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Distribution:&lt;/strong&gt; Arch Linux (Omarchy)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Window Manager:&lt;/strong&gt; Hyprland&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Status Bar:&lt;/strong&gt; Waybar&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Theme:&lt;/strong&gt; Tokyo Night&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Terminal
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Terminal:&lt;/strong&gt; Ghostty&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shell:&lt;/strong&gt; Zsh&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt:&lt;/strong&gt; Starship&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System Information:&lt;/strong&gt; Fastfetch&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Development
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Editor:&lt;/strong&gt; VS Code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alternative Editor:&lt;/strong&gt; LazyVim&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terminal Multiplexer:&lt;/strong&gt; Zellij&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Utilities
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File Manager:&lt;/strong&gt; Yazi&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audio:&lt;/strong&gt; Wiremix&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OSD:&lt;/strong&gt; SwayOSD&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  Desktop Preview
&lt;/h1&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcyqq1ppxr13nm2lf1hn7.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcyqq1ppxr13nm2lf1hn7.png" alt="Desktop Preview" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is my everyday desktop powered by Hyprland, Waybar, Ghostty, and the Tokyo Night color scheme.&lt;/p&gt;

&lt;p&gt;The goal wasn't to create an eye-catching desktop for screenshots—it was to build something comfortable enough to use every day for software development.&lt;/p&gt;


&lt;h1&gt;
  
  
  Terminal Setup
&lt;/h1&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsa5pojpu9rera1i35wgs.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsa5pojpu9rera1i35wgs.png" alt="Terminal" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ghostty has become my preferred terminal thanks to its speed and modern rendering.&lt;/p&gt;

&lt;p&gt;Combined with Zsh, Starship, and Fastfetch, it creates a clean and productive terminal experience.&lt;/p&gt;


&lt;h1&gt;
  
  
  VS Code Configuration
&lt;/h1&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fahiotiu8lvhg7676t0g2.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fahiotiu8lvhg7676t0g2.png" alt="VS Code" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although the repository also includes my LazyVim configuration, VS Code is currently my primary editor.&lt;/p&gt;

&lt;p&gt;My VS Code setup includes custom settings, extensions, keybindings, and themes that match the rest of the desktop.&lt;/p&gt;


&lt;h1&gt;
  
  
  Yazi File Manager
&lt;/h1&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6fqs8o1bridl0hf1xa8r.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6fqs8o1bridl0hf1xa8r.png" alt="Yazi" width="799" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yazi is an incredibly fast terminal file manager that fits naturally into my workflow.&lt;/p&gt;

&lt;p&gt;It's keyboard-driven, lightweight, and feels right at home alongside the rest of the terminal-based tools.&lt;/p&gt;


&lt;h1&gt;
  
  
  One Command Installation
&lt;/h1&gt;

&lt;p&gt;For a fresh Arch installation, everything can be installed using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/Aashutosh31/dotfiles/main/bootstrap.sh &lt;span class="o"&gt;|&lt;/span&gt; bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The bootstrap script automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installs Git (if needed)&lt;/li&gt;
&lt;li&gt;Installs &lt;code&gt;yay&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Clones the repository&lt;/li&gt;
&lt;li&gt;Installs required packages&lt;/li&gt;
&lt;li&gt;Applies all configurations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, the actual installation is handled by &lt;code&gt;install.sh&lt;/code&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  Automatic Backups
&lt;/h1&gt;

&lt;p&gt;One feature I cared about the most was safety.&lt;/p&gt;

&lt;p&gt;Before replacing &lt;strong&gt;any&lt;/strong&gt; configuration, the installer creates a timestamped backup.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.dotfiles-backup/
└── 20260720-184501/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing gets overwritten without first being backed up.&lt;/p&gt;

&lt;p&gt;If I ever want to restore an older configuration, it's just a simple copy operation.&lt;/p&gt;




&lt;h1&gt;
  
  
  Repository Structure
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── hypr/
├── ghostty/
├── fastfetch/
├── starship/
├── yazi/
├── vscode/
├── waybar/
├── wallpapers/
├── packages/
├── scripts/
├── install.sh
└── bootstrap.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keeping every application's configuration inside its own directory makes the repository easier to maintain and extend over time.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why I Didn't Use GNU Stow
&lt;/h1&gt;

&lt;p&gt;Many dotfile repositories rely on GNU Stow.&lt;/p&gt;

&lt;p&gt;While it's a great tool, I wanted something that also handled package installation, backups, and first-time machine setup.&lt;/p&gt;

&lt;p&gt;The installer performs everything in one workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Package installation&lt;/li&gt;
&lt;li&gt;Backup creation&lt;/li&gt;
&lt;li&gt;Configuration deployment&lt;/li&gt;
&lt;li&gt;Initial machine bootstrap&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it much easier to move to a brand-new machine.&lt;/p&gt;




&lt;h1&gt;
  
  
  Lessons Learned
&lt;/h1&gt;

&lt;p&gt;Working on this project taught me a lot beyond shell scripting.&lt;/p&gt;

&lt;p&gt;Some takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Good documentation is just as important as good code.&lt;/li&gt;
&lt;li&gt;Automated backups make installation much safer.&lt;/li&gt;
&lt;li&gt;Modular configuration directories are much easier to maintain.&lt;/li&gt;
&lt;li&gt;Version-controlling your development environment saves a tremendous amount of time.&lt;/li&gt;
&lt;li&gt;Small automation scripts quickly become some of the most useful tools you write.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Future Improvements
&lt;/h1&gt;

&lt;p&gt;There are still plenty of ideas I'd like to add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Theme switching&lt;/li&gt;
&lt;li&gt;Optional package groups&lt;/li&gt;
&lt;li&gt;Better wallpaper management&lt;/li&gt;
&lt;li&gt;CI validation&lt;/li&gt;
&lt;li&gt;More customization options&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;What started as a personal backup of my Linux setup gradually evolved into a fully reproducible development environment.&lt;/p&gt;

&lt;p&gt;If you're using Arch Linux, Omarchy, or Hyprland, I hope this repository helps you build your own workflow—or at least gives you some ideas for organizing your own dotfiles.&lt;/p&gt;

&lt;p&gt;If you find it useful, feel free to ⭐ star the repository, open an issue, or suggest improvements.&lt;/p&gt;

&lt;p&gt;I'd love to hear your feedback.&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Repository
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/Aashutosh31/dotfiles" rel="noopener noreferrer"&gt;https://github.com/Aashutosh31/dotfiles&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>archlinux</category>
      <category>programming</category>
      <category>hyprland</category>
    </item>
    <item>
      <title>ARC-AI: I built an autonomous, AI agent workspace Using MERN stack (RAG memory, live web research, WhatsApp automation, and more)</title>
      <dc:creator>Aashutosh Bairagi</dc:creator>
      <pubDate>Sat, 18 Jul 2026 18:54:45 +0000</pubDate>
      <link>https://dev.to/aashutosh_bairagi_31/arc-ai-i-built-an-autonomous-self-hosted-ai-agent-workspace-on-the-mern-stack-rag-memory-live-3hdj</link>
      <guid>https://dev.to/aashutosh_bairagi_31/arc-ai-i-built-an-autonomous-self-hosted-ai-agent-workspace-on-the-mern-stack-rag-memory-live-3hdj</guid>
      <description>&lt;h2&gt;
  
  
  🤖 What is ARC-AI?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;ARC-AI (Autonomous Real-time Conversational Agent)&lt;/strong&gt; is a full-stack, voice-activated AI assistant I've been building that goes beyond the typical "chatbot with a system prompt." It's a persistent, AI workspace with long-term memory, live web research, proactive scheduled routines, and the ability to actually &lt;em&gt;act&lt;/em&gt; — sending WhatsApp messages, emails, and controlling its own UI.&lt;/p&gt;

&lt;p&gt;Think of it as sitting somewhere between ChatGPT, Claude, and Cursor — but self-hosted, MERN-based, and fully yours.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;Live demo:&lt;/strong&gt; &lt;a href="https://arc-ai-project.vercel.app/" rel="noopener noreferrer"&gt;https://arc-ai-project.vercel.app/&lt;/a&gt;&lt;br&gt;
🔗 &lt;strong&gt;Source code:&lt;/strong&gt; &lt;a href="https://github.com/Aashutosh31/arc-ai-project" rel="noopener noreferrer"&gt;https://github.com/Aashutosh31/arc-ai-project&lt;/a&gt;&lt;br&gt;
📽️ &lt;strong&gt;Latest Video:&lt;/strong&gt;&lt;a href="https://www.instagram.com/aashutosh_bairagi.31/reel/DYmluEPxOhf/" rel="noopener noreferrer"&gt;https://www.instagram.com/aashutosh_bairagi.31/reel/DYmluEPxOhf/&lt;/a&gt;&lt;br&gt;
🎥 &lt;strong&gt;Full walkthrough:&lt;/strong&gt; &lt;a href="https://www.youtube.com/watch?v=jt7q8v5KsrU" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=jt7q8v5KsrU&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpvmdi2ci9gpa9in2fbd1.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpvmdi2ci9gpa9in2fbd1.png" alt="ARC-AI" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Why I built it
&lt;/h2&gt;

&lt;p&gt;Most "AI assistants" are reactive — you ask, it answers, and it forgets everything the moment the tab closes. I wanted something that behaves more like an actual agent: it remembers what matters, researches things on its own, runs scheduled tasks in the background, and can reach across into the real world (browser, WhatsApp, email) instead of being boxed into a chat window.&lt;/p&gt;

&lt;p&gt;That meant building real infrastructure, not just wiring up an LLM API call — a provider-agnostic runtime, workspace isolation, vector memory, sandboxed code execution, and production-grade lifecycle management.&lt;/p&gt;


&lt;h2&gt;
  
  
  🧠 Core Features
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Infinite Memory (RAG)
&lt;/h3&gt;

&lt;p&gt;ARC-AI doesn't just keep a chat log — it separates memory into four distinct layers to avoid contamination and keep retrieval sharp:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Conversation History&lt;/li&gt;
&lt;li&gt;Working Context&lt;/li&gt;
&lt;li&gt;Semantic Memory&lt;/li&gt;
&lt;li&gt;Long-Term User Facts
Retrieval runs through relevance scoring, recency weighting, and duplicate suppression using &lt;strong&gt;Pinecone&lt;/strong&gt; vector search, so the assistant pulls in prioritized, low-noise context instead of dumping everything it knows into the prompt.&lt;/li&gt;
&lt;/ol&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6pa64uejoolohrlsued.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6pa64uejoolohrlsued.png" alt="Command Pallete" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  🎥 Live Vision &amp;amp; Multimodal Routing
&lt;/h3&gt;

&lt;p&gt;ARC-AI can see. When you speak while your webcam is active, it captures the current frame and pipes it straight into the same real-time socket payload as your voice input, routing visual context to a vision-capable model (Pixtral) with guardrails to prevent silent attachment loss on fallback.&lt;/p&gt;
&lt;h3&gt;
  
  
  🌐 Live Web Research
&lt;/h3&gt;

&lt;p&gt;Real-time DOM scraping (Cheerio) plus API-based search, weather, and news retrieval — so answers aren't capped at a training cutoff.&lt;/p&gt;
&lt;h3&gt;
  
  
  ⏰ Proactive Routine Engine
&lt;/h3&gt;

&lt;p&gt;Ask it in plain English and it turns that into a scheduled cron job — recurring reminders, deferred tasks, background routines — no manual cron syntax required.&lt;/p&gt;
&lt;h3&gt;
  
  
  💬 WhatsApp Automation
&lt;/h3&gt;

&lt;p&gt;Full autonomous message composition and delivery through an integrated WhatsApp workflow, so the agent can actually reach you (or others) outside the app.&lt;/p&gt;
&lt;h3&gt;
  
  
  🖥️ UI Actuation
&lt;/h3&gt;

&lt;p&gt;The assistant can act on its own interface — switching themes, opening websites, playing media, copying to clipboard — driven directly by conversational context.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbaz9gdcu136jljya6hm.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbaz9gdcu136jljya6hm.png" alt="Isolated-WorkSpaces" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🏗️ Under the Hood: Provider-Agnostic, Workspace-Isolated Runtime
&lt;/h2&gt;

&lt;p&gt;The architecture went through several major evolutions to get here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Provider-orchestrated runtime&lt;/strong&gt; — an &lt;code&gt;LLMRouter&lt;/code&gt; dynamically selects between &lt;strong&gt;Gemini&lt;/strong&gt; (reasoning, multimodal, planning, long-context) and &lt;strong&gt;Mistral&lt;/strong&gt; (fast, cheap, summarization, fallback), while preserving streaming continuity and tool-call consistency across providers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-workspace runtime&lt;/strong&gt; — every workspace behaves as its own isolated environment. Conversations, memories, executions, and even Pinecone vector namespaces are fully scoped per workspace, with zero cross-workspace leakage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution isolation&lt;/strong&gt; — the &lt;code&gt;TaskPlanner&lt;/code&gt;/&lt;code&gt;TaskExecutor&lt;/code&gt; system keeps retries, recovery, and replanning strictly bound to their originating workspace.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  - &lt;strong&gt;Realtime Socket.IO pipeline&lt;/strong&gt; — voice or text input flows through &lt;code&gt;ai:stt:final&lt;/code&gt;, gets routed for generation, streams token-by-token, and guarantees clean finalization even on interruption.
&lt;/h2&gt;
&lt;h2&gt;
  
  
  🔥 What's new in v1.0.0 (first stable release)
&lt;/h2&gt;

&lt;p&gt;The latest release was all about turning ARC-AI from "cool demo" into something you can actually self-host in production:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security hardening&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replaced the deprecated, vulnerable &lt;code&gt;vm2&lt;/code&gt; executor with &lt;strong&gt;QuickJS WebAssembly sandboxing&lt;/strong&gt; (&lt;code&gt;quickjs-emscripten&lt;/code&gt;) for any code the LLM executes — closing an RCE vulnerability.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GOOGLE_TOKEN_ENCRYPTION_KEY&lt;/code&gt; is now a mandatory env var — the server fails fast on startup if it's missing, instead of silently falling back to something insecure.&lt;/li&gt;
&lt;li&gt;Replaced wildcard CORS with a dynamic origin resolver, fixing credentialed-request validation issues.
&lt;strong&gt;Runtime reliability&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;An activity-aware idle reaper kills headless Chromium (WhatsApp) sessions after 5 minutes of inactivity, so it stops eating RAM/CPU.&lt;/li&gt;
&lt;li&gt;Graceful shutdown on &lt;code&gt;SIGINT&lt;/code&gt;/&lt;code&gt;SIGTERM&lt;/code&gt; — HTTP servers, MongoDB connections, and Puppeteer/WhatsApp processes all tear down cleanly and in parallel.&lt;/li&gt;
&lt;li&gt;Fixed race conditions between client destruction and recovery hooks.
&lt;strong&gt;Onboarding &amp;amp; deployment&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Docker Compose now uses portable relative bind mounts instead of hardcoded host paths.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  - Full &lt;code&gt;.env.example&lt;/code&gt; templates for both root and server, documenting every LLM routing/model/timeout option.
&lt;/h2&gt;
&lt;h2&gt;
  
  
  💻 Tech Stack
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Frontend&lt;/td&gt;
&lt;td&gt;React, Vite, Tailwind CSS, Web Speech API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backend&lt;/td&gt;
&lt;td&gt;Node.js, Express.js, Socket.IO, node-cron&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;MongoDB Atlas, Pinecone (vector RAG)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI / ML&lt;/td&gt;
&lt;td&gt;Gemini, Mistral AI, Pixtral&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Infra&lt;/td&gt;
&lt;td&gt;Docker Compose, Google Apps Script (webhook email)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  ⚙️ Try it yourself
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/Aashutosh31/arc-ai-project.git
&lt;span class="nb"&gt;cd&lt;/span&gt; arc-ai-project/server
npm install
cp .env.example .env   &lt;span class="c"&gt;# fill in your keys — GOOGLE_TOKEN_ENCRYPTION_KEY is mandatory&lt;/span&gt;
npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Or spin it up with Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; server
cp .env.example .env
docker compose up --build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full setup instructions (frontend, Docker, persistent WhatsApp sessions) are in the &lt;a href="https://github.com/Aashutosh31/arc-ai-project" rel="noopener noreferrer"&gt;README&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;I'm continuing to harden the multi-workspace runtime and expand the autonomous tool ecosystem. If you try it out, run into issues, or have ideas, I'd genuinely love the feedback — issues and PRs are open on the repo.&lt;/p&gt;

&lt;p&gt;If this is interesting to you, a ⭐ on the repo goes a long way.&lt;/p&gt;

&lt;p&gt;🔗 GitHub: &lt;a href="https://github.com/Aashutosh31" rel="noopener noreferrer"&gt;github.com/Aashutosh31&lt;/a&gt;&lt;br&gt;
🔗 LinkedIn: &lt;a href="https://in.linkedin.com/in/aashutosh-bairagi-559aa530b" rel="noopener noreferrer"&gt;https://in.linkedin.com/in/aashutosh-bairagi-559aa530b&lt;/a&gt;&lt;br&gt;
🐦 X/Twitter: &lt;a href="https://x.com/Aashutosh_dev31" rel="noopener noreferrer"&gt;@Aashutosh_dev31&lt;/a&gt;&lt;br&gt;
🌐 Portfolio: &lt;a href="https://aashutoshbairagi.vercel.app" rel="noopener noreferrer"&gt;aashutoshbairagi.vercel.app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How I Built a Real-Time Stock Suggestion App with the MERN Stack, WebSockets, and Algorithmic Trading Logic ?</title>
      <dc:creator>Aashutosh Bairagi</dc:creator>
      <pubDate>Mon, 10 Nov 2025 17:59:12 +0000</pubDate>
      <link>https://dev.to/aashutosh_bairagi_31/how-i-built-a-real-time-stock-suggestion-app-with-the-mern-stack-websockets-and-algorithmic-1mk7</link>
      <guid>https://dev.to/aashutosh_bairagi_31/how-i-built-a-real-time-stock-suggestion-app-with-the-mern-stack-websockets-and-algorithmic-1mk7</guid>
      <description>&lt;p&gt;&lt;a href="https://stock-suggestion-application.vercel.app/" rel="noopener noreferrer"&gt;Web Application Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finance and tech are converging faster than ever. As developers, we have the tools to build incredibly powerful applications that demystify market data. I set out to do just that: build a full-stack web application that not only tracks stock data but also provides actionable, AI-driven suggestions in real-time.&lt;/p&gt;

&lt;p&gt;This article is a technical deep-dive into the architecture and key features of my Stock Suggestion App. We'll cover the "AI" backend, the real-time WebSocket layer, and how it all connects to a resilient React frontend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Tech Stack 🥞&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Frontend: React 18, Vite, React Router 7, Tailwind CSS, Framer Motion.&lt;br&gt;
2.State Management: @tanstack/react-query (for server state) &amp;amp; React Context (for auth/theme).&lt;br&gt;
3.Backend: Node.js, Express, Mongoose (MongoDB).&lt;br&gt;
4.Real-time Layer: ws (WebSocketServer).&lt;br&gt;
5.Authentication: Passport.js.&lt;br&gt;
6.Charting: lightweight-charts &amp;amp; recharts.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Architecture: A Three-Layered Approach
&lt;/h2&gt;

&lt;p&gt;The app is broken down into three core components: the "AI" Signal Service, the Real-time Data Hub, and the Reactive Frontend.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;1. The "Brain": Algorithmic Signal Generation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The term "AI" gets thrown around a lot. In this project, it refers to a dedicated backend service (signalService.js) that runs technical analysis on historical stock data to generate actionable insights.&lt;/p&gt;

&lt;p&gt;It calculates several key Technical Indicators (TIs):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simple Moving Average (SMA): I calculate both the 50-day and 200-day SMAs to identify long-term trends.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Relative Strength Index (RSI): A proxy calculation to determine if a stock is overbought or oversold.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Moving Average Convergence Divergence (MACD): A proxy to gauge momentum by comparing short-term and long-term averages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These indicators are fed into two key functions:&lt;br&gt;
1.determineSignal(latestData): This function applies a rules-based logic (e.g., "if RSI &amp;lt; 30 and MACD &amp;gt; 0, signal 'Strong Buy'") to provide a clear BUY, SELL, or HOLD recommendation.&lt;/p&gt;

&lt;p&gt;2.calculateTrendingScore(latestData): This is the secret sauce for the "Top Picks" page. It generates a proprietary score from 0-100 based on a weighted average of momentum, RSI strength, and long-term trend confirmation (e.g., is the price above its 200-day SMA?).&lt;/p&gt;

&lt;p&gt;This service runs on the backend, enriches the data, and saves the results to MongoDB. This pre-calculated data is then served to the user.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;2. The "Heartbeat": Real-Time with WebSockets&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A stock app without real-time data feels static. I used the ws library to build a lightweight WebSocket server that integrates directly with the main Express API.&lt;/p&gt;

&lt;p&gt;On the Backend (server.js): Instead of running a separate server, I attach the WebSocketServer to the same HTTP server instance that Express uses. This is efficient and simplifies deployment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// In server.js...
import { WebSocketServer } from 'ws';
import { handleConnection } from './core/websocket.js';

// ... after mongoose connects ...
const server = app.listen(process.env.PORT || 5000, /* ... */);

// --- 2. INITIALIZE THE *NEW* WEBSOCKET SERVER ---
const wss = new WebSocketServer({ server }); // Attach to the Express server

wss.on('connection', (ws) =&amp;gt; {
    handleConnection(ws); // Delegate logic to a separate module
});

console.log("✅ Real-time WebSocket service initialized...");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This handleConnection module is responsible for managing connected clients and, crucially, broadcasting real-time price and signal updates as they happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. The "Face": A Resilient React Frontend&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The frontend's main challenge is managing data from two sources: a traditional REST API (for historical data, watchlist) and a WebSocket (for live updates).&lt;/p&gt;

&lt;p&gt;1.The Hybrid Data-Fetching Pattern: I landed on a powerful hybrid pattern using Tanstack Query (React Query) and a WebSocketContext. The TopPicks.jsx page is the best example of this.&lt;/p&gt;

&lt;p&gt;2.Initial Load (HTTP): The page first uses useQuery to fetch the pre-calculated list of top picks from the /api/stocks/top-picks REST endpoint. This gives the user instant, cached data.&lt;/p&gt;

&lt;p&gt;3.Live Updates (WebSocket): Simultaneously, useWebSocket() (from my custom context) is connected. It listens for live "tick" messages from the server.&lt;/p&gt;

&lt;p&gt;4.Merging Data: The component intelligently decides which data to display. If the WebSocket is connected and has sent data, it uses that live data. If not, it falls back to the useQuery batch data.&lt;/p&gt;

&lt;p&gt;Here's the key logic from TopPicks.jsx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// In TopPicks.jsx...
import { useWebSocket } from '../context/WebSocketContext';
import { useQuery } from '@tanstack/react-query';

// ...

const { topPicks: wsTopPicks, realtimeData } = useWebSocket();
const { data: batchData, isLoading } = useQuery(
    'topPicksBatch', 
    () =&amp;gt; fetchTopPicksBatch(token),
    { enabled: wsTopPicks.length === 0 } // Only run if WS isn't ready
);

// Source of Truth: Prefer live data, fall back to batch API data
const sourceData = wsTopPicks.length &amp;gt; 0 ? wsTopPicks : (batchData?.picks || []);

// Combine with real-time price ticks
const rankedStocks = sourceData.map(stock =&amp;gt; {
    const realtime = realtimeData[stock.symbol] || {};
    return {
        ...stock,
        latestPrice: realtime.price || stock.latestPrice,
        signal: realtime.signal || stock.signal, // Live signal!
    };
}).sort((a, b) =&amp;gt; b.trendingScore - a.trendingScore);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pattern makes the app feel incredibly fast and resilient. It loads instantly and provides live-tick updates without complex state management. For simpler data, like the WatchlistPage.jsx, I just use useQuery for a standard, cached fetch.&lt;/p&gt;

&lt;p&gt;Polishing the UI: To make the app feel modern, I used Tailwind CSS for all styling and Framer Motion to add subtle, satisfying animations, like the card load-in effect on the Top Picks page.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Building this app was a fantastic journey into combining data-driven backend logic with a high-performance, real-time frontend. The core challenge—merging historical analysis with live data—was solved by the hybrid useQuery/WebSocket pattern. The signalService.js was my first real attempt at codifying trading logic, and the ws library proved to be a simple yet powerful tool for the real-time layer.&lt;/p&gt;

&lt;p&gt;This architecture provides a scalable and responsive foundation, and I'm excited to continue refining the signal algorithms.&lt;/p&gt;

&lt;p&gt;Thanks for reading! I hope this deep-dive was useful. What real-time data challenges are you tackling?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How I built a Stock Suggestion app using React + node.js + free APIs ?</title>
      <dc:creator>Aashutosh Bairagi</dc:creator>
      <pubDate>Mon, 10 Nov 2025 17:43:06 +0000</pubDate>
      <link>https://dev.to/aashutosh_bairagi_31/how-i-built-a-stock-suggestion-app-using-react-nodejs-free-apis--2bn9</link>
      <guid>https://dev.to/aashutosh_bairagi_31/how-i-built-a-stock-suggestion-app-using-react-nodejs-free-apis--2bn9</guid>
      <description>&lt;p&gt;&lt;a href="https://stock-suggestion-application.vercel.app/" rel="noopener noreferrer"&gt;Application Link &lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;This is How I Built a Real-Time Stock Suggestion App with the MERN Stack, WebSockets, and Algorithmic Trading Logic!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Finance and tech are converging faster than ever. As developers, we have the tools to build incredibly powerful applications that demystify market data. I set out to do just that: build a full-stack web application that not only tracks stock data but also provides actionable, AI-driven suggestions in real-time.&lt;/p&gt;

&lt;p&gt;This article is a technical deep-dive into the architecture and key features of my Stock Suggestion App. We'll cover the "AI" backend, the real-time WebSocket layer, and how it all connects to a resilient React frontend.&lt;/p&gt;

&lt;p&gt;The Tech Stack 🥞&lt;/p&gt;

&lt;p&gt;1.Frontend: React 18, Vite, React Router 7, Tailwind CSS, Framer Motion.&lt;/p&gt;

&lt;p&gt;2.State Management: @tanstack/react-query (for server state) &amp;amp; React                    Context (for auth/theme).&lt;/p&gt;

&lt;p&gt;3.Backend: Node.js, Express, Mongoose (MongoDB).&lt;/p&gt;

&lt;p&gt;4.Real-time Layer: ws (WebSocketServer).&lt;/p&gt;

&lt;p&gt;5.Authentication: Passport.js.&lt;/p&gt;

&lt;p&gt;6.Charting: lightweight-charts &amp;amp; recharts.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Architecture: A Three-Layered Approach&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The app is broken down into three core components: the "AI" Signal Service, the Real-time Data Hub, and the Reactive Frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The "Brain": Algorithmic Signal Generation
&lt;/h2&gt;

&lt;p&gt;The term "AI" gets thrown around a lot. In this project, it refers to a dedicated backend service (signalService.js) that runs technical analysis on historical stock data to generate actionable insights.&lt;/p&gt;

&lt;p&gt;It calculates several key Technical Indicators (TIs):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple Moving Average (SMA): I calculate both the 50-day and 200-day SMAs to identify long-term trends.&lt;/li&gt;
&lt;li&gt;Relative Strength Index (RSI): A proxy calculation to determine if a stock is overbought or oversold.&lt;/li&gt;
&lt;li&gt;Moving Average Convergence Divergence (MACD): A proxy to gauge momentum by comparing short-term and long-term averages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These indicators are fed into two key functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;determineSignal(latestData): This function applies a rules-based logic (e.g., "if RSI &amp;lt; 30 and MACD &amp;gt; 0, signal 'Strong Buy'") to provide a clear BUY, SELL, or HOLD recommendation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;calculateTrendingScore(latestData): This is the secret sauce for the "Top Picks" page. It generates a proprietary score from 0-100 based on a weighted average of momentum, RSI strength, and long-term trend confirmation (e.g., is the price above its 200-day SMA?).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. The "Heartbeat": Real-Time with WebSockets
&lt;/h2&gt;

&lt;p&gt;A stock app without real-time data feels static. I used the ws library to build a lightweight WebSocket server that integrates directly with the main Express API.&lt;/p&gt;

&lt;p&gt;On the Backend (server.js): Instead of running a separate server, I attach the WebSocketServer to the same HTTP server instance that Express uses. This is efficient and simplifies deployment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// In server.js...
import { WebSocketServer } from 'ws';
import { handleConnection } from './core/websocket.js';

// ... after mongoose connects ...
const server = app.listen(process.env.PORT || 5000, /* ... */);

// --- 2. INITIALIZE THE *NEW* WEBSOCKET SERVER ---
const wss = new WebSocketServer({ server }); // Attach to the Express server

wss.on('connection', (ws) =&amp;gt; {
    handleConnection(ws); // Delegate logic to a separate module
});

console.log("✅ Real-time WebSocket service initialized...");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This handleConnection module is responsible for managing connected clients and, crucially, broadcasting real-time price and signal updates as they happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The "Face": A Resilient React Frontend
&lt;/h2&gt;

&lt;p&gt;The frontend's main challenge is managing data from two sources: a traditional REST API (for historical data, watchlist) and a WebSocket (for live updates).&lt;/p&gt;

&lt;p&gt;The Hybrid Data-Fetching Pattern: I landed on a powerful hybrid pattern using Tanstack Query (React Query) and a WebSocketContext. The TopPicks.jsx page is the best example of this.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Initial Load (HTTP): The page first uses useQuery to fetch the pre-calculated list of top picks from the /api/stocks/top-picks REST endpoint. This gives the user instant, cached data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Live Updates (WebSocket): Simultaneously, useWebSocket() (from my custom context) is connected. It listens for live "tick" messages from the server.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.Merging Data: The component intelligently decides which data to display. If the WebSocket is connected and has sent data, it uses that live data. If not, it falls back to the useQuery batch data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// In TopPicks.jsx...
import { useWebSocket } from '../context/WebSocketContext';
import { useQuery } from '@tanstack/react-query';

// ...

const { topPicks: wsTopPicks, realtimeData } = useWebSocket();
const { data: batchData, isLoading } = useQuery(
    'topPicksBatch', 
    () =&amp;gt; fetchTopPicksBatch(token),
    { enabled: wsTopPicks.length === 0 } // Only run if WS isn't ready
);

// Source of Truth: Prefer live data, fall back to batch API data
const sourceData = wsTopPicks.length &amp;gt; 0 ? wsTopPicks : (batchData?.picks || []);

// Combine with real-time price ticks
const rankedStocks = sourceData.map(stock =&amp;gt; {
    const realtime = realtimeData[stock.symbol] || {};
    return {
        ...stock,
        latestPrice: realtime.price || stock.latestPrice,
        signal: realtime.signal || stock.signal, // Live signal!
    };
}).sort((a, b) =&amp;gt; b.trendingScore - a.trendingScore);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pattern makes the app feel incredibly fast and resilient. It loads instantly and provides live-tick updates without complex state management. For simpler data, like the WatchlistPage.jsx, I just use useQuery for a standard, cached fetch.&lt;/p&gt;

&lt;p&gt;Polishing the UI: To make the app feel modern, I used Tailwind CSS for all styling and Framer Motion to add subtle, satisfying animations, like the card load-in effect on the Top Picks page.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Building this app was a fantastic journey into combining data-driven backend logic with a high-performance, real-time frontend. The core challenge—merging historical analysis with live data—was solved by the hybrid useQuery/WebSocket pattern. The signalService.js was my first real attempt at codifying trading logic, and the ws library proved to be a simple yet powerful tool for the real-time layer.&lt;/p&gt;

&lt;p&gt;This architecture provides a scalable and responsive foundation, and I'm excited to continue refining the signal algorithms.&lt;/p&gt;

&lt;p&gt;Thanks for reading! I hope this deep-dive was useful. What real-time data challenges are you tackling?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>mern</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
