<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shadi Sbaih on Medium]]></title>
        <description><![CDATA[Stories by Shadi Sbaih on Medium]]></description>
        <link>https://medium.com/@shadisbaih?source=rss-8298a24a0985------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SQCPDb6y4YpNm_tVoKYdhw.png</url>
            <title>Stories by Shadi Sbaih on Medium</title>
            <link>https://medium.com/@shadisbaih?source=rss-8298a24a0985------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:13:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shadisbaih/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Imagine an App With Zero Source Code: How Generative UI and OpenUI Are Changing Frontend Forever]]></title>
            <link>https://shadisbaih.medium.com/imagine-an-app-with-zero-source-code-how-generative-ui-and-openui-are-changing-frontend-forever-bddfc62ab5d2?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/bddfc62ab5d2</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Sun, 25 Oct 2026 13:11:10 GMT</pubDate>
            <atom:updated>2026-10-25T13:11:10.936Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Why streaming bespoke interfaces on demand — using a line-by-line DSL instead of JSON — might be the biggest shift in how we build software.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B6G65nmoMn7pM5fCY6SMpg.png" /></figure><p>Could you imagine an application launcher that contains <strong>zero frontend source code</strong> for its apps?</p><p>No pre-built views. No hardcoded forms. Just an empty dashboard where you click an icon, type what you need, and watch a fully functional interface materialize in real time.</p><p>In a recent experiment highlighted by Warren from <strong>Better Stack</strong>, this exact concept was put to the test: an empty app dashboard powered by <strong>Gemini Flash</strong> and <strong>OpenUI</strong>.</p><p>Type <em>“Calculator,”</em> hit enter, and within seconds, a custom icon and a working calculator stream onto the screen. Type <em>“Coffee Shop Finder,”</em> and an interactive app loads with Google Maps integration and local listings underneath. Type <em>“Flight Tracker,”</em> and a bespoke dashboard builds itself in the background.</p><p>While generating entire standalone apps on the fly is still an experimental playground, the underlying technology — <strong>Generative UI</strong> — is rapidly becoming production reality. Here is a look under the hood at how OpenUI works, why traditional JSON is holding AI interfaces back, and where this paradigm is headed next.</p><h3>What Generative UI Is Actually For</h3><p>Earlier this year, OpenAI introduced <em>“Intelligent UI”</em> inside ChatGPT — their marketing term for Generative UI. Rather than replying to every prompt with a wall of Markdown text, the model responds with live, interactive components tailored to the user’s exact intent.</p><p>For example:</p><ul><li><strong>Ask for a 1-day sightseeing itinerary in San Francisco:</strong> Instead of a bulleted list, the interface renders an interactive map, category filter pills, and clickable activity cards.</li><li><strong>Ask to “jam on a drum pad”:</strong> The chat renders a playable grid of drum pads complete with a live beat counter.</li></ul><p>For developers, the value proposition is massive. You no longer have to anticipate and hardcode every possible edge case or user workflow. Instead of forcing users through the same static radio buttons or rigid tables, the LLM assembles a bespoke interface on the fly using your existing design system.</p><h3>OpenUI: A Specification, Not Just a Component Library</h3><p>A common misconception is that <strong>OpenUI</strong> is just another UI kit. In reality, OpenUI is a <strong>specification</strong> for rendering generative interfaces consistently across any frontend stack.</p><p>While OpenUI does offer an optional component library to get started quickly, you can bring your own stack:</p><ul><li><strong>Frameworks:</strong> React, Vue, or Svelte</li><li><strong>Component Systems:</strong> shadcn/ui, Tailwind CSS, Chakra UI, or Material Design</li></ul><p>You define the components you trust; the model decides how and when to compose them.</p><h3>The Bottleneck: Why JSON Is Too Slow for UI</h3><p>Historically, if you wanted an LLM to render a user interface, you forced it to output a structured <strong>JSON schema</strong> describing the component tree and props.</p><p>The problem? <strong>JSON is deeply nested and verbose.</strong></p><ol><li><strong>Slow Streaming:</strong> Because standard JSON requires closing brackets and nested hierarchies to be valid, parsers often have to wait for significant chunks — or the entire response — before rendering properly.</li><li><strong>Token Bloat:</strong> Repeated keys, quotes, and braces burn through tokens and drive up latency.</li></ol><h3>Enter OpenUI Lang</h3><p>To solve this, OpenUI introduced <strong>OpenUI Lang</strong> — a compact, custom domain-specific language (DSL) designed specifically for streaming interfaces.</p><p>Instead of waiting for a massive nested JSON object to close, OpenUI Lang is <strong>parsed line-by-line</strong>. Every single line the LLM streams back can be immediately translated into a live component on screen, using <strong>over 2x fewer tokens</strong> and cutting latency in half.</p><h3>How It Works Under the Hood (React Workflow)</h3><p>Integrating OpenUI into a standard React architecture only takes two main pieces from their open-source ecosystem:</p><ol><li><strong>System Prompt Injection (</strong>@openuidev/react-ui<strong>):</strong> When sending a user request to your LLM, you use OpenUI&#39;s helper to generate a system prompt. This prompt teaches the model the OpenUI Lang syntax and provides the strict list of custom components your app supports.</li><li><strong>Client-Side Streaming Parser (</strong>@openuidev/react-lang<strong>):</strong> As the LLM streams back OpenUI Lang line-by-line, the client-side parser converts those lines directly into your live React components on the screen.</li></ol><p>Everything runs within your own server and client infrastructure using free, open-source packages.</p><p>Here is what that pipeline looks like in practice — from defining the system prompt on the server to progressively rendering the OpenUI Lang stream on the client:</p><h3>1. Server-Side: Generating the System Prompt</h3><p>Using @openuidev/react-ui (or your own custom component schema defined via @openuidev/react-lang), you automatically generate the system instructions that teach the LLM the OpenUI Lang syntax and strict component boundaries:</p><p>TypeScript</p><pre>// app/api/generate-ui/route.ts<br>import { openuiLibrary } from &quot;@openuidev/react-ui&quot;;<br>import { streamText } from &quot;ai&quot;;<br>import { google } from &quot;@ai-sdk/google&quot;;<br><br>export async function POST(req: Request) {<br>  const { prompt } = await req.json();<br>  // Generates the OpenUI Lang syntax rules + allowed component schemas<br>  const systemPrompt = openuiLibrary.prompt();<br>  const result = streamText({<br>    model: google(&quot;gemini-2.5-flash&quot;), // Or Gemini 3.0 Flash<br>    system: systemPrompt,<br>    prompt: prompt,<br>  });<br>  return result.toTextStreamResponse();<br>}</pre><h3>2. What the Model Streams Back (OpenUI Lang vs. JSON)</h3><p>Instead of deeply nested JSON, the LLM emits single-line statements (identifier = Expression) starting with root. Because each line is self-contained and supports forward references, the client can parse and render top-down immediately:</p><pre>root = Card(header, CalculatorGrid(display, keypad))<br>header = CardHeader(&quot;On-Demand Calculator&quot;, &quot;Generated via OpenUI Lang&quot;)<br>display = Input(&quot;20 + 5 = 25&quot;, true)<br>keypad = Grid(4, [Button(&quot;7&quot;), Button(&quot;8&quot;), Button(&quot;9&quot;), Button(&quot;+&quot;)])</pre><h3>3. Client-Side: Rendering the Stream in React</h3><p>On the frontend, @openuidev/react-lang takes the raw text stream as tokens arrive, validates each line against your component library, and progressively mounts the live React components:</p><pre>// components/DynamicAppView.tsx<br>import { Renderer } from &quot;@openuidev/react-lang&quot;;<br>import { openuiLibrary } from &quot;@openuidev/react-ui&quot;;<br>import &quot;@openuidev/react-ui/styles/index.css&quot;;<br><br>interface DynamicAppProps {<br>  streamedCode: string;<br>  isStreaming: boolean;<br>}<br>export function DynamicAppView({ streamedCode, isStreaming }: DynamicAppProps) {<br>  return (<br>    &lt;div className=&quot;app-sandbox-container&quot;&gt;<br>      &lt;Renderer<br>        response={streamedCode}<br>        library={openuiLibrary}<br>        isStreaming={isStreaming}<br>      /&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p><em>(Want to bring your own components instead of the default kit? You can wrap any existing shadcn/ui or Tailwind component using </em>defineComponent<em> and </em>createLibrary<em> from </em>@openuidev/react-lang<em> using standard Zod schemas.)</em></p><h3>The Landscape: OpenUI vs. Vercel JSON Render vs. Google A2UI</h3><p>OpenUI isn’t the only player trying to standardize generative interfaces, but its custom language gives it a distinct architectural edge:</p><p><strong>SolutionFormatStreaming CapabilityToken Efficiency &amp; LatencyStandard JSON</strong>Nested JSONPoor (must wait for valid closures)High token usage, high latency<strong>Vercel JSON Render</strong>Line-streamed JSONGood (streams and parses per line)&gt;2x more tokens &amp; &gt;2x latency vs. OpenUI<strong>Google A2UI</strong>A2UI JSON (supports Web &amp; Flutter)Good&gt;2x more tokens vs. OpenUI<strong>OpenUIOpenUI Lang (Custom DSL)Native line-by-line streamingBaseline (Most efficient)</strong></p><p>JSON is fundamentally verbose for describing UI trees. By moving away from JSON to a purpose-built syntax, OpenUI optimizes directly for LLM token generation speeds.</p><h3>Reality Check: What Went Wrong Building the Demo</h3><p>As magical as an “empty app launcher” looks in a video, building whole applications on demand isn’t quite production-ready yet.</p><p>During the build, a major hurdle emerged: <strong>speed vs. intelligence</strong>.</p><ul><li><strong>The Ultra-Fast Inference Test:</strong> Initially, the demo used <strong>Cerebras</strong> running <strong>Qwen</strong> at a blistering <strong>1,800+ tokens per second</strong>. In theory, apps should have materialized instantaneously. In practice, the model frequently hallucinated broken UI structures, and the API struggled with rate limits and error codes.</li><li><strong>The Sweet Spot:</strong> Switching to <strong>Gemini Flash</strong> provided the reliability needed to generate working, functional components consistently — even if inference speeds aren’t yet at instant-app levels.</li></ul><h3>The Future: 10,000 Tokens/Sec and Sandboxed Frontends</h3><p>Right now, the sweet spot for Generative UI is <strong>inside chat interfaces and dynamic dashboards</strong> — rendering interactive charts, custom data views, and context-aware input forms that replace repetitive UI patterns.</p><p>However, look two or three years ahead. Imagine frontier-class models running at <strong>10,000 tokens per second</strong>. At that speed, the latency between clicking an icon and having a bespoke application interface stream onto your screen disappears entirely.</p><p>In that future, software architecture might look radically different:</p><ul><li>A <strong>highly optimized, strictly secure backend</strong> running inside a user-scoped sandbox.</li><li><strong>Zero static frontend views</strong> — with the entire presentation layer generated on demand, tailored to the exact task you are performing in that moment.</li></ul><p>We aren’t replacing full-scale frontend engineering tomorrow, but the line between “chatting with an AI” and “using an application” is officially blurring.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bddfc62ab5d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Search Bar: How to Engineer Scalable Search, Filters, and Pagination in React]]></title>
            <link>https://shadisbaih.medium.com/beyond-the-search-bar-how-to-engineer-scalable-search-filters-and-pagination-in-react-522ee9bf8dd5?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/522ee9bf8dd5</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 11:41:50 GMT</pubDate>
            <atom:updated>2026-10-11T11:41:50.426Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A practical frontend system design guide to building production-ready search experiences using React, TypeScript, URL state, TanStack Query, and backend APIs.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUReJywTMaIzz3iefwvZMg.png" /></figure><p>Almost every modern web application has a search page.</p><p>Think about Amazon, Airbnb, Booking.com, LinkedIn Jobs, or any real estate platform.</p><p>They all share a familiar interface:</p><ul><li>A search bar</li><li>Multiple filters</li><li>Sorting options</li><li>A list or grid of results</li><li>Pagination or infinite scrolling</li></ul><p>At first glance, implementing this seems straightforward.</p><p>Create a few inputs, manage their values with useState, call an API, and render the results.</p><p>Simple, right?</p><p><strong>Not quite.</strong></p><p>What happens when a user selects five filters, navigates to page seven, changes the sorting order, and then presses the browser’s Back button?</p><p>What if the user refreshes the page?</p><p>What if multiple API requests are triggered simultaneously and their responses arrive out of order?</p><p>What if the application has 100,000 products but the frontend only has access to the first 20?</p><p>And what happens when your filtering system grows from five options to fifty?</p><p>These are the problems that turn a simple search interface into an interesting frontend engineering challenge.</p><p>The key insight is this:</p><p><strong>A search page is not just a collection of UI components. It is a state synchronization system.</strong></p><p>Let’s explore how to design one properly.</p><h3>1. Start With the Mental Model, Not the Components</h3><p>Imagine we’re building a real estate platform.</p><p>A user performs the following actions:</p><ol><li>Searches for “Villa”.</li><li>Selects “Ramallah” as the city.</li><li>Sets a price range between $100,000 and $300,000.</li><li>Selects properties with three bedrooms.</li><li>Sorts the results from lowest to highest price.</li><li>Navigates to page three.</li></ol><p>Each action modifies the current search criteria.</p><p>And every change might affect the results returned by the backend.</p><p>Before writing any React components, we need to answer an important question:</p><p><strong>Where should each piece of state live?</strong></p><p>Not all state belongs in the same place.</p><p>I like to divide a search page into four categories.</p><p>State categoryExamplesRecommended locationSearch stateSearch queryURLFilter and sorting stateCategory, price, location, sortingURLPagination stateCurrent page, page sizeURLServer stateResults, total count, available facetsTanStack Query</p><p>There is also a fifth category: <strong>local UI state</strong>.</p><p>This includes things like:</p><ul><li>Whether the filter sidebar is open</li><li>Whether a dropdown is expanded</li><li>The text currently being typed before search submission</li><li>Temporary filter selections that haven’t been applied</li></ul><p>This state usually belongs in local React components.</p><p>Why does this distinction matter?</p><p>Because many frontend problems come from storing the same information in multiple places.</p><p>For example, imagine maintaining the selected category simultaneously in:</p><ul><li>React component state</li><li>Redux</li><li>URL query parameters</li></ul><p>Now you have three sources of truth that must always remain synchronized.</p><p>That creates unnecessary complexity.</p><p>A better architecture establishes clear ownership of each type of state.</p><h3>2. Make the URL Your Source of Truth</h3><p>Consider these two URLs.</p><p>The first:</p><p>/properties</p><p>The second:</p><p>/properties?q=villa&amp;city=ramallah&amp;type=villa&amp;minPrice=100000&amp;maxPrice=300000&amp;sort=price_asc&amp;page=3</p><p>Which URL describes the user’s current search?</p><p>Obviously, the second.</p><p>It contains everything necessary to reconstruct the applied search criteria.</p><p>This is why <strong>URL search parameters are one of the most useful state management mechanisms for search pages.</strong></p><p>They provide several benefits automatically.</p><p><strong>Shareable searches</strong></p><p>A user can copy a URL and send it to someone else. Opening that URL restores the same search criteria.</p><p><strong>Persistence across refreshes</strong></p><p>Refreshing the page doesn’t reset every filter.</p><p><strong>Browser navigation</strong></p><p>Back and Forward can restore previous search states.</p><p><strong>Deep linking</strong></p><p>Users can open a specific filtered view directly.</p><p><strong>Better debugging</strong></p><p>When someone reports a problem, a URL containing the search criteria makes reproducing the issue significantly easier.</p><h3>Implementing URL State in React</h3><p>React Router provides a useful hook called useSearchParams.</p><pre>import { useSearchParams } from &quot;react-router&quot;;<br><br>function PropertyFilters() {<br>  const [searchParams, setSearchParams] =<br>    useSearchParams();<br>  const city = searchParams.get(&quot;city&quot;) ?? &quot;&quot;;<br>  function changeCity(value: string) {<br>    setSearchParams((previous) =&gt; {<br>      const next = new URLSearchParams(previous);<br>      if (value) {<br>        next.set(&quot;city&quot;, value);<br>      } else {<br>        next.delete(&quot;city&quot;);<br>      }<br>      next.set(&quot;page&quot;, &quot;1&quot;);<br>      return next;<br>    });<br>  }<br>  return (<br>    &lt;select<br>      value={city}<br>      onChange={(e) =&gt; changeCity(e.target.value)}<br>    &gt;<br>      &lt;option value=&quot;&quot;&gt;All cities&lt;/option&gt;<br>      &lt;option value=&quot;ramallah&quot;&gt;Ramallah&lt;/option&gt;<br>      &lt;option value=&quot;nablus&quot;&gt;Nablus&lt;/option&gt;<br>    &lt;/select&gt;<br>  );<br>}</pre><p>Notice what’s happening.</p><p>We aren’t using React local state to store the selected city.</p><p>Instead, we derive it directly from the URL.</p><p>When the user selects another city, we update the URL, which causes the application to render according to the new search criteria.</p><p>One important detail: we clone the existing parameters instead of replacing all of them.</p><p>Otherwise, changing the city could accidentally remove the selected price range, sorting order, and other filters.</p><p>The URL should represent the complete <strong>applied search state</strong>, not every temporary UI interaction.</p><h3>3. Frontend Filtering vs. Backend Filtering</h3><p>This is one of the most important architectural decisions.</p><p>Let’s say we’re building an e-commerce application with 100,000 products.</p><p>The backend returns the first 20 products.</p><p>The user selects:</p><p>“Category: Electronics”</p><p>You might be tempted to write:</p><pre>const filteredProducts = products.filter(<br>  (product) =&gt; product.category === &quot;electronics&quot;<br>);</pre><p>Technically, this works.</p><p>But there’s a serious problem.</p><p>You’re filtering only the 20 products currently loaded in the browser.</p><p>You’re not searching across all 100,000 products.</p><p>The resulting list might be incomplete or completely misleading.</p><h3>The correct responsibility split</h3><p>For a typical production search application:</p><p><strong>Frontend responsibilities:</strong></p><ul><li>Collect search criteria</li><li>Update URL parameters</li><li>Send requests to the backend</li><li>Render returned results</li><li>Manage loading, empty, and error states</li><li>Handle navigation and user interactions</li></ul><p><strong>Backend responsibilities:</strong></p><ul><li>Search across the full dataset</li><li>Apply filtering conditions</li><li>Sort results</li><li>Calculate pagination</li><li>Return total result counts</li><li>Optionally provide filter aggregations</li></ul><p>A typical request might look like this:</p><pre>GET /api/properties<br>  ?q=villa<br>  &amp;city=ramallah<br>  &amp;type=villa<br>  &amp;type=house<br>  &amp;minPrice=100000<br>  &amp;maxPrice=300000<br>  &amp;sort=price_asc<br>  &amp;page=2<br>  &amp;pageSize=12</pre><p>And the backend responds with:</p><pre>{<br>  &quot;data&quot;: [<br>    {<br>      &quot;id&quot;: &quot;property-101&quot;,<br>      &quot;title&quot;: &quot;Modern Villa&quot;,<br>      &quot;price&quot;: 175000,<br>      &quot;city&quot;: &quot;Ramallah&quot;,<br>      &quot;type&quot;: &quot;villa&quot;<br>    }<br>  ],<br>  &quot;pagination&quot;: {<br>    &quot;page&quot;: 2,<br>    &quot;pageSize&quot;: 12,<br>    &quot;totalItems&quot;: 248,<br>    &quot;totalPages&quot;: 21<br>  }<br>}</pre><p>The frontend doesn’t need to know how the database implements those filters.</p><p>It only needs a well-defined API contract.</p><h3>What about small datasets?</h3><p>Client-side filtering isn’t inherently wrong.</p><p>If you have a small, fully loaded dataset — say 50 records in an internal dashboard — filtering locally might be the simplest solution.</p><p>But if you have large datasets, server-side pagination, or frequently changing records, backend filtering is generally the better architecture.</p><p><strong>The decision should depend on data size, completeness, and consistency requirements — not personal preference.</strong></p><h3>4. Understand How Multiple Filters Interact</h3><p>Filtering becomes more interesting when users can select multiple values.</p><p>Suppose the user selects:</p><ul><li>Property types: Villa and House</li><li>City: Ramallah</li><li>Price: $100,000–$300,000</li></ul><p>How should these conditions combine?</p><p>Usually, we apply an OR relationship within the same filter group and an AND relationship across different groups.</p><p>Conceptually:</p><pre>SELECT *<br>FROM properties<br>WHERE<br>  property_type IN (&#39;villa&#39;, &#39;house&#39;)<br>  AND city = &#39;ramallah&#39;<br>  AND price BETWEEN 100000 AND 300000;</pre><p>This behavior seems obvious until you work with more complex filtering systems.</p><p>Consider an e-commerce platform with:</p><ul><li>Multiple brands</li><li>Different colors</li><li>Available sizes</li><li>Price ranges</li><li>Product ratings</li><li>Shipping options</li></ul><p>Now you also need to consider whether the available options should change dynamically based on other selected filters.</p><p>These are called <strong>faceted filters</strong>.</p><p>For example:</p><ul><li>Electronics (450)</li><li>Clothing (280)</li><li>Furniture (120)</li></ul><p>The numbers represent the matching items associated with each facet.</p><p>Calculating these counts correctly is usually a backend responsibility.</p><p>You must also agree on the semantics of the counts: do they include the currently selected values within the same facet, or only filters from other groups?</p><p>This is a product and API contract decision that should be made explicitly.</p><h3>5. Treat Pagination as Part of the Search State</h3><p>Pagination introduces another important relationship between different states.</p><p>Imagine a user is browsing page 15.</p><p>Then they select a filter that reduces the total number of results from 300 to just 8.</p><p>What happens to page 15?</p><p>It no longer exists.</p><p>This leads to a simple but essential rule:</p><p><strong>Whenever the search query, filters, or sorting changes, reset pagination to page one.</strong></p><p>The reverse is equally important.</p><p>When users change pages, keep all their selected filters and sorting options intact.</p><p>A reusable update function can enforce this behavior:</p><pre>function updateFilter(<br>  key: string,<br>  value: string | string[]<br>) {<br>  setSearchParams((previous) =&gt; {<br>    const next = new URLSearchParams(previous);<br><br>next.delete(key);<br>    const values = Array.isArray(value)<br>      ? value<br>      : [value];<br>    values.filter(Boolean).forEach((item) =&gt; {<br>      next.append(key, item);<br>    });<br>    if (key !== &quot;page&quot;) {<br>      next.set(&quot;page&quot;, &quot;1&quot;);<br>    }<br>    return next;<br>  });<br>}</pre><p>Now:</p><pre>updateFilter(&quot;type&quot;, [&quot;villa&quot;, &quot;house&quot;]);<br>updateFilter(&quot;sort&quot;, &quot;price_asc&quot;);<br>updateFilter(&quot;page&quot;, &quot;3&quot;);</pre><p>The first two operations reset pagination.</p><p>The third changes only the current page.</p><h3>Offset Pagination vs. Cursor Pagination</h3><p>There are two common approaches.</p><p><strong>Page-based (offset) pagination</strong></p><pre>GET /api/properties?page=3&amp;pageSize=12</pre><p>This is suitable for search results where users need numbered pages or the ability to jump to a specific page.</p><p><strong>Cursor-based pagination</strong></p><pre>GET /api/properties?cursor=eyJpZCI6MTAwfQ</pre><p>This approach is often more appropriate for continuously loaded feeds and large datasets where stable incremental traversal matters.</p><p>Neither strategy is universally superior.</p><p>For real estate listings and traditional e-commerce result pages, I would typically begin with page-based pagination.</p><p>For social feeds and infinite scrolling, I would strongly consider cursor-based pagination.</p><p>Also, whichever strategy you choose, make sure your sorting is deterministic. If multiple records have the same price or timestamp, a stable secondary sort key can help avoid unpredictable ordering.</p><h3>6. Use TanStack Query for Server State</h3><p>Once our search criteria are represented in the URL, we need to fetch matching results.</p><p>This is where many applications become unnecessarily complicated.</p><p>A common approach is to use useEffect:</p><pre>useEffect(() =&gt; {<br>  fetchProperties(filters);<br>}, [filters]);</pre><p>This might appear sufficient.</p><p>But real-world data fetching involves much more than triggering a request.</p><p>We need to handle:</p><ul><li>Loading and error states</li><li>Caching</li><li>Refetching</li><li>Request cancellation</li><li>Rapid filter changes</li><li>Pagination transitions</li><li>Data freshness</li></ul><p>Rather than implementing all of these concerns manually, TanStack Query provides a declarative data-fetching model.</p><h3>A practical implementation</h3><p>Let’s create a custom hook for our property search page.</p><pre>import { useSearchParams } from &quot;react-router&quot;;<br>import {<br>  useQuery,<br>  keepPreviousData,<br>} from &quot;@tanstack/react-query&quot;;<br><br>export function usePropertySearch() {<br>  const [params, setParams] = useSearchParams();<br>  const rawPage = Number(params.get(&quot;page&quot;) ?? 1);<br>  const filters = {<br>    q: params.get(&quot;q&quot;) ?? &quot;&quot;,<br>    city: params.get(&quot;city&quot;) ?? &quot;&quot;,<br>    types: [...new Set(params.getAll(&quot;type&quot;))].sort(),<br>    sort: params.get(&quot;sort&quot;) ?? &quot;relevant&quot;,<br>    page:<br>      Number.isSafeInteger(rawPage) &amp;&amp; rawPage &gt; 0<br>        ? rawPage<br>        : 1,<br>  };<br>  const query = useQuery({<br>    queryKey: [&quot;properties&quot;, filters],<br>    queryFn: async ({ signal }) =&gt; {<br>      const search = new URLSearchParams({<br>        q: filters.q,<br>        city: filters.city,<br>        sort: filters.sort,<br>        page: String(filters.page),<br>        pageSize: &quot;12&quot;,<br>      });<br>      filters.types.forEach((type) =&gt; {<br>        search.append(&quot;type&quot;, type);<br>      });<br>      const response = await fetch(<br>        `/api/properties?${search.toString()}`,<br>        { signal }<br>      );<br>      if (!response.ok) {<br>        throw new Error(&quot;Failed to load properties&quot;);<br>      }<br>      return response.json();<br>    },<br>    staleTime: 30_000,<br>    placeholderData: keepPreviousData,<br>  });<br>  function updateFilter(<br>    key: string,<br>    value: string | string[]<br>  ) {<br>    setParams((previous) =&gt; {<br>      const next = new URLSearchParams(previous);<br>      next.delete(key);<br>      const values = Array.isArray(value)<br>        ? value<br>        : [value];<br>      values.filter(Boolean).forEach((item) =&gt; {<br>        next.append(key, item);<br>      });<br>      if (key !== &quot;page&quot;) {<br>        next.set(&quot;page&quot;, &quot;1&quot;);<br>      }<br>      return next;<br>    });<br>  }<br>  return {<br>    filters,<br>    updateFilter,<br>    ...query,<br>  };<br>}</pre><p>This is a simplified example covering text search, location, property types, sorting, and pagination. In production, I would also validate the allowed query parameters and extend the typed filter model to include price ranges and other domain-specific criteria.</p><p>The important detail here is the queryKey.</p><pre>queryKey: [&quot;properties&quot;, filters]</pre><p>Every distinct combination of search criteria represents a distinct query.</p><p>When the user changes filters, TanStack Query recognizes that the query key has changed and fetches the appropriate results.</p><p>When the user navigates back to a previously visited combination, cached data may be available.</p><h3>Why use keepPreviousData?</h3><p>Imagine a user moves from page two to page three.</p><p>Without special handling, the UI might immediately clear the current cards and display an empty loading area.</p><p>keepPreviousData allows the previous results to remain visible temporarily while the new results load.</p><p>This can reduce visual flickering.</p><p>However, the interface should communicate that an update is in progress. TanStack Query exposes states such as isFetching and isPlaceholderData for this purpose.</p><h3>What about race conditions?</h3><p>Suppose a user types quickly:</p><pre>v<br>vi<br>vil<br>vill<br>villa</pre><p>Several requests could be triggered.</p><p>Without properly managed request lifecycles, responses can arrive out of order and cause stale results to appear.</p><p>TanStack Query associates results with their query keys. Passing its provided AbortSignal to fetch also enables cancellation when the query is aborted.</p><p>This is one of the reasons I prefer a dedicated server-state library over manually coordinating many effects.</p><h3>7. Debouncing: Don’t Search on Every Keystroke</h3><p>Another common problem is excessive network traffic.</p><p>If a user types “Apartment”, do we really need to request the backend after every character?</p><p>Not necessarily.</p><p>A common solution is debouncing.</p><p>Instead of triggering a request immediately, wait until the user stops typing for a short interval.</p><p>For example, 350 milliseconds.</p><p>This introduces another useful distinction:</p><p><strong>Draft state:</strong> What the user is currently typing.</p><p><strong>Applied state:</strong> The search query that has been committed to the URL and is driving the API request.</p><p>An illustrative approach:</p><pre>const [draftQuery, setDraftQuery] = useState(<br>  searchParams.get(&quot;q&quot;) ?? &quot;&quot;<br>);<br><br>useEffect(() =&gt; {<br>  const timeout = setTimeout(() =&gt; {<br>    const currentQuery = searchParams.get(&quot;q&quot;) ?? &quot;&quot;;<br>    if (draftQuery !== currentQuery) {<br>      updateFilter(&quot;q&quot;, draftQuery);<br>    }<br>  }, 350);<br>  return () =&gt; clearTimeout(timeout);<br>}, [draftQuery, searchParams, updateFilter]);</pre><p>This illustrates the debounce mechanism, rather than being a drop-in production component. The production version should stabilize the update callback, synchronize draft state when browser navigation restores a different URL, and decide whether debounced URL changes should replace rather than push browser history entries.</p><p>For many search interfaces, pressing Enter or clicking a Search button is also a perfectly reasonable strategy.</p><p>The correct choice depends on the product experience and the cost of each request.</p><p>And remember: not every control needs debouncing.</p><p>Checkboxes might apply immediately, while a price slider may be better suited to updating only when the user releases it.</p><h3>8. What Happens When You Have 50 Filters?</h3><p>At some point, a search page becomes much more complicated.</p><p>Imagine an advanced marketplace with filters for:</p><ul><li>Category</li><li>Brand</li><li>PriceRating</li><li>Location</li><li>Availability</li><li>Delivery options</li><li>Product specifications</li><li>Seller type</li><li>Condition</li></ul><p>Creating a completely separate implementation for every filter can produce significant duplication.</p><p>This is where configuration-driven filtering can become useful.</p><p>For example:</p><pre>const filterDefinitions = [<br>  {<br>    key: &quot;category&quot;,<br>    label: &quot;Category&quot;,<br>    type: &quot;multi-select&quot;,<br>    options: [&quot;electronics&quot;, &quot;fashion&quot;, &quot;home&quot;],<br>  },<br>  {<br>    key: &quot;price&quot;,<br>    label: &quot;Price Range&quot;,<br>    type: &quot;range&quot;,<br>    min: 0,<br>    max: 10000,<br>  },<br>  {<br>    key: &quot;rating&quot;,<br>    label: &quot;Minimum Rating&quot;,<br>    type: &quot;select&quot;,<br>    options: [1, 2, 3, 4, 5],<br>  },<br>];</pre><p>A FilterRenderer component could select the appropriate control based on each definition.</p><p>This approach can improve consistency and reduce repeated UI code.</p><p>But there’s a trap.</p><p><strong>Don’t build a generic filtering framework before you actually need one.</strong></p><p>If your project has four simple filters, normal reusable React components might be enough.</p><p>Start with components such as:</p><ul><li>CheckboxFilter</li><li>SelectFilter</li><li>RangeFilter</li><li>FilterGroup</li></ul><p>Only introduce a configuration-driven system when the amount of repetition and complexity justifies it.</p><p>Good architecture is not about introducing the maximum number of abstractions.</p><p>It’s about introducing the right abstractions at the right time.</p><h3>9. Production Problems You Should Anticipate</h3><p>A working demo and a production-ready search system are two different things.</p><p>Here are several scenarios worth designing for explicitly.</p><p>ScenarioRecommended approachUser types very quicklyDebounce or explicit search submissionUser changes filters on page 10Reset page to 1User refreshes the browserRestore applied state from the URLUser presses BackRead restored URL parametersSeveral requests overlapQuery keys and cancellationAPI request failsError state with retrySearch returns no resultsDedicated empty stateUser clears every filterRestore defined defaultsA URL contains invalid parametersParse, validate, and normalizeNew filters are addedReusable filter componentsDataset becomes very largeBackend filtering and paginationTotal results change between requestsHandle stale or out-of-range pages</p><p>I would also pay attention to a few less obvious problems.</p><h3>Avoid unnecessary browser history entries</h3><p>Typing a search query with debounce could potentially create many history entries.</p><p>For intermediate edits, replacing the current URL entry may be preferable to pushing a new entry every time.</p><p>Deliberate actions, such as applying filters or navigating pages, may deserve history entries of their own.</p><h3>Consider mobile filtering behavior</h3><p>On desktop, applying filters immediately can feel natural.</p><p>On mobile, users often open a filter drawer, modify several fields, and press an Apply button.</p><p>In that case, maintaining temporary filter state until the user confirms is usually a better interaction model.</p><h3>Validate URL parameters</h3><p>Never assume URL parameters are valid just because your frontend generated them.</p><p>Users can manually modify URLs.</p><p>For example:</p><p>/properties?page=-100&amp;minPrice=abc</p><p>Your application should safely handle invalid values.</p><p>A schema-validation library such as Zod can help centralize parsing and validation for more complex search pages.</p><p>And, of course, the backend must validate incoming parameters independently.</p><h3>Design proper loading and empty states</h3><p>A search result page should clearly distinguish between:</p><ul><li>Initial loading</li><li>Refetching existing results</li><li>No matching results</li><li>Network errors</li><li>Successfully loaded results</li></ul><p>These are different states and may require different UI treatments.</p><p>A page that displays “No results found” while a request is still pending creates a confusing user experience.</p><h3>10. How I Would Structure the Frontend</h3><p>For a moderately complex React application, I’d use a feature-based structure.</p><pre>src/<br>└── features/<br>    └── properties/<br>        ├── components/<br>        │   ├── PropertySearchPage.tsx<br>        │   ├── SearchBar.tsx<br>        │   ├── FilterSidebar.tsx<br>        │   ├── PropertyGrid.tsx<br>        │   ├── PropertyCard.tsx<br>        │   ├── SortSelect.tsx<br>        │   └── Pagination.tsx<br>        │<br>        ├── hooks/<br>        │   ├── usePropertySearch.ts<br>        │   └── usePropertySearchParams.ts<br>        │<br>        ├── api/<br>        │   └── getProperties.ts<br>        │<br>        ├── schemas/<br>        │   └── propertyFilters.schema.ts<br>        │<br>        └── types.ts</pre><p>The responsibilities are straightforward.</p><p><strong>Components</strong> handle rendering and user interactions.</p><p><strong>Search parameter utilities and hooks</strong> handle reading, validating, and updating URL state.</p><p><strong>API functions</strong> define how the application communicates with the backend.</p><p><strong>TanStack Query</strong> coordinates server state, caching, fetching, and request lifecycle management.</p><p>I would not introduce Redux or Zustand solely because a page has many filters.</p><p>The combination of URL state, React local state, and TanStack Query is often sufficient.</p><p>If the application has additional complex client-side workflows requiring shared state, a dedicated client-state library may still be appropriate.</p><h3>11. The Architecture I Would Choose Today</h3><p>For a typical production React application, this is the architecture I would begin with:</p><pre>USER<br>               |<br>               v<br>      Search / Filter UI<br>               |<br>               v<br>       URL Search Params<br>               |<br>               v<br>      Typed State Parsing<br>               |<br>               v<br>         TanStack Query<br>               |<br>               v<br>          Backend API<br>               |<br>               v<br>       Search / Database<br>               |<br>               v<br>         JSON Response<br>               |<br>               v<br>       TanStack Query<br>               |<br>               v<br>         Results UI</pre><p>Each layer has a clear responsibility.</p><p>The UI collects input.</p><p>The URL represents the applied search criteria.</p><p>The parser validates and normalizes those criteria.</p><p>TanStack Query manages fetching and caching.</p><p>The backend executes the search.</p><p>And the frontend renders the results.</p><p>This separation is what keeps the system maintainable as requirements grow.</p><p>Of course, this is not the only possible architecture. Frameworks such as Next.js and React Router’s data-loading features may move some fetching responsibilities into server-side loaders or server-rendered components. The important principles remain the same, even when the implementation details change.</p><h3>Final Thoughts</h3><p>When developers first encounter a complex search interface, they often focus on the visible components:</p><p>How do I build the dropdown?</p><p>How do I implement the checkbox group?</p><p>How do I render pagination buttons?</p><p>Those questions matter, but they’re not the hardest part.</p><p>The real engineering challenge is managing the relationships between search criteria, URL state, server data, and user navigation.</p><p>A reliable search experience needs to answer four fundamental questions:</p><ol><li><strong>Where does the state live?</strong></li><li><strong>Who is responsible for filtering the data?</strong></li><li><strong>How do state changes trigger and coordinate data fetching?</strong></li><li><strong>How does the application remain predictable during navigation, rapid interactions, and errors?</strong></li></ol><p>Once these responsibilities are clearly defined, the implementation becomes much easier to reason about.</p><p>And the best part?</p><p><strong>The same architectural principles apply to almost any search-driven application:</strong></p><p>E-commerce marketplaces, real estate platforms, job boards, travel booking websites, admin dashboards, and more.</p><p><strong>Build the state architecture first. The search UI becomes the easy part.</strong></p><p><em>What architectural approach do you prefer for complex search pages? Do you use URL-driven state, a global store, or a combination of both?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=522ee9bf8dd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GEO vs. AEO in 2026: The New Rules of Search Visibility in the Age of AI]]></title>
            <link>https://shadisbaih.medium.com/geo-vs-aeo-in-2026-the-new-rules-of-search-visibility-in-the-age-of-ai-9df15c33576c?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/9df15c33576c</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[search-engine-optimizati]]></category>
            <category><![CDATA[aeo]]></category>
            <category><![CDATA[geo]]></category>
            <category><![CDATA[seo]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Sat, 10 Oct 2026 21:08:29 GMT</pubDate>
            <atom:updated>2026-10-10T21:08:29.186Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyRovNzs52wIjTFH4jQC_g.png" /></figure><p><em>SEO helped brands get found. Answer Engine Optimization (AEO) and Generative Engine Optimization (GEO) are changing how brands become part of the answer. Here’s what the research actually says — and how to adapt your strategy.</em></p><p>Imagine you’re looking for the best project management software for a remote team.</p><p>A few years ago, you might have searched Google, opened several articles, compared products, and eventually made a decision.</p><p>Today, you can ask an AI assistant:</p><p><em>“What’s the best project management software for a remote team of 20 people? Compare pricing, collaboration features, and integrations.”</em></p><p>Instead of presenting ten blue links, the assistant can generate a comparison, explain the trade-offs, and cite sources — all in one response.</p><p>The underlying change is significant.</p><p>Your potential customer might discover your product, read a recommendation, and form an opinion about your brand <strong>without ever visiting your website</strong>.</p><p>This shift is creating new challenges for marketers, publishers, and businesses. It is also driving interest in two increasingly popular concepts:</p><p><strong>Answer Engine Optimization (AEO)</strong> and <strong>Generative Engine Optimization (GEO)</strong>.</p><p>But are they genuinely new disciplines? How do they differ from traditional SEO? And what can businesses actually do to improve their visibility?</p><p>Let’s explore the evidence, separate proven practices from speculation, and build a practical strategy for 2026.</p><h3>1. Search Is Changing, but the Evidence Matters</h3><p>Traditional search engines primarily helped people discover information by retrieving and ranking web pages.</p><p>AI-powered search adds another layer: generating responses from information gathered across sources.</p><p>Platforms such as Google AI Overviews, Google AI Mode, ChatGPT Search, Microsoft Copilot, and Perplexity allow people to ask complex questions and receive synthesized answers.</p><p>This changes the relationship between search visibility and website traffic.</p><h3>The rise of zero-click behavior</h3><p>In July 2025, <a href="https://www.pewresearch.org/short-reads/2025/07/22/google-users-are-less-likely-to-click-on-links-when-an-ai-summary-appears-in-the-results/">Pew Research Center published an analysis</a> of Google search activity involving 900 U.S. adults.</p><p>The findings were striking:</p><ul><li>Users clicked a traditional search result in <strong>8% of visits</strong> where an AI summary appeared.</li><li>When no AI summary appeared, that figure was <strong>15%</strong>.</li><li>Users clicked links inside AI summaries in only <strong>1% of visits</strong> containing those summaries.</li></ul><p>The study examined activity from March 2025. Its findings describe observed user behavior, not a universal prediction of future search traffic.</p><p>More recent industry research points in a similar direction.</p><p>In February 2026, <a href="https://ahrefs.com/blog/ai-overviews-reduce-clicks-update/">Ahrefs reported</a> that the presence of a Google AI Overview correlated with an estimated <strong>58% lower click-through rate</strong> for the top-ranking page, based on its December 2025 data and comparison methodology.</p><p>That estimate should not be interpreted as a guaranteed 58% traffic loss for every website. Search intent, industry, query type, and methodology all matter.</p><p>Nevertheless, the business implication is clear:</p><p><strong>A website can remain visible in search while receiving fewer clicks than it once did.</strong></p><p>This is why marketers need to think beyond rankings alone.</p><h3>2. SEO vs. AEO vs. GEO: What’s the Difference?</h3><p>These three terms are related, but they describe different optimization priorities.</p><h3>SEO: Search Engine Optimization</h3><p>SEO improves a website’s ability to be discovered, indexed, ranked, and visited through search engines.</p><p>It traditionally focuses on areas such as technical optimization, helpful content, search intent, internal linking, and authority.</p><p><strong>Example:</strong> A software company publishes a detailed comparison of React and Vue to attract developers searching Google for “React vs Vue.”</p><p>The goal is to earn relevant search visibility and qualified visits.</p><h3>AEO: Answer Engine Optimization</h3><p>AEO focuses on making information clear, reliable, and useful as a direct answer to a user’s question.</p><p>The concept applies to AI-generated answers, conversational assistants, and traditional answer-oriented search features.</p><p><strong>Example:</strong> Instead of burying an explanation several paragraphs into an article, a developer documentation page begins with:</p><p><em>“React Server Components render on the server and can reduce the amount of JavaScript sent to the client. They are not a replacement for Client Components, which remain necessary for browser-side interactivity.”</em></p><p>This immediately gives readers a direct answer, followed by the opportunity to explore detailed explanations.</p><p>The objective is to make useful information easy to understand and extract — not merely to repeat keywords.</p><h3>GEO: Generative Engine Optimization</h3><p>GEO focuses on improving the discoverability, representation, and potential citation of content within AI-generated responses.</p><p>The term gained academic attention through the research paper <a href="https://arxiv.org/abs/2311.09735">GEO: Generative Engine Optimization</a>, first published in 2023.</p><p>GEO is particularly concerned with how generative systems retrieve information from multiple sources and incorporate it into a synthesized answer.</p><p><strong>Example:</strong> A cybersecurity company publishes an original investigation of authentication vulnerabilities, complete with reproducible findings, technical methodology, and supporting data.</p><p>When an AI-powered search system answers a question about those vulnerabilities, that research may be a relevant source to retrieve or cite.</p><p>The distinction is useful, but it is not absolute.</p><p>In practice, AEO and GEO overlap significantly, and the industry does not have one universally agreed definition separating them.</p><p>Google’s <a href="https://developers.google.com/search/docs/fundamentals/ai-optimization-guide">2026 official optimization guide</a> explicitly treats AEO and GEO as terms for activities focused on AI search visibility, while emphasizing that traditional SEO remains foundational.</p><p>A simple way to remember the relationship is:</p><p><strong>SEO makes your content discoverable. AEO makes your answers useful and accessible. GEO focuses on how your content appears and contributes to generative answers.</strong></p><p>They are complementary approaches, not three independent ranking systems.</p><h3>3. How Do AI Search Engines Find and Use Content?</h3><p>Understanding the underlying technology helps explain why some optimization practices make sense and others do not.</p><p>Many AI search experiences use a technique called <strong>Retrieval-Augmented Generation (RAG)</strong>.</p><p>Rather than relying exclusively on information learned during model training, a retrieval-enabled system can search for relevant external information and use it to support an answer.</p><p>A simplified process looks like this:</p><ol><li>A user asks a question.</li><li>The system interprets the question and may create additional related search queries.</li><li>Relevant pages and sources are retrieved.</li><li>Selected information is provided as context for answer generation.</li><li>The system generates a response, potentially including source citations.</li></ol><p>Not every product uses the same pipeline, and retrieval is not guaranteed for every response.</p><p>Google also describes <strong>query fan-out</strong>, in which an AI search system issues multiple related queries to explore different aspects of a question.</p><p>For example, someone might ask:</p><p><em>“What’s the best e-commerce platform for a small business in 2026?”</em></p><p>The system could explore several related topics: platform pricing, transaction fees, integrations, ease of use, scalability, and customer support.</p><p>That creates an important opportunity.</p><p>A useful source does not necessarily have to answer every possible question on the subject. It can contribute reliable information about one relevant part of a broader answer.</p><p>However, there is a crucial distinction between being retrieved and being cited.</p><p>A system might retrieve a page without displaying it as a source. It might cite a page without giving that page much influence over the final answer.</p><p><strong>Being indexed, being retrieved, being cited, and generating business value are different outcomes.</strong></p><p>That distinction should shape how we approach GEO.</p><h3>4. What Does the Research Actually Prove About GEO?</h3><p>The original GEO research introduced a framework for testing how content changes affect visibility in generative responses.</p><p>Researchers experimented with approaches including adding relevant statistics, incorporating citations, and improving how information was presented.</p><p>Their experiments found visibility improvements of <strong>up to 40%</strong> in certain evaluated settings.</p><p>It was an important early demonstration that content presentation could influence generative responses.</p><p>But the number requires context.</p><p>It does not mean that adding statistics to any article will increase ChatGPT mentions by 40%.</p><p>It does not establish a universal ranking formula.</p><p>And it does not guarantee increases in organic traffic or conversions.</p><p>A <a href="https://arxiv.org/abs/2607.14035">July 2026 critical research survey</a>, reviewing 45 studies, highlighted the limitations of the available evidence.</p><p>The review found that factors such as topical relevance and context position were relatively consistent across studied settings, while generic optimization heuristics did not reliably transfer across systems.</p><p>It also warned that experiments involving already-retrieved content should not be mistaken for proof of long-term improvements in real-world discoverability.</p><p>This is an important reality check for an industry filled with confident promises about AI search rankings.</p><p><strong>GEO is a legitimate area of research and optimization, but there is no scientifically established universal formula for being recommended by every AI assistant.</strong></p><h3>5. Six Practical Ways to Improve AI Search Visibility</h3><p>So what should a business actually do?</p><p>The strongest approach is to combine established SEO practices with content that offers clear, distinctive, verifiable value.</p><h3>1. Make your content technically accessible</h3><p>Before an AI search system can use information from your website, that information generally needs to be accessible through the relevant discovery and retrieval mechanisms.</p><p>Start with the fundamentals:</p><ul><li>Publish important content in accessible, crawlable pages.</li><li>Review indexing, canonical URLs, and internal navigation.</li><li>Ensure essential information is available as readable text.</li><li>Avoid unintentionally blocking search crawlers through robots.txt, authentication, or security configurations.</li><li>Maintain accurate titles, descriptions, and structured data where appropriate.</li></ul><p>There is also an important difference between AI search crawlers and model-training crawlers.</p><p><a href="https://developers.openai.com/api/docs/bots">OpenAI’s crawler documentation</a> distinguishes <strong>OAI-SearchBot</strong>, which supports ChatGPT search discovery, from <strong>GPTBot</strong>, which is associated with crawling content that may be used to train foundation models.</p><p>Site owners can manage these separately.</p><p>Blocking model-training access does not automatically require blocking search discovery.</p><p>The important principle is simple: understand what each crawler does before changing your access policy.</p><h3>2. Answer the primary question clearly</h3><p>Clarity benefits both readers and systems attempting to interpret a page.</p><p>Consider two approaches.</p><p><strong>Weak approach:</strong></p><p><em>“In today’s rapidly evolving digital landscape, companies are constantly looking for innovative strategies to improve online performance…”</em></p><p><strong>Better approach:</strong></p><p><em>“Answer Engine Optimization (AEO) is the practice of making content easier to discover, interpret, and use as a direct answer in search and AI-powered experiences.”</em></p><p>The second version immediately answers the question.</p><p>A practical structure is to start with the core answer, explain the underlying concept, provide examples, discuss limitations, and include supporting evidence where needed.</p><p>This is good editorial practice regardless of whether an AI system cites the page.</p><p>It does not require artificially shortening every paragraph or creating hundreds of nearly identical question pages.</p><h3>3. Publish original information, not recycled summaries</h3><p>One of the most significant recommendations in Google’s 2026 guidance is to prioritize what it calls <strong>non-commodity content</strong>.</p><p>In other words, publish information that contributes something beyond what readers can already find everywhere else.</p><p>Examples include original experiments, first-hand product evaluations, independently gathered data, engineering benchmarks, case studies, interviews, and documented lessons from real projects.</p><p><strong>Consider two articles:</strong></p><p><em>“10 Benefits of Cloud Computing”</em></p><p><strong>and</strong></p><p><em>“We Migrated 2 Million Daily API Requests to Cloudflare Workers: Architecture, Costs, and Lessons Learned.”</em></p><p>The first may be useful for beginners, but much of its information is widely available.</p><p>The second has the potential to offer evidence and experience that cannot be reproduced simply by summarizing common knowledge.</p><p>That difference matters.</p><p>AI systems can generate generic explanations relatively easily. Original research and first-hand experience provide distinctive source material.</p><p>Of course, originality does not guarantee citation. The information still needs to be relevant, accurate, accessible, and useful to the question being asked.</p><h3>4. Build topical depth without creating keyword spam</h3><p>Traditional keyword research remains valuable, but modern content planning should also consider the larger questions behind a search.</p><p>Suppose you operate a SaaS platform offering an authentication service.</p><p>Your audience might ask:</p><ul><li>How does OAuth 2.0 work?</li><li>What’s the difference between OAuth and OpenID Connect?</li><li>When should developers use passkeys?</li><li>How do refresh tokens work?</li><li>What are common authentication implementation mistakes?</li></ul><p>These questions form a connected topic area.</p><p>A strong content strategy could build a coherent collection of useful resources, supported by meaningful internal links and practical examples.</p><p>But there is no need to manufacture dozens of nearly identical pages just to target every possible variation.</p><p>The goal is comprehensive, relevant coverage — not content volume for its own sake.</p><h3>5. Establish credibility through verifiable evidence</h3><p>AI visibility is not only about what a brand says on its own website.</p><p>Other credible sources may discuss, evaluate, reference, or challenge that brand.</p><p>A company publishing original research might earn coverage from technical publications, citations in professional discussions, or references from other websites.</p><p>These mentions can increase the availability of corroborating information about its work.</p><p>However, they should be earned rather than manufactured.</p><p>Fake reviews, artificial community discussions, purchased endorsements, and mass-produced promotional content create reputational risks. They are also poor substitutes for genuine expertise.</p><p>Instead, invest in research worth referencing, useful public resources, real customer experiences, accurate company information, and transparent authorship.</p><h3>6. Keep information current and consistent</h3><p>AI assistants are frequently asked to compare products, prices, features, and services.</p><p>Outdated or inconsistent information can make those answers less reliable.</p><p>Imagine a software company whose official pricing page lists $29 per month while older articles, documentation, and third-party listings still describe the product as costing $19.</p><p>Even when an AI system finds the correct page, conflicting information elsewhere can complicate the answer.</p><p>Maintain accurate pricing, product specifications, availability, documentation, company descriptions, and business listings.</p><p>For relevant businesses, Google specifically recommends maintaining accurate Merchant Center and Google Business Profile information.</p><p>This is not an exotic GEO technique.</p><p>It is good information management.</p><h3>6. GEO and AEO Myths That Businesses Should Stop Believing</h3><p>As interest in AI search grows, so does the number of products and services promising guaranteed visibility.</p><p>Several popular claims deserve skepticism.</p><p><strong>Myth: Every website needs an llms.txt file to rank in AI search.</strong></p><p>Google explicitly states in its 2026 guidance that it does not use llms.txt as a special optimization signal for Google Search or its generative AI features.</p><p>Other systems may have their own uses for machine-readable files, but there is no justification for presenting llms.txt as a universal AI search requirement.</p><p><strong>Myth: Adding structured data guarantees an AI citation.</strong></p><p>Structured data can help search engines understand eligible page information and support rich search features.</p><p>It does not guarantee that a generative AI system will cite the page.</p><p>Google also states that no special schema.org markup is required for its generative AI search features.</p><p><strong>Myth: AI content must be broken into tiny chunks.</strong></p><p>Readable sections and logical headings are helpful. Arbitrarily dividing every paragraph into extremely short blocks is not a proven universal optimization technique.</p><p>Google’s guidance specifically rejects mandatory content chunking for AI search.</p><p><strong>Myth: Ranking first on Google means ChatGPT will recommend you.</strong></p><p>Different products use different retrieval systems, data sources, ranking mechanisms, and generation processes.</p><p>Traditional search performance may contribute to visibility in some AI experiences, but it does not guarantee recommendations across platforms.</p><p><strong>Myth: GEO guarantees more traffic.</strong></p><p>A brand can earn citations while receiving few visits.</p><p>This is why teams need to distinguish exposure, engagement, and business results.</p><p>The more useful question is not simply whether an AI system mentioned your website.</p><p>It is whether that visibility contributes to meaningful outcomes.</p><h3>7. How to Measure GEO and AEO in 2026</h3><p>Until recently, AI search visibility was especially difficult to measure.</p><p>Teams frequently relied on manually asking chatbots about their products and recording the responses.</p><p>That approach can still provide qualitative insight, but it has limitations. Responses vary by prompt, platform, time, location, and system behavior.</p><p>Fortunately, first-party reporting is improving.</p><h3>Google Search Console</h3><p>Google introduced dedicated Generative AI performance reports in June 2026 and <a href="https://developers.google.com/search/blog/2026/06/gen-ai-performance-reports">announced worldwide availability</a> as of August 31, 2026.</p><p>The reports offer information about impressions within generative AI features, along with appearing pages, countries, dates, and supported device breakdowns.</p><p>These are visibility metrics. They should not be confused with a complete report of which exact prompts generated business conversions.</p><h3>Bing Webmaster Tools</h3><p>Microsoft introduced its AI Performance reporting in February 2026 and expanded it in June with additional preview capabilities.</p><p>These include citation activity, grounding queries, topic and intent analysis, and <strong>Citation Share</strong> — a measurement of a website’s proportion of displayed citations for particular grounding queries.</p><p>This offers more direct insight into how content appears within supported AI-generated answers.</p><h3>Business analytics</h3><p>Search visibility alone is not enough.</p><p>Companies should also examine referral traffic from AI platforms where identifiable, engagement after arrival, lead generation, sign-ups, purchases, and other relevant conversions.</p><p>A useful measurement framework has four layers:</p><ol><li><strong>Discoverability:</strong> Can relevant systems access and find your content?</li><li><strong>Visibility:</strong> Does your content appear or receive citations?</li><li><strong>Engagement:</strong> Do people visit and interact with your website?</li><li><strong>Business impact:</strong> Does that activity contribute to meaningful outcomes?</li></ol><p>You can also track mentions of your brand across a consistent set of relevant AI prompts.</p><p>However, treat manual prompt testing as directional evidence, not a precise ranking system. Repeat tests, vary phrasing, and avoid drawing conclusions from a single response.</p><p>In 2026, measuring AI search is becoming more practical — but the field is still developing.</p><h3>8. A Practical 30-Day GEO and AEO Action Plan</h3><p>You do not need to rebuild your entire marketing strategy to start adapting.</p><p>A focused month of work can create a useful foundation.</p><h3>Week 1: Audit your existing visibility</h3><p>Review your most valuable pages, identify indexing and accessibility issues, verify crawler settings, and establish current organic traffic and conversion benchmarks.</p><p>Explore the AI visibility reporting available in Google Search Console and Bing Webmaster Tools.</p><h3>Week 2: Improve your most important content</h3><p>Choose three to five pages that address meaningful customer questions.</p><p>Improve their clarity, update outdated information, strengthen internal links, and add examples that help readers understand the topic.</p><p>Avoid rewriting content merely to force AI-friendly formatting.</p><h3>Week 3: Create something genuinely original</h3><p>Publish one substantial resource that provides information not easily available elsewhere.</p><p>That might be a technical experiment, product benchmark, real customer case study, original dataset, or practical implementation guide.</p><p>Prioritize accuracy and usefulness over publishing volume.</p><h3>Week 4: Measure and iterate</h3><p>Review any available AI visibility data, examine referral traffic, and test a small set of representative user questions across relevant AI platforms.</p><p>Document the baseline and results.</p><p>Distinguish observed changes from proven causes.</p><p>Then use what you learn to guide the next editorial cycle.</p><p>The purpose of the first month is not to promise a dramatic increase in AI citations.</p><p>It is to establish a repeatable process for improving the quality, accessibility, and measurement of your content.</p><h3>9. The Next Frontier: From AI Answers to AI Agents</h3><p>An emerging development deserves attention: AI agents that do more than answer questions.</p><p>These systems may compare products, investigate options, navigate websites, and complete tasks on behalf of users.</p><p>That introduces another dimension to discoverability.</p><p>In addition to being useful for human readers and retrievable by search systems, websites may increasingly need to support reliable interaction by automated agents.</p><p>Google’s 2026 guidance already identifies agent-friendly website design as an emerging consideration.</p><p>For businesses, practical preparation can include accurate product information, accessible interfaces, predictable navigation, clear forms, and dependable transaction flows.</p><p>But this is still an evolving area.</p><p>Organizations should prioritize working functionality and accessibility rather than implementing speculative protocols without a clear use case.</p><h3>Final Thoughts: Don’t Optimize for an Acronym. Optimize for Being Useful.</h3><p>GEO and AEO represent a meaningful shift in how digital marketers think about discovery.</p><p>Traditional SEO remains essential.</p><p>But search increasingly includes generated responses, synthesized recommendations, and conversational interactions.</p><p>That creates a broader challenge: content must not only be discoverable; it must also provide information worth using, referencing, and trusting.</p><p>The available research suggests that relevance, original evidence, technical accessibility, and clarity are sensible priorities.</p><p>It does not support promises of guaranteed AI rankings or universal citation growth.</p><p>The strongest strategy is therefore not to abandon SEO and chase every new GEO technique.</p><p>It is to build on proven search fundamentals while adapting your content, measurement, and user experience to the realities of AI-powered discovery.</p><p><strong>The future of search visibility is not simply about appearing in results. It is about contributing something valuable enough to become part of the answer.</strong></p><p>And the best place to start is still the same: understand your audience, answer their real questions, and publish information they cannot easily get anywhere else.</p><h3>Sources and Further Reading</h3><p>This article draws on primary documentation, independent research, and recent industry studies:</p><ol><li><a href="https://developers.google.com/search/docs/fundamentals/ai-optimization-guide">Google Search Central — Optimizing Your Website for Generative AI Features</a>, updated July 2026.</li><li><a href="https://developers.google.com/search/blog/2026/06/gen-ai-performance-reports">Google Search Central — Generative AI Performance Reports</a>, June 2026, with August rollout update.</li><li><a href="https://blogs.bing.com/search/2026/6/New-AI-Visibility-Insights-in-Bing-Webmaster-Tools-Intents-Topics-Citation-Share-Compare/">Microsoft Bing — New AI Visibility Insights</a>, June 2026.</li><li><a href="https://developers.openai.com/api/docs/bots">OpenAI — Overview of OpenAI Crawlers</a>.</li><li><a href="https://www.pewresearch.org/short-reads/2025/07/22/google-users-are-less-likely-to-click-on-links-when-an-ai-summary-appears-in-the-results/">Pew Research Center — Google Users Are Less Likely to Click When an AI Summary Appears</a>, July 2025.</li><li><a href="https://ahrefs.com/blog/ai-overviews-reduce-clicks-update/">Ahrefs — AI Overviews Reduce Clicks by 58%</a>, February 2026.</li><li><a href="https://arxiv.org/abs/2311.09735">Aggarwal et al. — GEO: Generative Engine Optimization</a>, foundational research.</li><li><a href="https://arxiv.org/abs/2607.14035">Martinez — Optimizing Visibility in Generative Engines: A Critical Survey (2023–2026)</a>, July 2026 preprint.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9df15c33576c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Your Existing Chrome Session with Playwright]]></title>
            <link>https://shadisbaih.medium.com/how-to-use-your-existing-chrome-session-with-playwright-e86464619af1?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/e86464619af1</guid>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[qa-testing]]></category>
            <category><![CDATA[google-account]]></category>
            <category><![CDATA[e2e-testing]]></category>
            <category><![CDATA[chrome]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 09:56:03 GMT</pubDate>
            <atom:updated>2026-10-05T09:56:03.297Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A quick guide to bypassing repetitive logins, 2FA, and CAPTCHAs in your local E2E tests.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLdIGJvfoinVeBK8MYF6PQ.jpeg" /></figure><p>When we build out automated test plans, the clean, isolated browser environments that Playwright spins up are usually exactly what we want. They ensure our tests run consistently without interference from leftover cookies or cached data.</p><p>But there is one scenario where this isolation becomes a massive bottleneck: <strong>testing authenticated flows.</strong></p><p>If your application requires a Google login, Playwright’s fresh incognito-like state means you have to log in every single time you run a script. This leads to hitting CAPTCHAs, triggering Two-Factor Authentication (2FA) prompts, and ultimately slowing down your workflow.</p><p>Fortunately, Playwright offers two excellent ways to attach your scripts to an existing Google session so you don’t have to authenticate twice.</p><h3>Method 1: The Persistent Context Approach</h3><p>This method tells Playwright to load your actual, local Chrome profile data directly from your machine. By pointing your script to your user data directory, Playwright boots up with all your active sessions, cookies, and extensions intact.</p><p><strong>Step 1: Find your Chrome Profile Path</strong></p><ol><li>Open your regular Chrome browser.</li><li>Type chrome://version into the URL bar and hit enter.</li><li>Look for the <strong>Profile Path</strong> field. It will look something like this on Windows:</li><li>C:\Users\YourName\AppData\Local\Google\Chrome\User Data\Default</li><li>Note the base directory (everything before \Default).</li></ol><p><strong>Step 2: Close Chrome Completely</strong></p><p>Playwright cannot access your profile data if Chrome is currently using it. Make sure all Chrome windows and background processes are completely closed before running your script.</p><p><strong>Step 3: Launch the Persistent Context</strong></p><p>Use the launchPersistentContext method in your script. By passing the channel: &#39;chrome&#39; argument, you force Playwright to use your local Chrome installation instead of its bundled Chromium browser.</p><pre>const { chromium } = require(&#39;@playwright/test&#39;);<br><br>(async () =&gt; {<br>  // Use the base directory you found in Step 1<br>  const userDataDir = &#39;C:\\Users\\YourName\\AppData\\Local\\Google\\Chrome\\User Data&#39;;<br>  <br>  const context = await chromium.launchPersistentContext(userDataDir, {<br>    channel: &#39;chrome&#39;, <br>    headless: false, // You must run in headed mode to see the browser<br>    args: [&#39;--profile-directory=Default&#39;] // Update this if you use a different profile<br>  });<br>  // Get the default page or create a new one<br>  const page = context.pages()[0] || await context.newPage();<br>  <br>  await page.goto(&#39;https://google.com&#39;);<br>  <br>  console.log(&#39;Successfully loaded the persistent profile!&#39;);<br>})();</pre><h3>Method 2: The Chrome DevTools Protocol (CDP) Approach</h3><p>If you don’t want to constantly close your browser every time you run a test, connecting over CDP is the perfect alternative. Instead of Playwright launching the browser, you launch Chrome yourself in debugging mode, and Playwright simply “attaches” to it.</p><p>This is incredibly useful for writing and debugging scripts on the fly.</p><p><strong>Step 1: Launch Chrome with a Debugging Port</strong></p><p>Close any running instances of Chrome, then open your terminal and launch Chrome with the --remote-debugging-port flag.</p><ul><li><strong>On Windows:</strong></li><li>chrome.exe --remote-debugging-port=9222</li><li><strong>On macOS:</strong></li><li>/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222</li></ul><p><strong>Step 2: Connect Playwright to the Port</strong></p><p>Instead of launching a browser context, use chromium.connectOverCDP to hook into the instance you just opened.</p><pre>const { chromium } = require(&#39;@playwright/test&#39;);<br><br>(async () =&gt; {<br>  // Connect to the local Chrome instance via CDP<br>  const browser = await chromium.connectOverCDP(&#39;http://localhost:9222&#39;);<br>  <br>  // Grab the existing context and page<br>  const context = browser.contexts()[0];<br>  const page = context.pages()[0];<br>  <br>  await page.goto(&#39;https://google.com&#39;);<br>  <br>  console.log(&#39;Successfully connected to the running Chrome instance!&#39;);<br>})();</pre><h3>Which one should you use?</h3><ul><li>Use <strong>Method 1 (Persistent Context)</strong> if you want your script to fully manage the browser lifecycle (opening and closing it automatically), but you still need your authenticated cookies.</li><li>Use <strong>Method 2 (CDP)</strong> if you are actively writing and debugging scripts and want to keep your browser open on your second monitor while you work.</li></ul><p><em>Happy testing!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e86464619af1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build Real Software With AI: From Vibe Coding to an AI Engineering Team]]></title>
            <link>https://shadisbaih.medium.com/how-to-build-real-software-with-ai-from-vibe-coding-to-an-ai-engineering-team-8e02b0f9367a?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e02b0f9367a</guid>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[ai-workflow]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[ai-coding]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 08:54:18 GMT</pubDate>
            <atom:updated>2026-10-05T08:54:18.631Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wfObNOVfE_IpapKzM4jVoA.png" /></figure><h3>The biggest productivity gain from AI coding does not come from better prompts. It comes from a better engineering workflow.</h3><p>There is a tempting way to build software with AI.</p><p>Open your favorite coding agent and type:</p><blockquote><em>Build me an Intercom clone.</em></blockquote><p>A few minutes later, thousands of lines of codeappear.</p><p>There is a dashboard.<br>There is a chat window.<br>There are buttons, animations, and polished components.</p><p>It looks impressive.</p><p>But then you actually try to use it.</p><p>Authentication is incomplete. Realtime messaging is unreliable. Data isolation is unclear. The AI answers questions it should not answer. File processing breaks under realistic workloads. Parts of the architecture contradict each other.</p><p>The problem is not necessarily that the AI model is bad.</p><p>The problem is that:</p><p><strong>“Build me an Intercom clone” is not an engineering plan. It is a wish.</strong></p><p>That is the core idea behind the workflow used to build <strong>Marshall Desk</strong>, an Intercom-style customer support application with realtime chat, AI-powered support, document retrieval, human handoff, authentication, storage, and production infrastructure.</p><p>The interesting part is not the product itself.</p><p>The interesting part is <strong>how AI was used to build it</strong>.</p><p>Instead of treating AI as one extremely fast programmer, the workflow treated AI more like an engineering organization:</p><ul><li>one agent plans,</li><li>another researches,</li><li>others implement,</li><li>others review,</li><li>the browser verifies,</li><li>infrastructure tools execute operations,</li><li>and the human remains responsible for architecture and final judgment.</li></ul><p>The result is a much more mature way to think about AI-assisted software development.</p><h3>The Wrong Mental Model: AI as a Code Generator</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6cAS2r4K2ylxRh4zMiF-MQ.png" /></figure><p>Most AI coding workflows still look something like this:</p><pre>Developer<br>   ↓<br>Prompt<br>   ↓<br>AI generates code<br>   ↓<br>Developer hopes it works</pre><p>This is essentially autocomplete at a larger scale.</p><p>It works well for small features.</p><p>It becomes dangerous when building real products.</p><p>A production application is not just UI and business logic. It also includes authentication, authorization, background processing, data isolation, error handling, infrastructure, deployment, realtime systems, observability, security boundaries, and dozens of product decisions.</p><p>Marshall Desk, for example, may look like a simple chat widget on the surface.</p><p>Underneath it sits a much larger system:</p><ul><li>multi-tenant authentication,</li><li>realtime communication,</li><li>AI classification,</li><li>retrieval-augmented generation,</li><li>embeddings,</li><li>vector search,</li><li>document processing,</li><li>object storage,</li><li>background jobs,</li><li>human handoff,</li><li>production deployment,</li><li>and multiple application environments.</li></ul><p>Giving an AI agent unlimited freedom over all of those decisions is equivalent to hiring a new engineer, giving them a vague one-line specification, and telling them to design the entire company architecture by themselves.</p><p>A better approach starts much earlier.</p><h3>Step 1: Define the Product Before Asking AI to Build It</h3><p>Before serious implementation started, the product was constrained.</p><p>Not just:</p><blockquote><em>We are building customer support software.</em></blockquote><p>But:</p><ul><li>What does V1 contain?</li><li>What is explicitly excluded?</li><li>Who can sign up?</li><li>What is a workspace?</li><li>How does human handoff work?</li><li>What happens when the AI cannot answer?</li><li>What file types can users upload?</li><li>What happens when no human is available?</li><li>Can conversations be reopened?</li><li>Which language should the AI respond in?</li></ul><p>This matters because AI agents are very good at filling empty space.</p><p>Unfortunately, they may fill that space with decisions you never intended to make.</p><p>So one of the most important principles in the workflow was:</p><p><strong>Do not let the model make product decisions simply because you failed to make them yourself.</strong></p><p>The product definition was then combined with:</p><ul><li>system architecture,</li><li>user flows,</li><li>technology decisions,</li><li>project constraints,</li><li>and implementation rules.</li></ul><p>That context eventually became a detailed <strong>Product Requirements Document (PRD)</strong> and project documentation for the coding agents.</p><p>The goal was simple:</p><pre>Less ambiguity<br>      ↓<br>Fewer assumptions<br>      ↓<br>Better AI decisions<br>      ↓<br>More reliable code</pre><h3>Step 2: Use AI to Challenge the Specification</h3><p>Generating the PRD was not the end.</p><p>This is where the workflow became particularly interesting.</p><p>Instead of accepting the first document the model generated, the developer asked the AI to challenge it.</p><p>The instruction was essentially:</p><blockquote><em>Ask me as many questions as necessary. Do not make assumptions for me.</em></blockquote><p>The agent then began asking questions in batches.</p><p>The discussion covered product behavior, technical architecture, security, user roles, conversation lifecycle, supported files, and many other edge cases.</p><p>Eventually, the process involved <strong>62 questions</strong>.</p><p>Why spend so much time here?</p><p>Because every unresolved question before implementation eventually becomes one of three things:</p><ol><li>an assumption,</li><li>a bug,</li><li>or a rewrite.</li></ol><p>AI therefore became more than a code generator.</p><p>It became a <strong>requirements interviewer</strong>.</p><p>That is an extremely powerful pattern.</p><p>Instead of asking:</p><blockquote><em>Can AI write my specification?</em></blockquote><p>A better question is:</p><blockquote><em>Can AI expose everything missing from my specification?</em></blockquote><p>That shift produces significantly better engineering decisions.</p><h3>Step 3: Separate Thinking From Implementation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRScV6bXn6L6snKncCecMw.png" /></figure><p>The core coding workflow used a <strong>two-session system</strong>.</p><p>This may be one of the most reusable ideas from the entire project.</p><h3>Session One: Think and Research</h3><p>The first session does not immediately write the feature.</p><p>Instead, the developer discusses the problem with the AI.</p><p>For example:</p><blockquote><em>I want to implement authentication. I am considering this architecture. What do you think?</em></blockquote><p>The AI responds.</p><p>Then the developer challenges it:</p><blockquote><em>What about magic links?</em></blockquote><blockquote><em>What about server-side sessions?</em></blockquote><blockquote><em>What are the security implications?</em></blockquote><blockquote><em>How does the current authentication library recommend implementing this?</em></blockquote><p>The interaction continues until the solution becomes clear.</p><p>This first session becomes a <strong>reasoning and context-building environment</strong>.</p><p>When the design is mature enough, the developer asks the AI to create a detailed implementation prompt.</p><p>That prompt contains the outcome of the entire discussion.</p><h3>Session Two: Implement</h3><p>The implementation prompt is then given to a completely fresh AI session.</p><p>Why?</p><p>Because implementation requires context-window capacity too.</p><p>If the same agent spends tens or hundreds of thousands of tokens researching, debating and reasoning, then begins implementation inside the same exhausted context, performance may degrade.</p><p>Instead:</p><pre>Session 1<br>Think<br>Research<br>Debate<br>Clarify<br>Plan<br>      ↓<br>Generate implementation prompt<br>      ↓<br>Session 2<br>Fresh context<br>Implement<br>Test<br>Review</pre><p>The workflow is explicitly described as:</p><p><strong>Session 1 = think and research.</strong><br><strong>Session 2 = implement.</strong></p><p>This is very different from continuously asking one chat session to do everything.</p><h3>Step 4: Stop Using One AI Agent for Everything</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YyvUQ7qkmjeBdLB1ohl2cA.png" /></figure><p>Another major idea was the use of specialized AI roles.</p><p>Instead of one agent researching, coding, testing, and reviewing its own work, the workflow separated responsibilities.</p><p>The primary roles were:</p><h3>1. Orchestrator</h3><p>The orchestrator acts like the technical lead.</p><p>Its responsibilities include:</p><ul><li>understanding the feature,</li><li>creating the plan,</li><li>dividing work into smaller components,</li><li>deciding what can run in parallel,</li><li>deciding what must happen sequentially,</li><li>delegating work,</li><li>evaluating results,</li><li>coordinating integration.</li></ul><p>A large request such as:</p><blockquote><em>Implement authentication from end to end.</em></blockquote><p>might become:</p><pre>Authentication<br>├── database/schema<br>├── API/backend<br>├── session management<br>├── signup/login UI<br>├── authorization<br>└── testing/integration</pre><p>The developer no longer has to manually create every tiny task.</p><p>The orchestrator does that decomposition.</p><h3>2. Research Agent</h3><p>The researcher answers technical questions before code is written.</p><p>It can inspect:</p><ul><li>current documentation,</li><li>the web,</li><li>the existing repository,</li><li>architectural decisions,</li><li>libraries,</li><li>APIs,</li><li>and implementation patterns.</li></ul><p>Importantly, the research agent can remain read-only.</p><p>Its job is not to modify anything.</p><p>Its job is to reduce uncertainty.</p><p>This allows the orchestrator to ask:</p><blockquote><em>What is the recommended way to implement this with the current version of the library?</em></blockquote><p>before the implementer starts coding.</p><h3>3. Implementer</h3><p>The implementer receives:</p><ul><li>the task,</li><li>the architecture,</li><li>research results,</li><li>constraints,</li><li>and project documentation.</li></ul><p>Its responsibility is straightforward:</p><p><strong>write the code.</strong></p><p>Multiple implementers can operate on different sub-features when the orchestrator determines that the work can safely happen in parallel.</p><h3>4. Reviewer</h3><p>Once implementation is complete, separate agents review the generated code.</p><p>This is important.</p><p>An AI agent reviewing its own reasoning in the same context is not equivalent to giving the code to a fresh reviewer.</p><p>Fresh reviewer agents can inspect individual areas independently and identify problems the implementation agent missed.</p><p>The complete pattern becomes:</p><pre>Human<br>                      │<br>                      ▼<br>                Orchestrator<br>                      │<br>           ┌──────────┴──────────┐<br>           ▼                     ▼<br>      Researcher             Researcher<br>           │<br>           ▼<br>       Knowledge<br>           │<br>           ▼<br>      Implementers<br>      ┌────┼────┐<br>      ▼    ▼    ▼<br>     A     B     C<br>      │    │    │<br>      ▼    ▼    ▼<br>    Reviewers<br>      │    │    │<br>      └────┼────┘<br>           ▼<br>       Integration<br>           ▼<br>       Human review</pre><p>This starts looking much less like autocomplete.</p><p>It starts looking like a small software team.</p><h3>Step 5: Use Different Models for Different Jobs</h3><p>Another important principle was <strong>multi-model development</strong>.</p><p>The strongest model does not necessarily need to perform every operation.</p><p>A research task may require:</p><ul><li>speed,</li><li>good search behavior,</li><li>reasonable reasoning,</li><li>and low cost.</li></ul><p>Implementation may require:</p><ul><li>stronger coding ability,</li><li>deeper reasoning,</li><li>better instruction following.</li></ul><p>Architecture and orchestration may require an even stronger model.</p><p>Therefore:</p><pre>Research<br>→ fast / inexpensive model<br>Implementation<br>→ strong coding model<br>Orchestration<br>→ strong reasoning model<br>Review<br>→ fresh strong model</pre><p>This matters economically.</p><p>Agentic workflows can generate a large number of model calls.</p><p>If every sub-agent uses the most expensive reasoning mode available, the architecture becomes unnecessarily costly.</p><p>The goal is not:</p><blockquote><em>Use the strongest model everywhere.</em></blockquote><p>It is:</p><blockquote><em>Use sufficient intelligence for each role.</em></blockquote><h3>Step 6: Give Agents Access to Current Information</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIBF5wpex-gn6JXMjQRVIw.png" /></figure><p>Another major limitation of AI coding is stale knowledge.</p><p>Libraries change.</p><p>Framework APIs change.</p><p>Infrastructure services change.</p><p>Best practices change.</p><p>Relying entirely on model training data can therefore produce code that looks correct while using outdated APIs.</p><p>To mitigate this, the workflow used <strong>skills, plugins, documentation access, and MCP servers</strong>.</p><p>For example, the Neon integration allowed agents to access current documentation and interact with the actual Neon project rather than guessing based only on training knowledge.</p><p>The broader principle is:</p><pre>Model intelligence<br>+<br>Live documentation<br>+<br>Existing codebase<br>+<br>Actual infrastructure<br>=<br>Much better engineering context</pre><p>An intelligent model with bad context can still make bad decisions.</p><p>A major part of AI engineering is therefore no longer just choosing models.</p><p>It is <strong>designing the context available to those models</strong>.</p><h3>Step 7: Let the AI Use the Browser as Its Eyes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdHu9rfjK0w_lT7E-cNMuw.png" /></figure><p>One of the most practical parts of the workflow was browser-based verification.</p><p>The implementation agent was instructed not to wait until everything was finished before opening the application.</p><p>Instead:</p><pre>Write code<br>   ↓<br>Open application<br>   ↓<br>Inspect UI<br>   ↓<br>Interact with feature<br>   ↓<br>Capture screenshot<br>   ↓<br>Find issue<br>   ↓<br>Modify code<br>   ↓<br>Repeat</pre><p>This changes frontend development significantly.</p><p>Without browser access, an agent is essentially coding blind.</p><p>It may know that the React tree is valid.</p><p>It may know the CSS compiles.</p><p>It may know the test suite passes.</p><p>But it cannot know that:</p><ul><li>the contrast looks terrible,</li><li>the layout overflows,</li><li>a component cannot scroll,</li><li>the mobile navigation feels wrong,</li><li>an animation is broken,</li><li>or a widget does not appear.</li></ul><p>Browser verification closes that gap.</p><p>For one major feature implementation, the agents generated roughly <strong>35,000 lines of added code across three stacked pull requests</strong>. Multiple research and implementation agents were involved, followed by reviewer agents and browser verification. Thousands of lines were subsequently changed after the review cycles.</p><p>The important point is not the number of lines.</p><p>It is the loop:</p><p><strong>generate → observe → critique → improve.</strong></p><h3>Step 8: Do Not Remove the Human From Code Review</h3><p>At this point it might be tempting to conclude:</p><blockquote><em>If research agents, implementation agents and reviewer agents all inspected the feature, human review is unnecessary.</em></blockquote><p>That was not the conclusion of the workflow.</p><p>The developer still reviewed the generated code.</p><p>And he still found issues.</p><p>Automated PR-review tooling found additional issues afterward as well.</p><p>This exposes an important reality about current AI coding:</p><p>AI can dramatically reduce the amount of engineering labor required.</p><p>It does not eliminate engineering responsibility.</p><p>The human is still responsible for questions such as:</p><ul><li>Does this architecture make sense?</li><li>Is the abstraction necessary?</li><li>Did the agent duplicate logic?</li><li>Is this library being used correctly?</li><li>Are we creating unnecessary complexity?</li><li>Is this secure?</li><li>Will I be able to maintain this in six months?</li></ul><p>The workflow therefore becomes:</p><pre>AI research<br>→ AI implementation<br>→ AI review<br>→ automated verification<br>→ human review<br>→ merge</pre><p>AI moves human attention upward.</p><p>It does not make human judgment irrelevant.</p><h3>Step 9: Give AI Controlled Access to Infrastructure</h3><p>The final evolution of the workflow moved beyond coding entirely.</p><p>Through MCP servers and integrations, AI agents could interact directly with infrastructure.</p><p>For example, agents could work with backend resources, inspect branches and configuration, execute certain operations, and assist with deployment rather than forcing the developer to manually perform every action in external dashboards.</p><p>The development environment therefore starts evolving into something much larger:</p><pre>AI Development Environment<br>├── repository<br>├── terminal<br>├── browser<br>├── documentation<br>├── database<br>├── hosting<br>├── GitHub<br>├── authentication<br>└── infrastructure</pre><p>That is where the word <strong>agentic</strong> starts becoming meaningful.</p><p>An assistant gives instructions.</p><p>An agent can observe state, use tools, perform operations, verify the result, and continue toward a goal.</p><h3>The Engineer’s Job Is Changing</h3><p>Traditional development often looks like this:</p><pre>Think<br>Design<br>Research<br>Code<br>Debug<br>Test<br>Review<br>Deploy</pre><p>The engineer performs almost every operation manually.</p><p>The emerging workflow looks more like:</p><pre>Human<br>├── Define goal<br>├── Define constraints<br>├── Choose architecture<br>├── Make product decisions<br>├── Approve important tradeoffs<br>└── Verify final quality<br>AI system<br>├── Research<br>├── Plan<br>├── Decompose<br>├── Implement<br>├── Test<br>├── Review<br>├── Refactor<br>└── Assist with deployment</pre><p>The engineer is moving from being the person who performs every individual operation to the person who <strong>designs and supervises the engineering system</strong>.</p><p>That requires a different skill set.</p><p>Knowing how to code still matters.</p><p>In fact, it may matter even more.</p><p>If an agent produces 20,000 lines of code, you need enough engineering knowledge to determine whether those 20,000 lines represent a strong architecture or an expensive future problem.</p><h3>A Practical AI Engineering Workflow</h3><p>The entire approach can be reduced to a reusable process.</p><h3>Phase 1 — Product</h3><p>Define:</p><ul><li>user problem,</li><li>V1 features,</li><li>exclusions,</li><li>user flows,</li><li>edge cases.</li></ul><h3>Phase 2 — Architecture</h3><p>Choose:</p><ul><li>frontend,</li><li>backend,</li><li>database,</li><li>APIs,</li><li>authentication,</li><li>infrastructure,</li><li>storage,</li><li>realtime technology.</li></ul><p>Document why.</p><h3>Phase 3 — AI Context</h3><p>Create:</p><ul><li>PRD,</li><li>architecture documentation,</li><li>tech-stack documentation,</li><li>agents.md,</li><li>relevant design rules.</li></ul><h3>Phase 4 — Clarification</h3><p>Ask AI:</p><blockquote><em>Find the ambiguities in this specification and question me until the important assumptions are resolved.</em></blockquote><h3>Phase 5 — Research</h3><p>Use a dedicated session to:</p><ul><li>research libraries,</li><li>inspect existing code,</li><li>compare approaches,</li><li>resolve technical uncertainty.</li></ul><h3>Phase 6 — Implementation Plan</h3><p>Turn the entire discussion into a detailed implementation prompt.</p><h3>Phase 7 — Fresh Implementation Session</h3><p>Start with a clean context.</p><p>Have an orchestrator:</p><ul><li>decompose the feature,</li><li>spawn researchers,</li><li>delegate to implementers,</li><li>coordinate dependencies.</li></ul><h3>Phase 8 — Verification</h3><p>Require agents to:</p><ul><li>run the application,</li><li>use the browser,</li><li>test interactions,</li><li>inspect screenshots,</li><li>run tests,</li><li>check failure states.</li></ul><h3>Phase 9 — Review</h3><p>Use:</p><ul><li>reviewer agents,</li><li>PR-review tools,</li><li>and your own engineering judgment.</li></ul><h3>Phase 10 — Deployment</h3><p>Give agents controlled access to infrastructure where appropriate, but keep meaningful production operations behind explicit human authorization.</p><h3>The Real Lesson</h3><p>The most important lesson from this project is not:</p><blockquote><em>AI can generate 35,000 lines of code.</em></blockquote><p>We already know AI can generate enormous amounts of code.</p><p>The interesting lesson is that <strong>AI works much better when surrounded by an engineering process</strong>.</p><p>A weak workflow with an excellent model can still produce a weak system.</p><p>A strong workflow can turn the same model into:</p><ul><li>a requirements analyst,</li><li>researcher,</li><li>software architect,</li><li>implementation team,</li><li>QA engineer,</li><li>code reviewer,</li><li>and infrastructure assistant.</li></ul><p>The future of AI-assisted development may therefore be less about finding the perfect prompt.</p><p>It may be about designing the perfect <strong>workflow around the model</strong>.</p><p>The developer does not disappear from that system.</p><p>The developer becomes its architect.</p><p>And that may ultimately be the biggest shift AI brings to software engineering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e02b0f9367a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Clean Way to Organize API Calls in React]]></title>
            <link>https://shadisbaih.medium.com/a-clean-way-to-organize-api-calls-in-react-a7430d1ed915?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7430d1ed915</guid>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[api-architecture]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 18:15:29 GMT</pubDate>
            <atom:updated>2026-09-30T18:24:23.237Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AamNSIuI_OcPAMz5qilMpg.png" /></figure><h3>A Clean Way to Organize API Calls in React</h3><p>As a React application grows, calling Axios directly inside components quickly becomes messy.</p><p>Instead of scattering API URLs and HTTP methods everywhere, I prefer separating the API layer into three parts:</p><pre>API Paths<br>   ↓<br>Axios Instance<br>   ↓<br>API Service Functions<br>   ↓<br>React Components</pre><p>Here is a practical example.</p><h3>1. Centralize the Base URL and API Paths</h3><pre>const envBaseUrl = (<br>  import.meta.env.VITE_API_URL || &quot;&quot;<br>).trim();<br><br>export const BASE_URL = (<br>  envBaseUrl || &quot;http://localhost:5000&quot;<br>).replace(/\/+$/, &quot;&quot;);<br><br>export const API_PATHS = {<br>  POSTS: {<br>    CREATE: &quot;/api/posts&quot;,<br>    GET_ALL: &quot;/api/posts&quot;,<br>    GET_ADMIN_ALL: &quot;/api/posts/admin&quot;,<br>    BULK_ACTIONS: &quot;/api/posts/bulk&quot;,<br>    GET_TRENDING_POSTS: &quot;/api/posts/trending&quot;,<br>    GET_BY_SLUG: (slug) =&gt;<br>      `/api/posts/slug/${slug}`,<br>    GET_ADMIN_BY_SLUG: (slug) =&gt;<br>      `/api/posts/admin/slug/${slug}`,<br>    UPDATE: (id) =&gt;<br>      `/api/posts/${id}`,<br>    DELETE: (id) =&gt;<br>      `/api/posts/${id}`,<br>    REVISIONS: (id) =&gt;<br>      `/api/posts/${id}/revisions`,<br>    RESTORE_REVISION: (id, revisionId) =&gt;<br>      `/api/posts/${id}/revisions/${revisionId}/restore`,<br>    LIKE: (id) =&gt;<br>      `/api/posts/${id}/like`,<br>    SEARCH: &quot;/api/posts/search&quot;,<br>  },<br>};</pre><p>This gives the project one source of truth for backend routes.</p><p>If an endpoint changes, you update it in one place instead of searching through multiple components.</p><h3>2. Wrap Requests Inside Service Functions</h3><p>Instead of calling Axios directly from the UI, create functions that describe the operation being performed.</p><pre>import axiosInstance from &quot;../utils/axiosInstance&quot;;<br>import { API_PATHS } from &quot;../utils/apiPaths&quot;;<br><br>export const getPublishedPosts = (params) =&gt;<br>  axiosInstance.get(<br>    API_PATHS.POSTS.GET_ALL,<br>    { params }<br>  );<br><br>export const getAdminPosts = (params) =&gt;<br>  axiosInstance.get(<br>    API_PATHS.POSTS.GET_ADMIN_ALL,<br>    { params }<br>  );<br><br>export const savePost = (id, post) =&gt;<br>  id<br>    ? axiosInstance.put(<br>        API_PATHS.POSTS.UPDATE(id),<br>        post<br>      )<br>    : axiosInstance.post(<br>        API_PATHS.POSTS.CREATE,<br>        post<br>      );<br><br><br>export const deletePost = (postId) =&gt;<br>  axiosInstance.delete(<br>    API_PATHS.POSTS.DELETE(postId)<br>  );<br><br><br>export const bulkUpdatePosts = (postIds, action) =&gt;<br>  axiosInstance.post(<br>    API_PATHS.POSTS.BULK_ACTIONS,<br>    { postIds, action }<br>  );</pre><p>The service layer now contains the HTTP implementation.</p><p>The component does not need to know whether an operation uses GET, POST, PUT, or DELETE.</p><h3>3. Keep Components Focused on UI Logic</h3><p>The component can now simply call:</p><pre>const response = await getPublishedPosts({<br>  status: &quot;published&quot;,<br>  page: pageNumber,<br>});</pre><p>Instead of:</p><pre>const response = await axios.get(<br>  `${BASE_URL}/api/posts`,<br>  {<br>    params: {<br>      status: &quot;published&quot;,<br>      page: pageNumber,<br>    },<br>  }<br>);</pre><p>The difference is important.</p><p>The component now expresses intent:</p><pre>getPublishedPosts();<br>deletePost();<br>savePost();<br>getAdminPosts();</pre><p>rather than implementation details.</p><h3>More Examples</h3><p>The same pattern works well for more complex endpoints.</p><h3>Revisions</h3><pre>export const getPostRevisions = (postId) =&gt;<br>  axiosInstance.get(<br>    API_PATHS.POSTS.REVISIONS(postId)<br>  );<br><br>export const restorePostRevision = (<br>  postId,<br>  revisionId<br>) =&gt;<br>  axiosInstance.post(<br>    API_PATHS.POSTS.RESTORE_REVISION(<br>      postId,<br>      revisionId<br>    )<br>  );</pre><p>Usage:</p><pre>const revisions =<br>  await getPostRevisions(postId);<br><br>  await restorePostRevision(<br>  postId,<br>  revisionId<br>);</pre><h3>Search</h3><pre>export const searchPosts = (params) =&gt;<br>  axiosInstance.get(<br>    API_PATHS.POSTS.SEARCH,<br>    { params }<br>  );</pre><p>Usage:</p><pre>const response = await searchPosts({<br>  q: searchTerm,<br>  page: 1,<br>});</pre><h3>Like and Unlike</h3><pre>export const likePost = (postId) =&gt;<br>  axiosInstance.put(<br>    API_PATHS.POSTS.LIKE(postId)<br>  );<br><br>export const unlikePost = (postId) =&gt;<br>  axiosInstance.delete(<br>    API_PATHS.POSTS.LIKE(postId)<br>  );</pre><p>Notice that both functions reuse the same endpoint while using different HTTP methods.</p><h3>Why I Like This Structure</h3><p>Each file has a clear responsibility:</p><pre>apiPaths.js<br>→ Defines endpoint paths<br>axiosInstance.js<br>→ Handles API configuration<br>postsApi.js<br>→ Defines reusable API operations<br>React components<br>→ Decide when those operations happen</pre><p>The <strong><em>result </em></strong>is:</p><ul><li><strong>less duplicated API code</strong></li><li><strong>cleaner React components</strong></li><li><strong>centralized endpoints</strong></li><li><strong>easier backend changes</strong></li><li><strong>reusable service functions</strong></li><li><strong>simpler authentication and interceptor handling</strong></li><li><strong>better maintainability as the project grows</strong></li></ul><p>A project structure can look like this:</p><pre>src/<br>├── utils/<br>│   ├── apiPaths.js<br>│   └── axiosInstance.js<br>│<br>├── services/<br>│   ├── postsApi.js<br>│   ├── commentsApi.js<br>│   ├── authApi.js<br>│   ├── bookmarksApi.js<br>│   └── sectionsApi.js<br>│<br>├── components/<br>└── pages/</pre><h3>Final Thought</h3><p>The main idea is simple:</p><p>Your React components should focus on <strong>what needs to happen</strong>.</p><p>Your API layer should handle <strong>how it happens</strong>.</p><p>So instead of writing:</p><pre>axios.get(&quot;/api/posts&quot;);</pre><p>throughout the application, your UI can work with meaningful functions:</p><pre>getPublishedPosts();<br>getAdminPosts();<br>savePost();<br>deletePost();<br>restorePostRevision();</pre><p>That small separation makes the codebase much cleaner once the application starts growing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7430d1ed915" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thinking About Edge Cases and System States]]></title>
            <link>https://shadisbaih.medium.com/thinking-about-edge-cases-and-system-states-d4aa341334bb?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4aa341334bb</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Sat, 12 Sep 2026 15:00:33 GMT</pubDate>
            <atom:updated>2026-09-12T15:00:33.585Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Strong Engineers Design for What Happens Beyond the Happy Path</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dO3Nkiz3V68njB4oveK5dA.png" /><figcaption>Reliable software starts when we begin thinking beyond the happy path.</figcaption></figure><p>A user requests an OTP.</p><p>Your backend generates a six-digit code, stores it, sends it to the user, and waits for verification.</p><p>Simple.</p><p>Then the user clicks <strong>“Send code” again</strong>.</p><p>Now what?</p><p>Is the first OTP still valid? Does the second OTP replace it? Can both codes be used? What if the first message arrives after the second one? What if the user requests five OTPs in ten seconds? What if two requests reach the backend at exactly the same time?</p><p>This is where software engineering becomes more than writing code that works.</p><p>You have to think about <strong>edge cases</strong> and, even more importantly, <strong>system states</strong>.</p><h3>The Happy Path Is Only One Path</h3><p>When developers first implement a feature, they naturally think about the expected flow.</p><p>For an OTP system, the happy path might be:</p><pre>User requests OTP<br>        ↓<br>Server generates OTP<br>        ↓<br>OTP is sent<br>        ↓<br>User enters OTP<br>        ↓<br>Server verifies it<br>        ↓<br>User is authenticated</pre><p>There is nothing wrong with starting here.</p><p>The problem is stopping here.</p><p>Real users do not always follow the perfect sequence we imagined while writing the feature.</p><p>They double-click buttons.</p><p>They refresh pages.</p><p>Their internet disconnects.</p><p>Requests time out.</p><p>Background jobs fail.</p><p>External APIs become unavailable.</p><p>Two requests arrive at almost the same time.</p><p>A request succeeds on the server while the client thinks it failed.</p><p>The interesting engineering problems usually begin after the happy path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*nniugjhKwm8hs2ZJ1fd_1A.png" /><figcaption>The happy path is only one possible route through a system.</figcaption></figure><h3>What Is an Edge Case?</h3><p>An <strong>edge case</strong> is a situation that occurs outside the normal or most common flow of a system.</p><p>It may be uncommon, but it can still have serious consequences.</p><p>For example, consider a password-reset flow.</p><p>The expected case is:</p><pre>Request reset link<br>→ Open link<br>→ Choose new password<br>→ Password updated</pre><p>But an engineer should also ask:</p><ul><li>What if the link is opened twice?</li><li>What if it expires while the page is already open?</li><li>What if the user requests another reset link?</li><li>Does the old link remain valid?</li><li>What if the password has already been changed?</li><li>What if two reset requests happen simultaneously?</li><li>What happens if the database update succeeds but sending the confirmation email fails?</li></ul><p>Those questions are edge-case thinking.</p><p>But there is a deeper mental model that makes these questions much easier to discover.</p><p>Think in <strong>states</strong>.</p><h3>Your System Is Always in a State</h3><p>At any moment, a resource in your system has some state.</p><p>An OTP might be:</p><pre>NOT_CREATED<br>CREATED<br>SENT<br>VERIFIED<br>EXPIRED<br>INVALIDATED</pre><p>An order might be:</p><pre>PENDING<br>PAID<br>PROCESSING<br>SHIPPED<br>DELIVERED<br>CANCELLED<br>REFUNDED</pre><p>A file upload might be:</p><pre>NOT_STARTED<br>UPLOADING<br>PROCESSING<br>READY<br>FAILED</pre><p>Thinking in states changes the way you design software.</p><p><strong>Instead of asking only:</strong></p><blockquote><em>“What should this endpoint do?”</em></blockquote><p><strong>you start asking:</strong></p><blockquote><em>“What state is the system currently in?”</em></blockquote><blockquote><em>“What states can it move to?”</em></blockquote><blockquote><em>“Which transitions are allowed?”</em></blockquote><blockquote><em>“Which transitions must never happen?”</em></blockquote><p>That is a much stronger engineering mindset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*bqSpY_BhyE1joCE_lOHPiQ.png" /><figcaption>A system is always in a state, and every action attempts to move it somewhere else</figcaption></figure><h3>Think About Transitions, Not Just Actions</h3><p>Suppose an order is currently:</p><pre>SHIPPED</pre><p>Then a request arrives:</p><pre>POST /orders/123/cancel</pre><p>If you only think about the endpoint, the requirement sounds simple:</p><blockquote><em>Cancel an order.</em></blockquote><p>But state-based thinking immediately exposes the real question.</p><p>Should this transition be allowed?</p><pre>SHIPPED → CANCELLED</pre><p>Probably not.</p><p>Maybe cancellation is allowed only from:</p><pre>PENDING → CANCELLED<br>PAID → CANCELLED</pre><p>Once shipping begins, the customer may need a return flow instead.</p><p>The business rule is not really about the endpoint.</p><p>It is about <strong>valid state transitions</strong>.</p><h3>A Practical Example: OTP Resend</h3><p>Consider the question:</p><blockquote><em>What happens to the old OTP when the user requests a new one?</em></blockquote><p>There are several possible designs.</p><h3>Option 1: Multiple OTPs remain valid</h3><pre>OTP 1 → valid<br>OTP 2 → valid<br>OTP 3 → valid</pre><p>This is easy to implement, but it increases the number of valid credentials floating around.</p><p>It can also create confusing behavior.</p><p>Imagine the user receives the messages in this order:</p><pre>OTP 2<br>OTP 1<br>OTP 3</pre><p>Which one should they use?</p><h3>Option 2: Only the newest OTP is valid</h3><p>When OTP 2 is generated:</p><pre>OTP 1 → invalidated<br>OTP 2 → valid</pre><p>Then if another code is generated:</p><pre>OTP 2 → invalidated<br>OTP 3 → valid</pre><p>Now you have a clear rule:</p><blockquote><em>A user can have only one active OTP for a particular verification purpose.</em></blockquote><p>That single rule eliminates several edge cases.</p><p>Good system design often works this way.</p><p>Instead of writing special handling for twenty strange scenarios, define stronger rules that make those scenarios impossible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*YiGi0HZOKyPUx-M1_eN8sg.png" /><figcaption>A simple OTP feature quickly becomes a state-management problem once retries, expiry, and failures are considered.</figcaption></figure><h3>Invariants Are One of Your Best Tools</h3><p>An <strong>invariant</strong> is something that must always remain true in your system.</p><p>Examples:</p><pre>A user can have at most one active password-reset token.<br>An order cannot be both CANCELLED and SHIPPED.<br>A payment cannot be captured twice.<br>A username must belong to only one account.<br>A coupon cannot be redeemed more times than its allowed limit.</pre><p>When designing a feature, asking:</p><blockquote><em>“What must always be true?”</em></blockquote><p>is incredibly powerful.</p><p>Once you know your invariants, your database constraints, application logic, and tests can all enforce them.</p><h3>Time Creates Edge Cases</h3><p>Many bugs appear because developers think about data but forget about time.</p><p>Imagine:</p><pre>10:00:00 → User requests OTP A<br>10:00:02 → User requests OTP B</pre><p>Your rule says OTP B should invalidate OTP A.</p><p>But networks are asynchronous.</p><p>The messages might arrive like this:</p><pre>10:00:03 → SMS containing OTP B arrives<br>10:00:08 → SMS containing OTP A arrives</pre><p>The user sees OTP A last and naturally assumes it is the newest.</p><p>Your backend state is correct.</p><p>The user experience is not.</p><p>Time introduces questions such as:</p><ul><li>What expires?</li><li>When does it expire?</li><li>Which operation started first?</li><li>Which operation completed first?</li><li>Can an older operation overwrite a newer one?</li><li>What happens after a timeout?</li><li>What happens when something is retried?</li></ul><p>Whenever a feature involves expiration, retries, queues, asynchronous jobs, caching, or external APIs, <strong>time is part of the system design</strong>.</p><h3>Concurrency Creates Even More Interesting Problems</h3><p>Imagine a user double-clicks a payment button.</p><p>Two requests reach your backend:</p><pre>Request A → Charge $50<br>Request B → Charge $50</pre><p>Both requests read:</p><pre>payment_status = NOT_PAID</pre><p>Both decide charging the user is allowed.</p><p>The customer may now be charged twice.</p><p>Each request was individually correct.</p><p>The <strong>system behavior</strong> was wrong.</p><p>This is a race condition.</p><p>Thinking about concurrency means asking:</p><ul><li>Can this operation happen twice?</li><li>Can two requests modify the same resource simultaneously?</li><li>Does the database protect this invariant?</li><li>Should this operation be idempotent?</li><li>Do I need a transaction?</li><li>Do I need a unique constraint?</li><li>Do I need locking?</li><li>Do I need an idempotency key?</li></ul><p>This is where edge-case thinking naturally leads into database design and distributed systems.</p><h3>Idempotency Is a Powerful Defense</h3><p>An idempotent operation can be repeated without producing additional unintended effects.</p><p>Suppose the frontend sends:</p><pre>POST /payments<br>Idempotency-Key: checkout_123</pre><p>The payment succeeds.</p><p>But the response never reaches the frontend.</p><p>The frontend retries.</p><p>Without idempotency:</p><pre>Request 1 → Payment created<br>Request 2 → Another payment created</pre><p>With idempotency:</p><pre>Request 1 → Payment created<br>Request 2 → Existing result returned</pre><p>The retry becomes safe.</p><p>This matters because when a request times out, the client often cannot know whether:</p><pre>The server never received the request</pre><p>or:</p><pre>The server completed the operation,<br>but the response never reached the client.</pre><p>Reliable systems are designed around that uncertainty.</p><h3>Think About Partial Failure</h3><p>A common mistake is assuming an operation either completely succeeds or completely fails.</p><p>Real systems often stop halfway.</p><p>Imagine user registration:</p><pre>1. Create database record      ✓<br>2. Create billing customer     ✓<br>3. Send welcome email          ✗</pre><p>Is registration successful?</p><p>Should you delete the user?</p><p>Should the email be retried?</p><p>What if billing succeeds but saving the billing ID fails?</p><p>What if the third-party service times out after actually creating the resource?</p><p>These are <strong>partial failures</strong>.</p><p>They become especially important when your application communicates with:</p><ul><li>payment providers</li><li>email services</li><li>SMS providers</li><li>cloud storage</li><li>message queues</li><li>authentication providers</li><li>other microservices</li></ul><p>A useful engineering question is:</p><blockquote><strong><em>What happens if step N succeeds and step N+1 fails?</em></strong></blockquote><h3>Users Can Perform Actions Out of Order</h3><p>Developers often imagine:</p><pre>A → B → C → D</pre><p>Users may actually do:</p><pre>A → B → Back → A → Refresh → C</pre><p>They may also open your application in two browser tabs.</p><p>Tab 1:</p><pre>User edits profile</pre><p>Tab 2:</p><pre>User deletes account</pre><p>Then Tab 1 submits the old profile form.</p><p>What should happen?</p><p>State-based thinking helps here too.</p><p>Before executing an operation, verify that the <strong>current state still permits it</strong>.</p><p>Never assume the state is unchanged simply because the UI displayed it several seconds ago.</p><h3>A Simple Framework for Finding Edge Cases</h3><p>When implementing a feature, walk through a few categories.</p><h3>Input</h3><p>Ask what happens with:</p><pre>empty<br>null<br>undefined<br>invalid format<br>extremely large values<br>boundary values<br>unexpected characters<br>duplicate values</pre><h3>State</h3><p>Ask:</p><pre>What state exists before this action?<br>What state should exist afterward?<br>Which states should reject this action?</pre><h3>Repetition</h3><p>Ask:</p><pre>What if the user clicks twice?<br>What if the request is retried?<br>Can the operation safely execute twice?</pre><h3>Time</h3><p>Ask:</p><pre>What expires?<br>What happens if something arrives late?<br>What happens after a timeout?</pre><h3>Concurrency</h3><p>Ask:</p><pre>What if two requests happen simultaneously?<br>Can both read the same old state?<br>Can one overwrite the other?</pre><h3>Failure</h3><p>Ask:</p><pre>What if the database fails?<br>What if an external API fails?<br>What if only half the operation succeeds?</pre><h3>Authorization</h3><p>Ask:</p><pre>Can another user perform this action?<br>Can the owner still perform it after permissions change?<br>Are authorization checks based on the latest state?</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*83GGcaGaEnv3oBWjENN8JQ.png" /><figcaption>A small checklist can reveal a surprisingly large number of production problems before they happen.</figcaption></figure><p>This short exercise catches an enormous number of bugs before they reach production.</p><h3>Make States Explicit</h3><p>One way to make systems easier to reason about is to represent important states explicitly.</p><p>Instead of several boolean fields:</p><pre>isPaid<br>isCancelled<br>isShipped<br>isRefunded</pre><p>you may sometimes be better served by:</p><pre>status = &quot;PAID&quot;</pre><p>with clearly defined transitions.</p><p>For example:</p><pre>PENDING<br>   ↓<br>PAID<br>   ↓<br>PROCESSING<br>   ↓<br>SHIPPED<br>   ↓<br>DELIVERED</pre><p>Alternative transitions might include:</p><pre>PENDING → CANCELLED<br>PAID → REFUNDED</pre><p>Once the model is clear, your API validation, database rules, tests, and documentation become clearer too.</p><p>For sufficiently complex workflows, this idea becomes a formal <strong>finite-state machine</strong>.</p><h3>Edge Cases Are Not Just a QA Responsibility</h3><p>Developers sometimes treat edge cases as something testers discover later.</p><p>That is backwards.</p><p>QA is extremely valuable for finding scenarios developers missed, but many edge cases require architectural or product decisions.</p><p>A tester can ask:</p><blockquote><em>“What should happen if a user requests a second OTP?”</em></blockquote><p>But someone still needs to define the rule.</p><p>Should the old code expire?</p><p>Should both remain active?</p><p>Should requests be rate-limited?</p><p>Should there be a cooldown?</p><p>Those are system-design decisions.</p><p>Edge-case thinking belongs throughout the entire development process:</p><pre>Requirements<br>    ↓<br>Design<br>    ↓<br>Implementation<br>    ↓<br>Testing<br>    ↓<br>Monitoring</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*YNgPxtlHm9UW3y3_0rFJJA.png" /><figcaption>Reliability is a continuous cycle: anticipate, test, observe, learn, and improve.</figcaption></figure><h3>Production Will Find the Cases You Forgot</h3><p>Even strong engineering teams cannot predict everything.</p><p>That is why reliable engineering does not stop with defensive code.</p><p>You also need observability.</p><p>Useful signals include:</p><pre>structured logs<br>metrics<br>error tracking<br>distributed traces<br>audit logs<br>alerts</pre><p>Suppose users occasionally report that an OTP is invalid immediately after receiving it.</p><p>Without useful telemetry, you may have no idea why.</p><p>With proper observability, you might discover:</p><pre>OTP requested<br>       ↓<br>OTP regenerated 600 ms later<br>       ↓<br>Old SMS delivered after new SMS<br>       ↓<br>Verification attempted with old OTP</pre><p>Now the “random bug” becomes an understandable state-transition problem.</p><h3>The Engineering Mindset</h3><p>Strong engineering is not the ability to predict every possible failure.</p><p>That is impossible.</p><p>It is the habit of asking better questions <strong>before the system reaches production</strong>.</p><p><strong>Instead of asking only:</strong></p><blockquote><em>Does this work?</em></blockquote><p><strong>Ask:</strong></p><blockquote><em>What state is the system in?</em></blockquote><blockquote><em>What happens if this runs twice?</em></blockquote><blockquote><em>What if another request happens at the same time?</em></blockquote><blockquote><em>What if the previous step succeeds but this one fails?</em></blockquote><blockquote><em>What happens when the request arrives late?</em></blockquote><blockquote><em>What must always remain true?</em></blockquote><blockquote><em>Which state transitions should never be allowed?</em></blockquote><p>Those questions change how you write APIs, database schemas, authentication systems, payment flows, background jobs, and distributed services.</p><p>The happy path proves that your feature <strong>can work</strong>.</p><p>Thinking about states and edge cases is what helps prove that it can <strong>survive the real world</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4aa341334bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your ML Model Is Not the Whole Project: Why DVC and MLflow Matter]]></title>
            <link>https://shadisbaih.medium.com/your-ml-model-is-not-the-whole-project-why-dvc-and-mlflow-matter-6e2d9daabf31?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e2d9daabf31</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[mlflow]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[dvc]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 15:47:47 GMT</pubDate>
            <atom:updated>2026-08-25T15:47:47.729Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Training a machine learning model is often the easiest part of building a real AI system.</strong></p><p>You load a dataset.</p><p>You preprocess it.</p><p>You call model.fit().</p><p>You get 95% accuracy.</p><p><strong>Great</strong>.</p><p>Then you update the dataset, tune a few parameters, retrain the model, and suddenly you get 97%.</p><p><strong>Even better.</strong></p><p>A few days later, more data is added. You retrain again.</p><p>Now the accuracy is 94%.</p><p>And this is where machine learning stops being just a modeling problem and starts becoming an <strong>engineering problem</strong>.</p><p>Which dataset produced the 97% result?</p><p>Which hyperparameters were used?</p><p>Which version of the code produced that model?</p><p>Is the previous model still available?</p><p>Can the experiment be reproduced exactly?</p><p>If you cannot answer those questions, you do not really have a reproducible machine learning system.</p><p>You have a collection of experiments.</p><p>This is exactly where tools such as <strong>DVC</strong> and <strong>MLflow</strong> become valuable.</p><h3>Git Solved This Problem for Code</h3><p>Software engineers have dealt with versioning problems for years.</p><p>Imagine developing a large application without Git.</p><p>Your project might eventually look something like this:</p><pre>app.py<br>app_final.py<br>app_final_v2.py<br>app_really_final.py<br>app_really_final_fixed.py</pre><p>That quickly becomes impossible to manage.</p><p>Git solved this by introducing structured version history.</p><p>Instead of maintaining multiple copies manually, we can track:</p><pre>Code V1<br>Code V2<br>Code V3</pre><p>We can compare changes.</p><p>We can create branches.</p><p>We can identify exactly when something changed.</p><p>And when necessary, we can return to a previous state.</p><p>But machine learning introduces another critical asset that traditional software projects usually do not depend on as heavily:</p><p><strong>data</strong>.</p><p>And data does not fit naturally into the same version-control workflow.</p><h3>Data Changes Too</h3><p>Consider a simple machine learning project.</p><p>You start with:</p><pre>Dataset V1<br>2,000 samples</pre><p>You train a model and obtain:</p><pre>Accuracy: 95%</pre><p>Later, you collect another 500 samples.</p><p>Now you have:</p><pre>Dataset V2<br>2,500 samples</pre><p>You retrain the model:</p><pre>Accuracy: 97%</pre><p>Excellent.</p><p>Then more data arrives.</p><p>You train again:</p><pre>Accuracy: 94%</pre><p>Something changed.</p><p>Maybe the new samples contain noisy labels.</p><p>Maybe the data distribution shifted.</p><p>Maybe preprocessing behaved differently.</p><p>Maybe some low-quality examples entered the training set.</p><p>Before investigating any of those possibilities, however, you need to answer one fundamental question:</p><p><strong>Which exact dataset produced each model?</strong></p><p>That is the problem <strong>DVC</strong> helps solve.</p><h3>Think of DVC as Git for Data</h3><p>DVC stands for <strong>Data Version Control</strong>.</p><p>A useful mental model is:</p><pre>Git → code versions<br>DVC → data versions</pre><p>DVC does not replace Git.</p><p>It complements it.</p><p>The key idea is simple: large datasets do not need to live directly inside your Git repository.</p><p>The actual files can be stored somewhere more appropriate, such as:</p><pre>AWS S3<br>Google Drive<br>Azure<br>A remote server<br>Local storage</pre><p>DVC tracks lightweight metadata that identifies which version of the data belongs to a particular state of the project.</p><p>This makes it possible to connect code history and data history without filling a Git repository with massive binary files.</p><h3>The Hash Is the Key</h3><p>DVC uses hashes to identify versions of files.</p><p>You can think of a hash as a digital fingerprint.</p><p>If the file changes, the fingerprint changes.</p><p>For example:</p><pre>data.csv<br><br>Version 1 → abc123<br>Version 2 → xyz456<br>Version 3 → qwe789</pre><p>Each version of the dataset has a different hash.</p><p>Git does not need to store the entire dataset.</p><p>Instead, it can track a small DVC metadata file that describes which dataset version should be used.</p><p>The actual file remains in remote storage.</p><p>This gives us a clean separation:</p><pre>Git<br>→ source code<br>→ DVC metadata<br><br>Remote Storage<br>→ actual dataset files</pre><p>That becomes especially useful when datasets are measured in gigabytes rather than kilobytes.</p><h3>The DVC Workflow Feels Familiar</h3><p>If you already understand Git, the basic DVC workflow is relatively intuitive.</p><p>First, initialize the project:</p><pre>git init<br>dvc init</pre><p>Then start tracking a dataset:</p><pre>dvc add data.csv</pre><p>DVC creates metadata describing the file.</p><p>The actual dataset can then be pushed to remote storage:</p><pre>dvc push</pre><p>And retrieved later using:</p><pre>dvc pull</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmHTlDMM2nXO__WLCvu6Yw.png" /></figure><p>Conceptually, the workflow has a familiar shape:</p><pre>git add<br>git push</pre><p>and:</p><pre>dvc add<br>dvc push</pre><p>The two systems are not identical, but the similarity makes DVC easier to understand.</p><p>Git manages the code history.</p><p>DVC manages the data history.</p><p>Together, they describe a much more complete state of a machine learning project.</p><h3>Every Git Commit Can Point to the Right Data</h3><p>This is where things become powerful.</p><p>Imagine the following history:</p><pre>Git Commit A<br>│<br>└── Dataset Version 1<br>Git Commit B<br>│<br>└── Dataset Version 2<br>Git Commit C<br>│<br>└── Dataset Version 3</pre><p>If Dataset Version 3 causes a problem, you can return to an earlier Git commit and restore the corresponding dataset.</p><p>Instead of saying:</p><blockquote>“I think this was the dataset we used.”</blockquote><p>you can reconstruct the actual project state.</p><p>That means a specific code version can be connected to a specific data version.</p><p>And that is a major step toward reproducibility.</p><h3>But Data Versioning Is Only Half the Problem</h3><p>Suppose data versioning is now solved.</p><p>You still train dozens of models.</p><p>Maybe you experiment with:</p><pre>learning_rate = 0.01<br>learning_rate = 0.001<br>learning_rate = 0.0001</pre><p>You change values such as:</p><pre>depth<br>batch size<br>number of estimators<br>epochs<br>dropout</pre><p>Soon you have 30 or 50 different training runs.</p><p>Then someone asks:</p><blockquote>Which one performed best?</blockquote><p>Without proper experiment tracking, the answer might be:</p><blockquote>I think it was one of the runs from last week.</blockquote><p>That is not a reliable engineering workflow.</p><p>This is where <strong>MLflow</strong> comes in.</p><h3>MLflow Is Your Experiment Memory</h3><p>MLflow helps track what happened during machine learning experiments.</p><p>For each training run, it can record information such as:</p><h3>Parameters</h3><pre>learning_rate = 0.001<br>batch_size = 32<br>depth = 10</pre><h3>Metrics</h3><pre>accuracy = 0.97<br>F1 = 0.95<br>loss = 0.11</pre><h3>Artifacts</h3><pre>plots<br>CSV files<br>model files<br>evaluation outputs<br>confusion matrices<br>training logs</pre><p>MLflow can also manage the trained model itself.</p><p>Tracking data can be stored locally or through a centralized tracking server backed by persistent storage.</p><p>The goal is simple:</p><p><strong>Stop relying on memory and start recording experiments as structured engineering data.</strong></p><h3>Experiment vs. Run</h3><p>Two concepts are especially important in MLflow:</p><p><strong>Experiment</strong> and <strong>Run</strong>.</p><p>An <strong>Experiment</strong> represents a broader project or objective.</p><p>For example:</p><pre>Experiment:<br>Image Classification</pre><p>Inside that experiment, you can have multiple runs:</p><pre>Run 1<br>learning_rate = 0.01<br>accuracy = 0.86<br>Run 2<br>learning_rate = 0.001<br>accuracy = 0.91<br>Run 3<br>learning_rate = 0.0005<br>accuracy = 0.95</pre><p>Each run represents one execution of the training process with a particular configuration.</p><p>MLflow allows those runs to be stored, inspected, and compared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gOuRXSgWWRMDMg3_JpR2dQ.png" /></figure><p>This creates a structured history of model development.</p><p>Instead of remembering that “Run 3 was probably the best,” you can inspect the exact parameters and metrics that produced it.</p><h3>Comparing Experiments Becomes Much Easier</h3><p>Suppose you run three experiments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fJZLeoARr__7pMt8s7Spg.png" /></figure><p>The best result is immediately visible:</p><pre>Best Run → Run 3<br>Accuracy → 97%</pre><p>More importantly, you know <strong>why</strong> that run is different.</p><p>You can inspect:</p><ul><li>the parameters,</li><li>the metrics,</li><li>generated artifacts,</li><li>training logs,</li><li>and the resulting model.</li></ul><p>That makes experimentation far more systematic.</p><h3>Autologging Makes It Even Easier</h3><p>MLflow also supports <strong>autologging</strong> for popular machine learning frameworks such as:</p><pre>Scikit-learn<br>PyTorch<br>TensorFlow</pre><p>Instead of manually recording every parameter or metric, MLflow can automatically capture much of the information produced during training.</p><p>For standard workflows, this can significantly reduce boilerplate.</p><p>For specialized applications, however, custom logging is still useful when you need to capture domain-specific metrics or artifacts.</p><p>The important point is not whether logging is automatic or manual.</p><p>The important point is that the experiment becomes <strong>traceable</strong>.</p><h3>What Happens When the Model Reaches Production?</h3><p>Experiment tracking is useful during development.</p><p>But once a model reaches production, another problem appears:</p><p><strong>model versioning</strong>.</p><p>Imagine you have:</p><pre>Model V1<br>Model V2<br>Model V3</pre><p>You deploy Model V3.</p><p>Then something breaks.</p><p>Without proper model management, you may need to manually locate an older model or retrain one from scratch.</p><p>MLflow provides a <strong>Model Registry</strong> for managing different model versions.</p><p>For example:</p><pre>V1 → old model<br>V2 → stable model<br>V3 → new model</pre><p>If V3 introduces a production issue, the system can return to V2.</p><p>This makes rollback a controlled engineering operation rather than an emergency reconstruction effort.</p><h3>Now Put Everything Together</h3><p>At this point, the relationship between the tools becomes clearer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jsOwN6B9F7fOREHQqYOakA.png" /></figure><p>The complete mental model is:</p><pre>Git<br>↓<br>Code Versioning<br><br>DVC<br>↓<br>Data Versioning<br><br>MLflow<br>↓<br>Experiment Tracking<br>Model Management</pre><p>Git answers:</p><blockquote>Which code did we use?</blockquote><p>DVC answers:</p><blockquote>Which data did we use?</blockquote><p>MLflow answers:</p><blockquote>Which experiment did we run, what parameters were used, and what result did we get?</blockquote><p>Together, they provide visibility into the full machine learning lifecycle.</p><h3>The 97% → 94% Problem</h3><p>Now return to the example from the beginning.</p><pre>Dataset V1<br>→ Model<br>→ 95% accuracy<br>Dataset V2<br>→ Model<br>→ 97% accuracy<br>Dataset V3<br>→ Model<br>→ 94% accuracy</pre><p>The latest model performs worse.</p><p>Without versioning and experiment tracking, investigating the drop can quickly become difficult.</p><p>With <strong>DVC</strong>, you can determine which dataset version was used.</p><p>With <strong>MLflow</strong>, you can compare the training runs, model parameters, metrics, and artifacts associated with each version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XZHXthK766kphKpPFZbO1Q.png" /></figure><p>Now the investigation becomes structured:</p><pre>Performance dropped<br>        ↓<br>Identify the affected run<br>        ↓<br>Inspect its dataset version<br>        ↓<br>Compare it with the previous version<br>        ↓<br>Find the data or configuration change<br>        ↓<br>Fix it or roll back</pre><p>Instead of guessing, you have lineage.</p><p>And that is one of the core ideas behind MLOps.</p><h3>Do Not Memorize the Commands</h3><p>One principle applies to almost every engineering tool:</p><p><strong>Understand the logic instead of memorizing the syntax.</strong></p><p>You do not need to memorize every DVC or MLflow command.</p><p>You need to understand the problem each tool solves.</p><pre>I need to track code<br>→ Git<br>I need to track dataset versions<br>→ DVC<br>I need to track experiments<br>→ MLflow</pre><p>Once the concept is clear, finding the exact command later is easy.</p><p>Documentation, notebooks, references, and AI tools can help with syntax.</p><p>Understanding <strong>why the tool exists</strong> is much more important.</p><h3>MLOps Is Becoming Part of the AI Engineer Role</h3><p>Modern AI engineering requires more than knowing how to train models.</p><p>Relevant skills increasingly include:</p><pre>Git and GitHub<br>MLOps<br>APIs<br>SQL<br>Server management<br>Deployment<br>Automation<br>Research<br>Agentic AI</pre><p>An AI engineer is not simply someone who can call:</p><pre>model.fit()</pre><p>A production-focused AI engineer needs to understand how to move a model from:</p><pre>Notebook</pre><p>to:</p><pre>Reliable Production System</pre><p>That requires much more than model accuracy.</p><p>It requires data management, experiment tracking, infrastructure, deployment, reproducibility, monitoring, and maintainability.</p><p>In other words:</p><p><strong>it requires engineering.</strong></p><h3>Final Takeaway</h3><p>The key idea behind DVC and MLflow is <strong>traceability</strong>.</p><p>A serious machine learning project should be able to answer:</p><pre>Which code did we use?<br>Which data did we use?<br>Which parameters did we use?<br>What metrics did we get?<br>Which model was deployed?<br>Can we reproduce the result?<br>Can we roll back if something fails?</pre><p>Git, DVC, and MLflow solve different parts of that problem.</p><pre>Git<br>→ Code<br>DVC<br>→ Data<br>MLflow<br>→ Experiments and Models</pre><p>When these pieces are connected, machine learning development becomes much more systematic.</p><p>You are no longer managing disconnected notebooks, datasets, and model files.</p><p>You are building a workflow that can be <strong>reproduced, traced, compared, maintained, and trusted</strong>.</p><p>And that is one of the fundamental differences between simply training machine learning models and <strong>engineering production-ready AI systems</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e2d9daabf31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Overthinking Supabase Data Access: REST API vs SDK vs Edge Functions]]></title>
            <link>https://shadisbaih.medium.com/stop-overthinking-supabase-data-access-rest-api-vs-sdk-vs-edge-functions-fc55104b00a5?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc55104b00a5</guid>
            <category><![CDATA[edge-computing]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 23:05:45 GMT</pubDate>
            <atom:updated>2026-07-23T23:05:45.322Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the first things that surprises developers when they start using Supabase is how many different ways there are to interact with the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfuAWCXevy6fKP_m9lvA5Q.png" /></figure><p>You create a table, and suddenly you have:</p><ul><li>A generated REST API</li><li>The official Supabase SDK</li><li>PostgreSQL RPC functions</li><li>Edge Functions</li><li>Direct SQL</li></ul><p>At first glance, it feels like there are too many options. If they all access the same PostgreSQL database, which one should you actually use?</p><p>This question appears regularly in developer communities, and the answer is often oversimplified. Some developers insist you should always use the SDK. Others recommend calling the REST API directly. Then there are those who push everything into Edge Functions.</p><p>The reality is much simpler:</p><p><strong>These tools are not competitors — they solve different problems.</strong></p><p>Understanding where each one fits will help you build applications that are cleaner, more secure, and easier to maintain.</p><h3>Everything Starts with PostgreSQL</h3><p>Supabase isn’t a traditional Backend-as-a-Service with a proprietary database hidden behind an API. At its core, it’s PostgreSQL.</p><p>Around that database, Supabase provides a collection of services:</p><ul><li>Authentication</li><li>Storage</li><li>Realtime</li><li>Edge Functions</li><li>Automatically generated APIs</li></ul><p>One of the most powerful features is that <strong>every table automatically becomes a REST endpoint</strong>. There’s no need to write controllers or CRUD endpoints yourself.</p><p>Suppose you create a simple table:</p><pre>CREATE TABLE products (<br>    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,<br>    name TEXT NOT NULL,<br>    price NUMERIC,<br>    stock INTEGER<br>);</pre><p>Without writing a single line of backend code, Supabase immediately exposes it through:</p><pre>https://your-project.supabase.co/rest/v1/products</pre><p>That’s possible because Supabase uses <strong>PostgREST</strong>, which translates HTTP requests into SQL queries behind the scenes.</p><h3>Option 1: The Generated REST API</h3><p>Every CRUD operation can be performed using plain HTTP.</p><p>Fetching all products:</p><pre>GET /rest/v1/products</pre><p>Filtering by price:</p><pre>GET /rest/v1/products?price=gte.100</pre><p>Searching:</p><pre>GET /rest/v1/products?name=ilike.*laptop*</pre><p>Sorting:</p><pre>GET /rest/v1/products?order=price.desc</pre><p>Pagination:</p><pre>GET /rest/v1/products?limit=20&amp;offset=40</pre><p>Relationships are equally impressive.</p><p>Imagine you have two tables:</p><ul><li>products</li><li>categories</li></ul><p>connected by a foreign key.</p><p>Instead of writing SQL joins, you simply request:</p><pre>GET /products?select=id,name,categories(name)</pre><p>The API automatically returns nested data.</p><p>For developers who have spent years building Express or Spring Boot CRUD controllers, this feels almost magical.</p><h3>So Why Doesn’t Everyone Just Use the REST API?</h3><p>Because writing raw HTTP requests quickly becomes repetitive.</p><p>Every request requires:</p><ul><li>Authorization headers</li><li>API keys</li><li>Query parameters</li><li>URL encoding</li><li>Response parsing</li><li>Error handling</li></ul><p>Consider this request:</p><pre>GET /products?price=gte.100&amp;order=price.desc</pre><p>Now compare it to the same query using the SDK:</p><pre>const { data } = await supabase<br>  .from(&quot;products&quot;)<br>  .select(&quot;*&quot;)<br>  .gte(&quot;price&quot;, 100)<br>  .order(&quot;price&quot;, { ascending: false });</pre><p>Both produce nearly identical SQL.</p><p>The second is simply much easier to read and maintain.</p><h3>Option 2: The Supabase SDK</h3><p>This is an important point that many developers miss.</p><p><strong>The SDK is not an alternative database client.</strong></p><p>It is a developer-friendly wrapper around the same APIs provided by Supabase.</p><p>When you write:</p><pre>await supabase<br>  .from(&quot;products&quot;)<br>  .select(&quot;*&quot;);</pre><p>the SDK ultimately sends an HTTP request to the generated REST API.</p><p>It simply handles the details for you.</p><p>Besides cleaner syntax, it also provides:</p><ul><li>Automatic authentication</li><li>Session management</li><li>TypeScript support</li><li>Realtime subscriptions</li><li>Storage APIs</li><li>Authentication helpers</li><li>RPC support</li></ul><p>If you’re building a React, Next.js, or React Native application, the SDK should almost always be your first choice.</p><h3>Option 3: PostgreSQL Functions (RPC)</h3><p>Not every operation is a CRUD request.</p><p>Imagine a dashboard showing:</p><ul><li>Monthly revenue</li><li>Total orders</li><li>Average order value</li><li>Best-selling products</li></ul><p>You could fetch thousands of rows and calculate everything in JavaScript.</p><p>Or you could let PostgreSQL do what it’s designed for.</p><pre>CREATE FUNCTION total_sales()<br>RETURNS NUMERIC<br>LANGUAGE SQL<br>AS $$<br>SELECT SUM(total)<br>FROM orders;<br>$$;</pre><p>Calling it is straightforward:</p><pre>const { data } = await supabase.rpc(&quot;total_sales&quot;);</pre><p>Instead of transferring thousands of records across the network, the database performs the calculation and returns a single value.</p><p>RPC functions are particularly useful for:</p><ul><li>Reporting</li><li>Analytics</li><li>Aggregations</li><li>Complex joins</li><li>Transactions</li><li>Reusable business logic</li></ul><p>Whenever the database can perform the work more efficiently than the client, RPC is worth considering.</p><h3>Option 4: Edge Functions</h3><p>Some logic doesn’t belong in the browser.</p><p>Examples include:</p><ul><li>Processing Stripe payments</li><li>Sending emails</li><li>Calling the OpenAI API</li><li>Accessing third-party services</li><li>Using secret API keys</li><li>Executing multi-step workflows</li></ul><p>This is exactly where Edge Functions shine.</p><p>A common request flow looks like this:</p><pre>Client<br>   │<br>   ▼<br>Edge Function<br>   ├── PostgreSQL<br>   ├── Stripe<br>   ├── OpenAI<br>   └── Resend</pre><p>The client only communicates with the Edge Function.</p><p>Secrets remain on the server, and sensitive operations are never exposed to users.</p><h3>Security Is Built Around Row Level Security</h3><p>A common misconception is that exposing a REST API means exposing your database.</p><p>That isn’t how Supabase works.</p><p>Every request is evaluated against <strong>Row Level Security (RLS)</strong> policies.</p><p>For example:</p><pre>USING (user_id = auth.uid())</pre><p>This policy ensures users can only access their own records.</p><p>It doesn’t matter whether the request comes from:</p><ul><li>The REST API</li><li>The SDK</li><li>A mobile application</li><li>An external HTTP client</li></ul><p>The same authorization rules are always enforced.</p><p>The only exception is the <strong>Service Role</strong> key, which bypasses RLS entirely and should only be used in trusted server environments.</p><h3>Which One Should You Choose?</h3><p>There isn’t a single correct answer because each tool serves a different purpose.</p><h3>Use the SDK when…</h3><ul><li>Building React applications</li><li>Building React Native apps</li><li>Working with Next.js</li><li>Implementing standard CRUD operations</li><li>Using authentication or storage</li><li>Taking advantage of TypeScript support</li></ul><p>For most frontend applications, this is the default choice.</p><h3>Use the REST API when…</h3><ul><li>Integrating external services</li><li>Building language-agnostic clients</li><li>Connecting automation platforms like n8n or Make</li><li>Working with backend services written in Java, Go, Python, or C#</li></ul><p>The REST API is especially valuable when HTTP is the common language between systems.</p><h3>Use RPC when…</h3><ul><li>Calculating reports</li><li>Running analytics</li><li>Executing complex SQL</li><li>Performing transactions</li><li>Keeping data-heavy logic close to PostgreSQL</li></ul><h3>Use Edge Functions when…</h3><ul><li>Calling external APIs</li><li>Handling payments</li><li>Sending emails</li><li>Managing secrets</li><li>Building server-side workflows</li><li>Performing operations that should never run in the browser</li></ul><h3>The Architecture I Recommend</h3><p>Rather than forcing everything through one approach, combine them.</p><pre>React / React Native<br>                         │<br>         ┌───────────────┴───────────────┐<br>         │                               │<br>     Simple CRUD                  Complex Operations<br>         │                               │<br>         ▼                               ▼<br>    Supabase SDK                 Edge Functions<br>         │                               │<br>         └───────────────┬───────────────┘<br>                         ▼<br>                  PostgreSQL (RPC)</pre><p>This architecture keeps responsibilities separated:</p><ul><li>The SDK handles everyday application development.</li><li>RPC keeps expensive database operations inside PostgreSQL.</li><li>Edge Functions encapsulate server-side business logic and secrets.</li><li>The REST API remains available for external integrations and non-JavaScript clients.</li></ul><p>Each component does one job well.</p><h3>Final Thoughts</h3><p>The biggest mistake developers make is treating Supabase’s data access options as mutually exclusive.</p><p>They aren’t.</p><p>The generated REST API is the foundation that makes Supabase so flexible. The SDK builds on top of it to provide a more productive developer experience. RPC functions allow PostgreSQL to handle complex computations efficiently, while Edge Functions provide a secure environment for business logic and third-party integrations.</p><p>Instead of asking, <strong>“Which one should I use?”</strong>, ask a better question:</p><p><strong>“Which tool is responsible for this specific job?”</strong></p><p>Once you think about data access this way, the architecture becomes much easier to design — and much easier to scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc55104b00a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Clean API Service Layer in React with TypeScript]]></title>
            <link>https://shadisbaih.medium.com/building-a-clean-api-service-layer-in-react-with-typescript-baa8c30b5788?source=rss-8298a24a0985------2</link>
            <guid isPermaLink="false">https://medium.com/p/baa8c30b5788</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Shadi Sbaih]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 12:01:24 GMT</pubDate>
            <atom:updated>2026-07-22T12:01:24.475Z</atom:updated>
            <content:encoded><![CDATA[<p>When developers move from Angular to React, one of the first things they miss is Angular’s service architecture. Angular encourages separating business logic from UI by placing all HTTP requests inside injectable services. While React does not enforce a specific architecture, it is entirely possible and highly recommended to build a similar API layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4INr7NHwQMcxXZYmC3COA.png" /></figure><h3>Why Create an API Service Layer?</h3><p>A common mistake in React applications is making HTTP requests directly inside components.</p><pre>useEffect(() =&gt; {<br>  axios.get(&quot;/users&quot;).then((res) =&gt; {<br>    setUsers(res.data);<br>  });<br>}, []);</pre><p>Although this works, it creates several problems:</p><ul><li>Components become responsible for networking.</li><li>API endpoints are duplicated throughout the project.</li><li>Changing authentication or request headers becomes difficult.</li><li>Testing is harder because components are tightly coupled to HTTP requests.</li></ul><p>Instead, a dedicated API layer keeps all communication with the backend in one place.</p><h3>Project Structure</h3><p>A scalable React application can organize its API layer like this:</p><pre>src/<br>├── api/<br>│   ├── client.ts<br>│   ├── admin.api.ts<br>│   ├── auth.api.ts<br>│   └── product.api.ts<br>├── hooks/<br>│   ├── useUsers.ts<br>│   └── useProducts.ts<br>├── types/<br>│   ├── user.ts<br>│   └── common.ts<br>└── pages/</pre><p>Each file has a single responsibility.</p><ul><li>client.ts configures Axios.</li><li>admin.api.ts contains user-related endpoints.</li><li>types/ stores TypeScript interfaces.</li><li>hooks/ integrates the API with React Query.</li></ul><h3>Creating a Shared HTTP Client</h3><p>Instead of configuring Axios in every file, create one reusable instance.</p><pre>export const api = axios.create({<br>    baseURL: import.meta.env.VITE_API_URL,<br>    withCredentials: true,<br>});</pre><p>This allows every service to share:</p><ul><li>Base URL</li><li>Authentication headers</li><li>Request interceptors</li><li>Response interceptors</li><li>Error handling</li></ul><p>If authentication changes in the future, only one file needs to be updated.</p><h3>Building an API Service</h3><p>Each domain has its own service.</p><pre>export const AdminApi = {<br>    getUsers() {<br>        return api.get(&quot;/users&quot;);<br>    },<br>    getUser(id: number) {<br>        return api.get(`/users/${id}`);<br>    },<br>    createUser(data: UserCreateRequest) {<br>        return api.post(&quot;/users&quot;, data);<br>    },<br>    updateUser(id: number, data: UserUpdateRequest) {<br>        return api.put(`/users/${id}`, data);<br>    }<br>};</pre><p>Now the application has a single source of truth for user-related requests.</p><h3>Consuming the Service</h3><p>Instead of writing Axios code inside components, the component simply calls the service.</p><pre>const response = await AdminApi.getUsers();</pre><p>The component no longer knows anything about endpoints or HTTP methods. It only requests data.</p><p>This makes components smaller, cleaner, and easier to maintain.</p><h3>Integrating with React Query</h3><p>The service layer works especially well with React Query.</p><pre>export function useUsers() {<br>    return useQuery({<br>        queryKey: [&quot;users&quot;],<br>        queryFn: async () =&gt; {<br>            const { data } = await AdminApi.getUsers();<br>            return data;<br>        }<br>    });<br>}</pre><p>Components become extremely simple.</p><pre>const { data, isLoading } = useUsers();</pre><p>Notice that the component never imports Axios directly.</p><h3>Advantages</h3><p>Using a dedicated API service layer provides several benefits:</p><ul><li>Separation of concerns.</li><li>Better code organization.</li><li>Easier testing.</li><li>Reusable API logic.</li><li>Centralized authentication.</li><li>Improved maintainability.</li><li>Better scalability for large applications.</li></ul><p>It also makes onboarding new developers much easier because every endpoint has a predictable location.</p><h3>Angular vs. React</h3><p>Angular provides dependency injection and services out of the box.</p><pre>@Injectable()<br>export class AdminApiService {}</pre><p>React does not include this architecture by default, but developers can achieve nearly the same result using modules or service classes.</p><pre>export const AdminApi = { ... }</pre><p><strong>or</strong></p><pre>export class AdminApiService {}<br>export const adminApi = new AdminApiService();</pre><p>Both approaches separate business logic from presentation, resulting in cleaner and more maintainable applications.</p><h3>Conclusion</h3><p>Although React is an unopinionated library, adopting an Angular-style service architecture can significantly improve project structure. By centralizing HTTP requests into dedicated API services, combining them with TypeScript for type safety, and integrating React Query for data fetching and caching, developers can build applications that are easier to maintain, scale, and test. This architecture is widely used in professional React codebases because it promotes clean code, consistency, and long-term maintainability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baa8c30b5788" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>