<?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: Sai Madhan</title>
    <description>The latest articles on DEV Community by Sai Madhan (@falconz).</description>
    <link>https://dev.to/falconz</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%2F709043%2Fbe43773a-2e5f-4ed5-9146-4fc699fc0695.png</url>
      <title>DEV Community: Sai Madhan</title>
      <link>https://dev.to/falconz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/falconz"/>
    <language>en</language>
    <item>
      <title>Building a Tech Startup: Why Your Tech Stack Should Follow Your Business Model, Not the Other Way Around</title>
      <dc:creator>Sai Madhan</dc:creator>
      <pubDate>Sun, 09 Nov 2025 16:00:01 +0000</pubDate>
      <link>https://dev.to/falconz/building-a-tech-startup-why-your-tech-stack-should-follow-your-business-model-not-the-other-way-o52</link>
      <guid>https://dev.to/falconz/building-a-tech-startup-why-your-tech-stack-should-follow-your-business-model-not-the-other-way-o52</guid>
      <description>&lt;p&gt;As a software engineer, I've had the privilege of working alongside some of the smartest people I know in both technology and business. Through these experiences and my own study, I've developed the ability to evaluate product development through dual lenses: technical feasibility and business viability. Recently, a conversation with an aspiring founder illustrated something I've been thinking about: &lt;strong&gt;how easy it is to let AI-generated technical advice override critical thinking and domain expertise&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Tools Replace Critical Thinking
&lt;/h2&gt;

&lt;p&gt;Someone recently approached me with what they described as a revolutionary idea—a fashion and lifestyle e-commerce platform combining AI, VR, and AR capabilities. They presented an extraordinarily complex tech stack document featuring custom infrastructure, self-hosted ML operations, multiple database engines, and microservices architecture.&lt;/p&gt;

&lt;p&gt;For someone with no technical background, this list was suspiciously comprehensive. It became clear they had assembled this entire technical strategy using AI tools. The architecture looked impressive on paper but revealed several critical misjudgments:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No business validation&lt;/strong&gt; - When I asked about market research, vendor relationships, or supply chain, the answer was minimal: two local shop conversations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technology before business model&lt;/strong&gt; - They wanted to build custom ML infrastructure and complex microservices before proving anyone wanted the core product.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Misunderstanding of costs&lt;/strong&gt; - They claimed their AI-generated stack would be "less expensive" than my recommendations, despite requiring custom development of everything from scratch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dismissing domain expertise&lt;/strong&gt; - When I suggested starting with e-commerce validation first, then layering features, they became defensive. The AI had provided a complete vision, and expertise that contradicted it wasn't welcome.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Real Problem
&lt;/h2&gt;

&lt;p&gt;Here's the issue: &lt;strong&gt;AI tools generate technically plausible architectures, but they lack context about your business stage, constraints, and actual needs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An AI will recommend enterprise-grade solutions because it's trained on successful companies' architectures. But those companies didn't start there—they evolved to those systems after proving their business model and generating revenue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Business First, Technology Second
&lt;/h2&gt;

&lt;p&gt;When I asked about market validation—existing retail relationships, customer research, vendor partnerships—the answer was thin. No established supply chain, no customer base, no vendor network.&lt;/p&gt;

&lt;p&gt;This is critical because in e-commerce, &lt;strong&gt;your app is not your business&lt;/strong&gt;. Your business is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your supply chain&lt;/li&gt;
&lt;li&gt;Your vendor relationships&lt;/li&gt;
&lt;li&gt;Your customer acquisition strategy&lt;/li&gt;
&lt;li&gt;Your fulfillment capabilities&lt;/li&gt;
&lt;li&gt;Your margins and unit economics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The technology is simply the tool that enables these core competencies. Companies that succeed in this space don't win because of their tech stack—they win because they understand operations, logistics, and customer needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Right Way to Build: Start With Your Core Value
&lt;/h2&gt;

