<?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: Mammoth Capital</title>
    <description>The latest articles on DEV Community by Mammoth Capital (@mammothcapital).</description>
    <link>https://dev.to/mammothcapital</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%2F3902497%2F753b9baf-9a32-4568-b163-e6f41a3bad19.png</url>
      <title>DEV Community: Mammoth Capital</title>
      <link>https://dev.to/mammothcapital</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mammothcapital"/>
    <language>en</language>
    <item>
      <title>I built a free BTC trading terminal with React/Vite, Coinbase WebSocket, and a multi-tier build system</title>
      <dc:creator>Mammoth Capital</dc:creator>
      <pubDate>Tue, 28 Apr 2026 13:29:40 +0000</pubDate>
      <link>https://dev.to/mammothcapital/i-built-a-free-btc-trading-terminal-with-reactvite-coinbase-websocket-and-a-multi-tier-build-2m65</link>
      <guid>https://dev.to/mammothcapital/i-built-a-free-btc-trading-terminal-with-reactvite-coinbase-websocket-and-a-multi-tier-build-2m65</guid>
      <description>&lt;p&gt;I've been building trading tools for a while and finally launched the free tier of &lt;strong&gt;Mammoth Capital&lt;/strong&gt; — a BTC trading terminal that runs entirely in the browser with no broker account or API key required.&lt;/p&gt;

&lt;p&gt;Here's what went into the build that might be useful for other developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Multi-Tier Vite Build System
&lt;/h2&gt;

&lt;p&gt;The biggest architectural decision was supporting three distinct feature tiers (Free, Pulse, Pro) from a single codebase. I handle this with a &lt;code&gt;VITE_APP_TIER&lt;/code&gt; environment variable at build time:&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="c1"&gt;// vite.config.js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;define&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;import.meta.env.VITE_APP_TIER&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VITE_APP_TIER&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pro&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each tier gets its own &lt;code&gt;App*.jsx&lt;/code&gt; component and sidebar config. The build pipeline compiles all three independently and deploys them to separate paths on the VPS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live BTC Data via Coinbase WebSocket
&lt;/h2&gt;

&lt;p&gt;The real-time price feed uses the Coinbase WebSocket API — completely free, no API key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ws&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WebSocket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wss://advanced-trade-api.coinbase.com/api/v1/brokerage/price&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onopen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;subscribe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;product_ids&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;BTC-USD&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ticker&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Zero infrastructure cost for live BTC data. The feed updates the UI directly via React state.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pulse Hub — Persistent iframe Mount
&lt;/h2&gt;

&lt;p&gt;One of the trickier UX challenges: embedding the standalone MammothPulse BTC app inside the free tier dashboard without it reinitializing every time the user switches tabs.&lt;/p&gt;

&lt;p&gt;The naive approach (conditional rendering) destroys and recreates the iframe on every tab switch. The fix is always mounting it and using CSS to show/hide:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`flex-1 flex flex-col min-h-0 &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pulse-hub&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;flex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hidden&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;iframe&lt;/span&gt;
    &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/app/pulse-mobile/"&lt;/span&gt;
    &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"w-full flex-1 border-none"&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Mammoth Pulse"&lt;/span&gt;
  &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The iframe loads once and stays alive — no chart reinitialization on every navigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js + PM2 serving static Vite builds&lt;/li&gt;
&lt;li&gt;SFTP auto-deploy pipeline to Hostinger VPS&lt;/li&gt;
&lt;li&gt;Three separate build outputs: &lt;code&gt;/dist-free/&lt;/code&gt;, &lt;code&gt;/dist-pulse/&lt;/code&gt;, &lt;code&gt;/dist-pro/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's in the Free Tier
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Live BTC terminal (Coinbase WebSocket)&lt;/li&gt;
&lt;li&gt;Pulse Hub (embedded MammothPulse BTC app)&lt;/li&gt;
&lt;li&gt;BTC OmniData — on-chain metrics, dominance, fear &amp;amp; greed&lt;/li&gt;
&lt;li&gt;Trading journal with P&amp;amp;L tracking&lt;/li&gt;
&lt;li&gt;Academy with structured modules + XP system&lt;/li&gt;
&lt;li&gt;News/intel aggregator&lt;/li&gt;
&lt;li&gt;Strategy workbench&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Live at &lt;strong&gt;mammothcapital.site&lt;/strong&gt; — no card, no broker.&lt;/p&gt;

&lt;p&gt;Happy to answer questions about the Vite multi-tier build, the WebSocket feed, or the iframe persistence pattern.&lt;/p&gt;

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