<?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>Forem: Samiha Tahsin</title>
    <description>The latest articles on Forem by Samiha Tahsin (@samiha_tahsin_ac88fbb14eb).</description>
    <link>https://forem.com/samiha_tahsin_ac88fbb14eb</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%2F3532024%2Fb62b64d7-891b-4844-a070-0396b4e66a56.jpg</url>
      <title>Forem: Samiha Tahsin</title>
      <link>https://forem.com/samiha_tahsin_ac88fbb14eb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/samiha_tahsin_ac88fbb14eb"/>
    <language>en</language>
    <item>
      <title>Why We'll Write Every Feature Atleast Twice</title>
      <dc:creator>Samiha Tahsin</dc:creator>
      <pubDate>Wed, 01 Oct 2025 09:59:18 +0000</pubDate>
      <link>https://forem.com/samiha_tahsin_ac88fbb14eb/why-well-write-every-feature-atleast-twice-5cek</link>
      <guid>https://forem.com/samiha_tahsin_ac88fbb14eb/why-well-write-every-feature-atleast-twice-5cek</guid>
      <description>&lt;p&gt;&lt;em&gt;At &lt;a href="https://airstate.dev/" rel="noopener noreferrer"&gt;AirState&lt;/a&gt;, we deliberately implement every feature in two languages. Here's why this approach isn't wasteful. one-liner: Yes, really. Every feature.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We build every feature twice: TypeScript first, then Go&lt;/li&gt;
&lt;li&gt;TypeScript = rapid iteration + community contributions&lt;/li&gt;
&lt;li&gt;Go = 4-6x performance for proven features&lt;/li&gt;
&lt;li&gt;Not technical debt—deliberate strategy for development speed initially and efficiency in production&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Context
&lt;/h2&gt;

&lt;p&gt;We build &lt;a href="https://www.npmjs.com/package/@airstate/react" rel="noopener noreferrer"&gt;React hooks&lt;/a&gt; that magically turn your boring single-user app into a real-time collaborative experience. We do this by syncing data in real-time between your clients. Behind the scenes, we're syncing state between clients using websockets and maintaining an &lt;a href="https://hub.docker.com/r/airstate/server" rel="noopener noreferrer"&gt;open-source server&lt;/a&gt; that handles all the messy distributed systems stuff.&lt;/p&gt;

&lt;p&gt;In less fancy terms: we're a message broker shuffling thousands of messages per second, desperately trying to squeeze every penny of value from our cloud bills. But we're also an early-stage startup that needs to ship features fast and validate ideas even faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cursor that broke the camel's back
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;The mouse pointer thingy, not the IDE / code editor.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let me start with an embarrassing confession: moving your cursor continuously in our early prototype could eat up 0.1 vCPU on &lt;a href="https://docs.railway.com/railway-metal" rel="noopener noreferrer"&gt;Railway&lt;/a&gt;. For a real-time syncing service, that's not just performance debt, it's basically an existential crisis.&lt;/p&gt;

&lt;p&gt;But, we needed that janky prototype. We're building something unproven; something users might hate; something that might be completely wrong. We can't afford to spend months optimizing code that might get thrown away next week.&lt;/p&gt;

&lt;p&gt;So the solution we came up with is: we'll build every feature twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do it like a two-pass assembler
&lt;/h2&gt;

&lt;p&gt;First pass: Build it in TypeScript and Node.js. Get it working, get feedback, learn where the edge cases are and iterate fast.&lt;/p&gt;

&lt;p&gt;Second pass: When the feature proves itself, we rewrite it in Go for production.&lt;/p&gt;