&lt;p&gt;My recommendation was straightforward: &lt;strong&gt;build the e-commerce foundation first&lt;/strong&gt;. Here's why:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Validate your business model&lt;/strong&gt; - Can you actually move products? Do customers want what you're selling?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build your user base&lt;/strong&gt; - Real users engaging with real products&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generate revenue&lt;/strong&gt; - Prove the business fundamentals work&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Then layer on features&lt;/strong&gt; - Once you have traction, add AI recommendations, AR try-ons, social features&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This isn't about lacking ambition. It's about &lt;strong&gt;structured iteration&lt;/strong&gt;. Every successful super app started as a focused product. They expanded once they had proven their core and built a user base.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Cost Conversation
&lt;/h2&gt;

&lt;p&gt;Despite having no technical background, this person claimed their proposed stack would be "less expensive" than my recommendations. Let me share some hard-earned wisdom about tech stack decisions:&lt;/p&gt;

&lt;h3&gt;
  
  
  Start With Leverage, Not Control
&lt;/h3&gt;

&lt;p&gt;For a pre-revenue startup, services like &lt;strong&gt;WorkOS&lt;/strong&gt; for authentication make perfect sense. They offer up to 1M users free. That's not vendor lock-in—that's &lt;strong&gt;business leverage&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here's the math: If your business is good enough to get 100,000 paying users, you'll have revenue. At that point, migrating to a custom system becomes a &lt;strong&gt;planned business expense&lt;/strong&gt;—a calculated investment funded by actual income.&lt;/p&gt;

&lt;h3&gt;
  
  
  Migration is Part of Growth Strategy
&lt;/h3&gt;

&lt;p&gt;This is something non-technical founders often misunderstand: &lt;strong&gt;migration, refactoring, and technical evolution are normal parts of successful businesses&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you're established with revenue:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have resources to hire specialized engineers&lt;/li&gt;
&lt;li&gt;You have actual usage data to inform optimization decisions&lt;/li&gt;
&lt;li&gt;You have business metrics to justify infrastructure investments&lt;/li&gt;
&lt;li&gt;You have operational margin to fund technical improvements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The cost of migrating 100K users from WorkOS to a custom auth system might be $50-100K in engineering time. Sounds expensive? Not when you're generating revenue. That's a manageable business expense.&lt;/p&gt;

&lt;p&gt;Building that custom auth system from day one? That's $100K+ spent before you know if anyone wants your product. That's not being cost-conscious—that's burning money.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Reality of "Vendor Lock-in"
&lt;/h3&gt;

&lt;p&gt;When I suggested Cloudflare for CDN and edge services, the response was concern about vendor lock-in. This perfectly illustrated the disconnect between AI-generated fears and business reality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real vendor lock-in&lt;/strong&gt; is when switching providers is technically impossible or prohibitively expensive relative to your business scale. Using Cloudflare's CDN isn't lock-in—your content is portable, and migrating to AWS CloudFront or similar services is straightforward when you have the scale to justify it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building Custom vs. Leveraging Services
&lt;/h3&gt;

&lt;p&gt;The proposed stack implied building machine learning infrastructure from the ground up. This deserves scrutiny.&lt;/p&gt;

&lt;p&gt;Production-grade ML systems require training data you don't have at launch, specialized engineering talent, expensive compute infrastructure, and ongoing operational overhead.&lt;/p&gt;

&lt;p&gt;Modern AI APIs—offering vision, language, and recommendation capabilities—exist precisely to remove this burden. You get to offer sophisticated features without the infrastructure complexity.&lt;/p&gt;

&lt;p&gt;The question isn't "can we build this?" It's "should we build this &lt;strong&gt;now&lt;/strong&gt;, or focus resources on validating our business model?"&lt;/p&gt;

&lt;h2&gt;
  
  
  What Actually Reduces Costs
&lt;/h2&gt;

