<?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: Gua</title>
    <description>The latest articles on DEV Community by Gua (@gua).</description>
    <link>https://dev.to/gua</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3899721%2F06e32313-89cf-4f6b-bc39-140dce41432b.jpg</url>
      <title>DEV Community: Gua</title>
      <link>https://dev.to/gua</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gua"/>
    <language>en</language>
    <item>
      <title>Reclaiming the Source: Reconstructing Project Architecture from a Single JS Bundle</title>
      <dc:creator>Gua</dc:creator>
      <pubDate>Mon, 27 Apr 2026 06:22:04 +0000</pubDate>
      <link>https://dev.to/gua/reclaiming-the-source-reconstructing-project-architecture-from-a-single-js-bundle-2el5</link>
      <guid>https://dev.to/gua/reclaiming-the-source-reconstructing-project-architecture-from-a-single-js-bundle-2el5</guid>
      <description>&lt;h3&gt;
  
  
  The Challenge: Beyond Prettifying
&lt;/h3&gt;

&lt;p&gt;We’ve all been there: looking at a massive, minified, and bundled &lt;code&gt;app.js&lt;/code&gt; file, wondering how the original architecture actually looked. While source maps are a luxury we rarely have in production, most tools only "prettify" the mess—they don't restore the &lt;strong&gt;semantics and architecture&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s why I’ve been building &lt;strong&gt;&lt;a href="https://www.jsunpack.tech/" rel="noopener noreferrer"&gt;jsunpack.tech&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Experiment: A Real-World Case Study
&lt;/h3&gt;

&lt;p&gt;I recently put the tool to the test against a complex target: a 3D Tower Defense game built with &lt;strong&gt;Three.js, Vue 2, and Webpack&lt;/strong&gt;. The goal was to prove that &lt;strong&gt;jsunpack&lt;/strong&gt; can handle sophisticated logic and modular dependencies, turning a single opaque file back into a maintainable repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Result: A "Near-Source" Recovery&lt;/strong&gt;&lt;br&gt;
The results were surprisingly robust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File Mapping Coverage:&lt;/strong&gt; ~90.7%&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Naming Recovery:&lt;/strong&gt; ~93% (variables/functions)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overall Reconstruction Quality:&lt;/strong&gt; ~88%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It didn't just dump code; it reconstructed the &lt;strong&gt;Modular Structure&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Components:&lt;/strong&gt; Vue SFC logic was extracted and organized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Systems:&lt;/strong&gt; The pub/sub event system was restored almost perfectly (&lt;code&gt;on&lt;/code&gt;/&lt;code&gt;off&lt;/code&gt;/&lt;code&gt;emit&lt;/code&gt;/&lt;code&gt;once&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game Logic:&lt;/strong&gt; Complex formulas for chain lightning, splash damage, and economic systems remained readable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Configs:&lt;/strong&gt; 20 levels of wave configurations were recovered with correct data arrays.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Live Comparison
&lt;/h3&gt;

&lt;p&gt;You can see the actual output of this experiment here:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Live Demo:&lt;/strong&gt; &lt;a href="https://bastion-3d-threejs.vercel.app/" rel="noopener noreferrer"&gt;bastion-3d-threejs.vercel.app&lt;/a&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;Source Code (Reconstructed):&lt;/strong&gt; &lt;a href="https://github.com/zhongguagua/jsunpack-example" rel="noopener noreferrer"&gt;jsunpack-example on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  How it works: The Tech Behind jsunpack
&lt;/h3&gt;

&lt;p&gt;Unlike basic de-minifiers, jsunpack focuses on &lt;strong&gt;Structural Reverse Engineering&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Module Boundary Detection:&lt;/strong&gt; Identifying where one module ends and another begins within the bundle.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Semantic Analysis:&lt;/strong&gt; Analyzing code patterns to guess the original names of internal functions and variables.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Architecture Rebuilding:&lt;/strong&gt; Re-mapping the flat bundle back into a hierarchical folder structure (e.g., &lt;code&gt;/entities&lt;/code&gt;, &lt;code&gt;/managers&lt;/code&gt;, &lt;code&gt;/configs&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Why build this?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Learning &amp;amp; Reverse Engineering:&lt;/strong&gt; Studying how complex libraries like Three.js are integrated into large-scale apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Auditing:&lt;/strong&gt; Understanding exactly what a third-party script is doing under the hood.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  The Road Ahead
&lt;/h3&gt;

&lt;p&gt;It’s not perfect yet. I am still working on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restoring specific external imports more accurately.&lt;/li&gt;
&lt;li&gt;Handling parameter order edge cases in highly optimized code.&lt;/li&gt;
&lt;li&gt;Improving the readability of color constants and math literals.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  I’d love to hear your thoughts!
&lt;/h3&gt;

&lt;p&gt;Is a tool like this useful in your workflow? Whether it's for debugging, security analysis, or pure curiosity, let's discuss in the comments!&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Try the tool:&lt;/strong&gt; &lt;a href="https://www.jsunpack.tech/" rel="noopener noreferrer"&gt;&lt;strong&gt;https://www.jsunpack.tech/&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
