<?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: wgnr.ai</title>
    <description>The latest articles on DEV Community by wgnr.ai (@wgnrai).</description>
    <link>https://dev.to/wgnrai</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%2F3884608%2F59fb8dfb-af09-4f90-845c-676430be1103.png</url>
      <title>DEV Community: wgnr.ai</title>
      <link>https://dev.to/wgnrai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wgnrai"/>
    <language>en</language>
    <item>
      <title>How We Built a Full-Featured AI Chat UI in 33KB with Zero Frameworks</title>
      <dc:creator>wgnr.ai</dc:creator>
      <pubDate>Fri, 17 Apr 2026 13:39:06 +0000</pubDate>
      <link>https://dev.to/wgnrai/how-we-built-a-full-featured-ai-chat-ui-in-33kb-with-zero-frameworks-2od9</link>
      <guid>https://dev.to/wgnrai/how-we-built-a-full-featured-ai-chat-ui-in-33kb-with-zero-frameworks-2od9</guid>
      <description>&lt;p&gt;When we set out to build a web interface for Pi Coding Agent, we made a deliberate choice: no React, no Vite, no TypeScript, no build step. Just vanilla HTML, CSS, and JavaScript.&lt;/p&gt;

&lt;p&gt;Here's what we learned building a production-quality real-time chat UI the old-fashioned way.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Architecture
&lt;/h3&gt;

&lt;p&gt;Everything lives in two files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;public/index.html&lt;/code&gt; — the entire frontend (HTML + CSS + JS in one file)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;server.js&lt;/code&gt; — Express server with WebSocket support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pi runs as a subprocess in RPC mode. The server bridges browser WebSockets to Pi's RPC protocol. Messages flow 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;Browser → WebSocket → Server → Pi RPC → Server → WebSocket → Browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Event-Driven State Management
&lt;/h3&gt;

&lt;p&gt;Instead of React's state management, we use a single &lt;code&gt;handleEvent()&lt;/code&gt; function that processes all WebSocket messages:&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;function&lt;/span&gt; &lt;span class="nf"&gt;handleEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;status&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="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message_start&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="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message_token&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="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message_end&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="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;agent_end&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each event updates the DOM directly. It's simple, fast, and easy to debug.&lt;/p&gt;

&lt;h3&gt;
  
  
  Message Queueing
&lt;/h3&gt;

&lt;p&gt;One of our favorite features: you can keep typing while Pi is still responding. The server sends queued messages to Pi with &lt;code&gt;streamingBehavior: "followUp"&lt;/code&gt;, and Pi processes them in order natively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why No Framework?
&lt;/h3&gt;

&lt;p&gt;Honestly? Speed of development. We could make changes, refresh, and see results instantly. No hot reload to wait for, no bundle to rebuild, no component tree to reason about. Just HTML elements and event handlers.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Result
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;33KB total package size&lt;/li&gt;
&lt;li&gt;4 npm dependencies&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npx wgnr-pi&lt;/code&gt; to install and run&lt;/li&gt;
&lt;li&gt;Full features: streaming, sessions, model picker, thinking levels, images, export&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sometimes the best framework is no framework.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/wgnr-ai/wgnr-pi" rel="noopener noreferrer"&gt;https://github.com/wgnr-ai/wgnr-pi&lt;/a&gt;&lt;br&gt;
npm: &lt;a href="https://www.npmjs.com/package/wgnr-pi%60%60" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/wgnr-pi``&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