&lt;p&gt;Here's what genuinely keeps startup costs down:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Use generous free tiers&lt;/strong&gt; - Supabase, Vercel, WorkOS, Cloudflare offer incredible free tiers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managed services over self-hosted&lt;/strong&gt; - Your engineering time is your most expensive resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monolith before microservices&lt;/strong&gt; - A well-structured monolith scales to millions of users&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proven tech over bleeding edge&lt;/strong&gt; - Pick boring technology; it's boring because it works&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Buy don't build&lt;/strong&gt; - Unless it's your core differentiator, use existing solutions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And crucially: &lt;strong&gt;Plan for migration as part of business growth&lt;/strong&gt;. It's not a failure to start with managed services and migrate later—it's smart capital allocation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Expense
&lt;/h2&gt;

&lt;p&gt;The real expense isn't Cloudflare or managed services. The real expense is building the wrong thing—spending months building a complex system with self-hosted infrastructure before validating if anyone wants the core product.&lt;/p&gt;

&lt;p&gt;Every dollar and hour spent on custom infrastructure is a dollar and hour not spent on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding your customers&lt;/li&gt;
&lt;li&gt;Building vendor relationships&lt;/li&gt;
&lt;li&gt;Refining your product-market fit&lt;/li&gt;
&lt;li&gt;Acquiring users&lt;/li&gt;
&lt;li&gt;Generating revenue&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where Guidance Falls Short
&lt;/h2&gt;

&lt;p&gt;This experience highlighted something I've been observing: &lt;strong&gt;the risk of making decisions in domains where you lack expertise, without consulting those who have it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Modern tools provide unprecedented access to information. You can research technical architectures, best practices, and industry standards with ease. But information without context can be misleading.&lt;/p&gt;

&lt;p&gt;The challenge isn't access to knowledge—it's &lt;strong&gt;knowing what applies to your specific situation&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Advice to Founders
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;If you're technical:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resist the urge to over-engineer&lt;/li&gt;
&lt;li&gt;Your goal is to validate assumptions as quickly as possible&lt;/li&gt;
&lt;li&gt;Pick tools that let you ship fast, not tools that look impressive on a diagram&lt;/li&gt;
&lt;li&gt;Build from experience, not from AI prompts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;If you're non-technical:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find a technical advisor you trust, then &lt;strong&gt;actually listen to them&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Understand that comprehensive technical plans need business context&lt;/li&gt;
&lt;li&gt;"Complete" tech stacks don't guarantee successful products—solving real problems does&lt;/li&gt;
&lt;li&gt;Question technical decisions you don't understand, but respect domain expertise&lt;/li&gt;
&lt;li&gt;The best architecture is the one that gets you to validation fastest&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When evaluating technical approaches:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Treat AI-generated advice as input, not direction&lt;/li&gt;
&lt;li&gt;Validate recommendations with people who have relevant experience&lt;/li&gt;
&lt;li&gt;Understand that optimal and practical are different things&lt;/li&gt;
&lt;li&gt;Remember that successful companies evolved their infrastructure—they didn't start with it&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Your tech stack should be the &lt;strong&gt;last thing&lt;/strong&gt; you optimize, not the first. Start with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Validate the business model&lt;/li&gt;
&lt;li&gt;Build the minimum product that proves value&lt;/li&gt;
&lt;li&gt;Get real users&lt;/li&gt;
&lt;li&gt;Generate revenue&lt;/li&gt;
&lt;li&gt;Scale and refactor what works&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Migration, refactoring, and technical evolution aren't problems—they're signs of success. They're the "problems" you &lt;strong&gt;want&lt;/strong&gt; to have, because they mean your business is growing.&lt;/p&gt;

&lt;p&gt;The mistake is spending months building comprehensive systems for unproven concepts, guided by impressive-sounding advice that lacks business context.&lt;/p&gt;