&lt;p&gt;This isn't technical debt masquerading as strategy. This isn't "move fast and break things" cargo cult nonsense. This is a deliberate choice about when to optimize.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why TypeScript-first makes sense
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript programmers are everywhere, and as a open-source project we need these contributors.&lt;/strong&gt; &lt;a href="https://survey.stackoverflow.co/2024/technology#most-popular-technologies-language-prof" rel="noopener noreferrer"&gt;Stack Overflow's 2024&lt;/a&gt; survey confirms what we already knew; JS is the most popular language by a wide margin. When we're building experimental features, we want community contributions. More contributors means faster iteration and better ideas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript is expressive.&lt;/strong&gt; The type system and functional programming support mean less gets lost in translation from idea to code and back to idea again. When you're experimenting, expressiveness beats efficiency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tooling just works&lt;/strong&gt;. &lt;a href="https://trpc.io/" rel="noopener noreferrer"&gt;tRPC&lt;/a&gt; gave us websocket multiplexing and client-server type sync out of the box. Sometimes the familiar tool is the right tool, even if it's not the fast tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failed experiments cost less&lt;/strong&gt;. If a feature bombs with users, we've saved weeks we would have spent optimizing it in Go.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Go graduation ceremony
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.techempower.com/benchmarks/#section=data-r23" rel="noopener noreferrer"&gt;Node.js is slow&lt;/a&gt;. Let's not pretend otherwise. V8 is impressive engineering, but JavaScript wasn't designed for sustained, high-throughput workloads. When our features earn their keep with real users, they deserve better.&lt;/p&gt;

&lt;p&gt;Features that graduate to Go get:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;4-6x efficiency improvements&lt;/li&gt;
&lt;li&gt;(More) proper memory management&lt;/li&gt;
&lt;li&gt;Better concurrency primitives&lt;/li&gt;
&lt;li&gt;Maximum squeeze from every server dollar&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Right now we run a Go server that proxies to Node.js for features that haven't been rewritten yet. New stuff launches fast in TypeScript while battle-tested features run at Go speeds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not Rust?
&lt;/h2&gt;

&lt;p&gt;Honestly? We don't know it well enough. We've heard the async story is complicated. Go gives us good enough performance without the learning curve tax.&lt;/p&gt;

&lt;h2&gt;
  
  
  The math on building twice
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Development velocity ROI&lt;/strong&gt;: TypeScript features ship roughly 2-3x faster than starting with Go, especially for complex business logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure cost recovery&lt;/strong&gt;: The performance gains from Go rewrites pay for the engineering time pretty quickly. When you're squeezing every dollar from your compute budget, this matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Risk mitigation&lt;/strong&gt;: This approach reduces technical debt rather than creating it. We're not prematurely optimizing (which might be wrong) or permanently accepting poor performance (which definitely is wrong).&lt;/p&gt;

&lt;h2&gt;
  
  
  When features earn their rewrite
&lt;/h2&gt;

&lt;p&gt;Not everything needs Go. Here's our framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Procedures &amp;amp; routes for a feature show up consistently towards the top when monitoring&lt;/li&gt;
&lt;li&gt;The feature has stable APIs (unchanged for 2-3 months)&lt;/li&gt;
&lt;li&gt;Gets heavy concurrent usage&lt;/li&gt;
&lt;li&gt;Costs more to run in Node.js than to rewrite&lt;/li&gt;
&lt;li&gt;Pretty simple, really.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The honest truth
&lt;/h2&gt;

&lt;p&gt;Everything in this post might be due to skill issues on our part. Some of our architecture exists for legacy reasons, not optimal design. We're still figuring things out.&lt;/p&gt;

&lt;p&gt;But that's exactly why this strategy works. We're honest about our constraints: early stage, limited resources, unpredictable which features will succeed. This dual approach acknowledges reality instead of pretending it doesn't exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we're really optimizing for
&lt;/h2&gt;

&lt;p&gt;Different phases need different optimizations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Early stage&lt;/strong&gt;: Learning speed, not runtime speed
-&lt;strong&gt;Growth stage&lt;/strong&gt;: User-critical constraints&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scale stage&lt;/strong&gt;: Unit economics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The software industry's obsession with "choosing the right tool" ignores this reality. Sometimes the right choice is refusing to choose (at least not permanently).&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://airstate.dev/" rel="noopener noreferrer"&gt;AirState&lt;/a&gt;, we need rapid iteration and extreme performance. Rather than compromise on either, we get both. Just not at the same time.&lt;/p&gt;

&lt;p&gt;We're building real-time sync infrastructure that doesn't suck. If this approach makes sense to you, &lt;a href="https://cal.com/omran-from-airstate/30min" rel="noopener noreferrer"&gt;we'd love to talk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>development</category>
      <category>go</category>
      <category>opensource</category>
      <category>react</category>
    </item>
  </channel>
</rss>
