<?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: PathTree</title>
    <description>The latest articles on DEV Community by PathTree (@pathtree).</description>
    <link>https://dev.to/pathtree</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%2F4212402%2Fd32c71b0-6a8b-4ecd-a402-ed470620665e.jpeg</url>
      <title>DEV Community: PathTree</title>
      <link>https://dev.to/pathtree</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pathtree"/>
    <language>en</language>
    <item>
      <title>Why I Built an Interactive Tree Visualizer for India's Entire Education System (Vanilla JS + D3)</title>
      <dc:creator>PathTree</dc:creator>
      <pubDate>Wed, 28 Oct 2026 07:22:58 +0000</pubDate>
      <link>https://dev.to/pathtree/why-i-built-an-interactive-tree-visualizer-for-indias-entire-education-system-vanilla-js-d3-3dme</link>
      <guid>https://dev.to/pathtree/why-i-built-an-interactive-tree-visualizer-for-indias-entire-education-system-vanilla-js-d3-3dme</guid>
      <description>&lt;p&gt;If you grew up in India (or navigated any high-stakes school system), you know this nightmare:&lt;/p&gt;

&lt;p&gt;You finish 10th or 12th grade. Everyone tells you there are only three paths: &lt;strong&gt;Engineering, Medical, or Commerce&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;When you search online for alternative routes, diploma options, or entrance exams, you get hit with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5,000-word SEO blogs written solely for ad revenue.&lt;/li&gt;
&lt;li&gt;Pushy coaching institute lead-generation forms.&lt;/li&gt;
&lt;li&gt;Zero clarity on prerequisites, durations, or lateral entry routes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wanted to fix this with a single visual premise: &lt;strong&gt;Education and careers are trees, not essays.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://pathtree.in" rel="noopener noreferrer"&gt;PathTree&lt;/a&gt; — a free, lightweight, zoomable canvas that maps out degrees, competitive exams, vocational tracks, and backup branches interactively.&lt;/p&gt;

&lt;p&gt;Here is the tech breakdown, the design decisions, and the hardest D3 layout bugs I had to solve.&lt;/p&gt;




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

&lt;p&gt;I deliberately avoided heavy frameworks (React/Next.js) for this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Engine:&lt;/strong&gt; Custom Vanilla JavaScript (ES6+)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graph &amp;amp; Hierarchy Layout:&lt;/strong&gt; D3.js (&lt;code&gt;d3-org-chart&lt;/code&gt; + &lt;code&gt;d3-flextree&lt;/code&gt; + &lt;code&gt;d3-zoom&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling:&lt;/strong&gt; Tailwind CSS + Vanilla CSS custom properties (for instant light/dark theme switching)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Target:&lt;/strong&gt; Sub-second First Contentful Paint (FCP) and smooth 60fps panning across hundreds of nodes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3 Technical Challenges I Faced
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The "Violent Jump" Problem on Branch Expansion
&lt;/h3&gt;

&lt;p&gt;In standard tree visualizers, when a node with ~25 children (like &lt;strong&gt;B.Tech / B.E.&lt;/strong&gt;) expands:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The layout engine (&lt;code&gt;d3-flextree&lt;/code&gt;) recalculates node coordinates relative to the root &lt;code&gt;(0, 0)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The default chart engine calls an auto-center &lt;code&gt;.fit()&lt;/code&gt; to frame all the newly spawned children.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The result?&lt;/strong&gt; The entire tree violently jumped across the screen, throwing the user off their focal point.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Fix:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I implemented an anchor stabilization system that runs during the layout phase:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Capture the exact screen viewport coordinates &lt;code&gt;(x, y)&lt;/code&gt; of the clicked card right before expansion via &lt;code&gt;getBoundingClientRect()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Disable the default auto-center behavior (&lt;code&gt;setActiveNodeCentered(false)&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Immediately counter-adjust D3's zoom transform by the exact coordinate difference &lt;code&gt;(-dx, -dy)&lt;/code&gt; across subsequent animation frames:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;currentTransform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;d3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zoomTransform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;node&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;adjusted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;d3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;zoomIdentity&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentTransform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;dx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentTransform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;dy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentTransform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zoomBehavior&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;adjusted&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, clicking &lt;strong&gt;+&lt;/strong&gt; on any node pins that exact card to the screen while its children bloom out organically.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Information Overload: Multi-Level Sibling Grouping
&lt;/h3&gt;

&lt;p&gt;Displaying 300+ career paths simultaneously creates massive cognitive clutter. &lt;/p&gt;

&lt;p&gt;To solve this, I built a &lt;strong&gt;Group Current Level&lt;/strong&gt; feature:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When looking at a specific branch (e.g., Computer Science), users can right-click and group all other sibling branches into a compact &lt;code&gt;[ 15 other paths ]&lt;/code&gt; summary capsule.&lt;/li&gt;
&lt;li&gt;Users can now collapse multiple sibling clusters independently across different parent levels without disrupting the overall pathway structure.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3. Lateral Entry &amp;amp; Multi-Parent Traversal
&lt;/h3&gt;

&lt;p&gt;Education isn't a strict acyclic tree. A student can reach a B.Tech degree through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;12th PCM&lt;/strong&gt; → &lt;strong&gt;JEE Main / CET&lt;/strong&gt; → &lt;strong&gt;B.Tech Year 1&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;10th&lt;/strong&gt; → &lt;strong&gt;3-Year Polytechnic Diploma&lt;/strong&gt; → &lt;strong&gt;Lateral Entry into B.Tech Year 2&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To represent these dual entry points without tangling the visual hierarchy into a messy spaghetti graph, I designed custom node badges that render alternative parents dynamically and link back to their originating pathways.&lt;/p&gt;




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

&lt;p&gt;The project is live, responsive, and completely free to use:&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;Live App:&lt;/strong&gt; &lt;a href="https://pathtree.in" rel="noopener noreferrer"&gt;https://pathtree.in&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🌲 &lt;strong&gt;Education Tree:&lt;/strong&gt; &lt;a href="https://pathtree.in/education" rel="noopener noreferrer"&gt;https://pathtree.in/education&lt;/a&gt;&lt;br&gt;&lt;br&gt;
🎨 &lt;strong&gt;Skills &amp;amp; Vocations:&lt;/strong&gt; &lt;a href="https://pathtree.in/skills" rel="noopener noreferrer"&gt;https://pathtree.in/skills&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I'd Love Feedback On:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;UX &amp;amp; Gestures:&lt;/strong&gt; How does the canvas panning, zooming, and context menu feel on your machine/trackpad?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Nodes:&lt;/strong&gt; What lesser-known degrees, state exams, or vocational routes do you think are missing?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture:&lt;/strong&gt; Would you have handled multi-parent relationships differently in D3?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Drop your thoughts and critiques in the comments below!&lt;/p&gt;

</description>
      <category>jav</category>
      <category>webdev</category>
      <category>showde</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