</description>
      <category>startup</category>
      <category>product</category>
      <category>ai</category>
      <category>business</category>
    </item>
    <item>
      <title>Building Full-Stack Apps with Bun, React, and Hono: A Modern Approach</title>
      <dc:creator>Sai Madhan</dc:creator>
      <pubDate>Fri, 11 Jul 2025 16:08:12 +0000</pubDate>
      <link>https://dev.to/falconz/serving-a-react-app-and-hono-api-together-with-bun-1gfg</link>
      <guid>https://dev.to/falconz/serving-a-react-app-and-hono-api-together-with-bun-1gfg</guid>
      <description>&lt;p&gt;I've been exploring Bun lately and I'm impressed by its capabilities. When I decided to try building a full-stack application using Bun with React and Hono, I discovered a surprisingly elegant pattern that I wanted to share.&lt;/p&gt;

&lt;p&gt;If you're looking for a modern, performant way to build full-stack applications, this combination might be exactly what you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Stack?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bun&lt;/strong&gt;: Blazing fast JavaScript runtime with built-in bundling and excellent React support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React&lt;/strong&gt;: The frontend framework we all know and love&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hono&lt;/strong&gt;: Lightweight, fast web framework with excellent TypeScript support and middleware ecosystem&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting Up Your Full-Stack App
&lt;/h2&gt;

&lt;p&gt;Let's start by creating a new Bun application with React support:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bun init &lt;span class="nt"&gt;--react&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;shadcn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives us a React application with shadcn/ui support out of the box. But here's where it gets interesting—Bun's routing system allows us to seamlessly integrate a Hono API server.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup: Combining the Best of Both Worlds
&lt;/h2&gt;

&lt;p&gt;Here's how we can set up our server to handle both API routes and React serving:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;serve&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Hono&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hono&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./index.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;API&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./api&lt;/span&gt;&lt;span class="dl"&gt;"&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;app&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;Hono&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;API&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;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;serve&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;routes&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="s2"&gt;/api/*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// API routes handled first&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;          &lt;span class="c1"&gt;// React app serves everything else&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;development&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;NODE_ENV&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;hmr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;console&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`🚀 Server running at &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! By mapping &lt;code&gt;/api/*&lt;/code&gt; to &lt;code&gt;app.fetch&lt;/code&gt;, we get a clean separation between our API and frontend, with both served from the same process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternative Approaches
&lt;/h2&gt;

&lt;p&gt;You could certainly build your API using Bun's built-in methods directly in the routes configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;serve&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;routes&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="s2"&gt;/api/users&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;async&lt;/span&gt; &lt;span class="nc"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;users&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;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;index&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;Or use Hono's JSX capabilities to build React-style components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Hono&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hono&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;jsx&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hono/jsx&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&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;Hono&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&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="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;Hono&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;)
&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, I prefer the approach outlined above because it gives us access to the full React ecosystem—Tailwind CSS, shadcn/ui, and countless React libraries—while still providing a powerful backend with Hono's extensive middleware collection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;Here's how I like to organize these projects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── index.ts          # Main server file
├── main.tsx          # React entry point
├── index.html        # HTML template
├── app/
│   └── App.tsx       # React components
├── api/
│   ├── index.ts      # API router
│   └── v1/
│       └── index.ts  # Versioned API routes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  API Setup with Hono
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;api/index.ts&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Hono&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hono&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;V1Routes&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./v1&lt;/span&gt;&lt;span class="dl"&gt;"&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;API&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;Hono&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;API&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/v1/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;V1Routes&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;API&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;api/v1/index.ts&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Hono&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hono&lt;/span&gt;&lt;span class="dl"&gt;"&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;V1Routes&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;Hono&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;V1Routes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&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="nx"&gt;c&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome to V1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;

&lt;span class="nx"&gt;V1Routes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/books&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="nx"&gt;c&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; 
    &lt;span class="na"&gt;books&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The Great Gatsby&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;F. Scott Fitzgerald&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;To Kill a Mockingbird&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Harper Lee&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1984&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;George Orwell&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;span class="nx"&gt;V1Routes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/users&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="nx"&gt;c&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; 
    &lt;span class="na"&gt;users&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;john@example.com&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jane Smith&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;jane@example.com&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;V1Routes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding Client-Side Routing
&lt;/h2&gt;

&lt;p&gt;For a proper SPA experience, you'll want to add React Router:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bun add react-router-dom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;App.tsx&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BrowserRouter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Routes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Route&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;BrowserRouter&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="nc"&gt;Routes&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="nc"&gt;Route&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt; &lt;span class="na"&gt;element&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Home&lt;/span&gt; &lt;span class="p"&gt;/&amp;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="nc"&gt;Route&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt; &lt;span class="na"&gt;element&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;About&lt;/span&gt; &lt;span class="p"&gt;/&amp;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="nc"&gt;Route&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/books"&lt;/span&gt; &lt;span class="na"&gt;element&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Books&lt;/span&gt; &lt;span class="p"&gt;/&amp;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="nc"&gt;Route&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"*"&lt;/span&gt; &lt;span class="na"&gt;element&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;NotFound&lt;/span&gt; &lt;span class="p"&gt;/&amp;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="nc"&gt;Routes&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="nc"&gt;BrowserRouter&lt;/span&gt;&lt;span class="p"&gt;&amp;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;The beauty of this setup is that Bun's &lt;code&gt;"/*": index&lt;/code&gt; route serves your React app for all non-API requests, giving you client-side routing that works perfectly with React Router.&lt;/p&gt;

&lt;h2&gt;
  
  
  One Important Detail
&lt;/h2&gt;

&lt;p&gt;When using &lt;code&gt;app.route()&lt;/code&gt; with this setup, make sure to include the trailing slash:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;API&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ✅ Works&lt;/span&gt;
&lt;span class="c1"&gt;// app.route("/api", API); // ❌ Won't work&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, individual route handlers work as expected without any special configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;V1Routes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/books&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Works at /api/v1/books&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What You Get
&lt;/h2&gt;

&lt;p&gt;With this setup, you get:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;API endpoints&lt;/strong&gt; at &lt;code&gt;/api/v1/books&lt;/code&gt;, &lt;code&gt;/api/v1/users&lt;/code&gt;, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React app&lt;/strong&gt; served from &lt;code&gt;/&lt;/code&gt; with full client-side routing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hot module replacement&lt;/strong&gt; for React components&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single process&lt;/strong&gt; serving both frontend and backend&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type safety&lt;/strong&gt; across your entire stack&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full React ecosystem&lt;/strong&gt;: Tailwind CSS, shadcn/ui, and thousands of React libraries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hono's middleware ecosystem&lt;/strong&gt; for authentication, CORS, logging, validation, and more&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best of both worlds&lt;/strong&gt;: Modern frontend tooling with a powerful, flexible backend&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Performance Benefits
&lt;/h2&gt;

&lt;p&gt;This approach gives you several performance advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bun's speed&lt;/strong&gt;: Both your API and frontend benefit from Bun's performance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No proxy overhead&lt;/strong&gt;: Everything runs in the same process&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient bundling&lt;/strong&gt;: Bun handles all the heavy lifting for your React app&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast startup&lt;/strong&gt;: Your entire stack boots up quickly&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building full-stack applications with Bun, React, and Hono is remarkably straightforward once you understand how all three interact with each other. The combination gives you modern tooling, excellent performance, and a clean development experience.&lt;/p&gt;

&lt;p&gt;Whether you're building a personal project or a production application, this stack provides a solid foundation with room to grow. The integration feels natural, and you get the best of all three technologies without any awkward compromises.&lt;/p&gt;

&lt;p&gt;Give it a try—I think you'll be pleasantly surprised by how well these tools work together!&lt;/p&gt;

</description>
      <category>fullstack</category>
      <category>bunjs</category>
      <category>react</category>
      <category>hono</category>
    </item>
  </channel>
</rss>
