<?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 Pathik Gandhi on Medium]]></title>
        <description><![CDATA[Stories by Pathik Gandhi on Medium]]></description>
        <link>https://medium.com/@gr8pathik?source=rss-8b7c1f9190fb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mBxR3Nynv5DL0gGrcIe8yA.png</url>
            <title>Stories by Pathik Gandhi on Medium</title>
            <link>https://medium.com/@gr8pathik?source=rss-8b7c1f9190fb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 01:37:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gr8pathik/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[Introducing expo-pdf-text-extract: Native PDF Text Extraction for React Native & Expo]]></title>
            <link>https://medium.com/@gr8pathik/introducing-expo-pdf-text-extract-native-pdf-text-extraction-for-react-native-expo-b0a414993e44?source=rss-8b7c1f9190fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0a414993e44</guid>
            <category><![CDATA[pdf]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Pathik Gandhi]]></dc:creator>
            <pubDate>Wed, 14 Jan 2026 20:16:59 GMT</pubDate>
            <atom:updated>2026-01-14T20:16:59.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YpQiErPfMCkDbw0TSjdhAg.png" /></figure><p><strong>TL;DR:</strong> A free, open-source Expo module that extracts text from PDFs using native APIs (iOS PDFKit + Android PDFBox). Works with Expo SDK 49+, full TypeScript support, processes documents in milliseconds. Install with npx expo install expo-pdf-text-extract → <a href="https://www.npmjs.com/package/expo-pdf-text-extract">npm</a> | <a href="https://github.com/gr8pathik/expo-pdf-text-extract">GitHub</a></p><p>If you’ve ever tried to extract text from a PDF in a React Native or Expo app, you know the frustration. You search npm, find a dozen packages that <em>view</em> PDFs, a few that convert them to images, and maybe one or two that claim to extract text but haven’t been updated since 2019.</p><p>I ran into this exact problem while building a React Native app that needed to parse PDF documents. After wasting hours evaluating options, I decided to build the solution I wished existed.</p><p>Meet <a href="https://www.npmjs.com/package/expo-pdf-text-extract"><strong>expo-pdf-text-extract</strong></a> — a native Expo module that does exactly what the name says: extracts text from PDF files. Fast, simple, and open-source.</p><h3>The Problem: PDF Text Extraction Shouldn’t Be This Hard</h3><p>Here’s what the landscape looked like when I started:</p><p><strong>PDF Viewer Libraries</strong> — Great for displaying PDFs, useless for getting the text out. WebView-based solutions can’t expose the underlying content to your JavaScript code.</p><p><strong>JavaScript-Only Solutions</strong> — Libraries like pdf.js work, but they&#39;re slow. Parsing a multi-page document in JS means blocking your thread and watching your app stutter.</p><p><strong>Commercial SDKs</strong> — PSPDFKit, PDFTron, and others offer excellent functionality. They also cost hundreds or thousands per month. Overkill when you just need the text.</p><p><strong>OCR Libraries</strong> — If you’re extracting text from scanned documents (images), OCR makes sense. But most PDFs are <em>digital</em> — the text is already embedded. Running OCR on them is like taking a photo of your screen to copy text instead of pressing Ctrl+C.</p><p>What I needed was simple: call a function, pass a file path, get the text back. No subscriptions, no complexity, no performance penalties.</p><h3>How expo-pdf-text-extract Works</h3><p>Digital PDFs store text as structured data. When you open a PDF in any reader, it’s not rendering an image — it’s laying out actual text characters at specific coordinates. Both iOS and Android have built-in APIs to access this text layer.</p><p><strong>expo-pdf-text-extract</strong> leverages these platform-native APIs:</p><ul><li><strong>iOS</strong>: Apple’s PDFKit framework (built into iOS, no external dependencies)</li><li><strong>Android</strong>: Apache PDFBox library (the industry-standard open-source PDF library)</li></ul><p>The native code extracts text directly from the PDF’s internal structure. No image processing, no machine learning, no network calls. A 10-page document typically processes in under 100 milliseconds.</p><p>This approach gives you 100% accuracy for digital PDFs because you’re reading the exact characters the document contains — not guessing what they might be.</p><h3>Getting Started</h3><h3>Installation</h3><pre>npx expo install expo-pdf-text-extract</pre><blockquote><strong><em>Note</em></strong><em>: This package requires Expo SDK 49+ and a development build. It won’t work in Expo Go because it includes native code.</em></blockquote><p>If you haven’t created a development build before:</p><pre>npx expo prebuild<br>npx expo run:ios  # or run:android</pre><h3>Basic Usage</h3><pre>import { extractText, getPageCount, isAvailable } from &#39;expo-pdf-text-extract&#39;;</pre><pre>// Always check availability first<br>if (!isAvailable()) {<br>  console.log(&#39;PDF extraction not available on this platform&#39;);<br>  return;<br>}</pre><pre>// Extract all text from a PDF<br>const handlePdfExtraction = async (filePath: string) =&gt; {<br>  try {<br>    const text = await extractText(filePath);<br>    console.log(&#39;Extracted text:&#39;, text);<br>    <br>    const pages = await getPageCount(filePath);<br>    console.log(`Document has ${pages} pages`);<br>  } catch (error) {<br>    console.error(&#39;Extraction failed:&#39;, error);<br>  }<br>};</pre><h3>Extract Specific Pages</h3><p>Need text from just the first page or a specific range? No problem:</p><pre>import { extractTextFromPages } from &#39;expo-pdf-text-extract&#39;;</pre><pre>// Extract only pages 1-3 (1-indexed)<br>const partialText = await extractTextFromPages(filePath, 1, 3);</pre><h3>Supported Path Formats</h3><p>The package handles whatever path format you throw at it:</p><pre>// Absolute paths<br>await extractText(&#39;/var/mobile/.../document.pdf&#39;);</pre><pre>// file:// URIs (common from document pickers)<br>await extractText(&#39;file:///path/to/document.pdf&#39;);</pre><pre>// content:// URIs (Android content providers)<br>await extractText(&#39;content://com.android.providers/.../document.pdf&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u1CqRYLGHevMeQ-JWzQ09Q.png" /></figure><p><strong>Use expo-pdf-text-extract when:</strong></p><ul><li>Your PDFs are digitally created (invoices, policies, reports, receipts from most services)</li><li>You need fast, offline extraction</li><li>You want a simple, lightweight solution</li></ul><p><strong>Look elsewhere when:</strong></p><ul><li>Your PDFs are scanned images (you’ll need OCR)</li><li>You need to edit or annotate PDFs (consider a full-featured SDK)</li><li>You’re building for web only (pdf.js works well there)</li></ul><h3>What You Can Build With It</h3><p>This package opens up a lot of possibilities for React Native apps:</p><ul><li><strong>Expense tracking</strong> — Extract data from invoices and receipts</li><li><strong>Document management</strong> — Index and search PDF content locally</li><li><strong>Form processing</strong> — Pull structured data from standardized PDF forms</li><li><strong>Policy readers</strong> — Parse insurance or legal documents for key information</li><li><strong>Receipt scanners</strong> — Read digital receipts from email attachments</li></ul><p>I built this to solve my own problem — extracting and categorizing data from PDFs within my app. What used to be manual data entry now happens in milliseconds.</p><h3>Try It Out</h3><p>The package is fully open-source under the MIT license. You can:</p><ul><li><strong>Install from npm</strong>: npx expo install expo-pdf-text-extract</li><li><strong>View the source</strong>: <a href="https://github.com/gr8pathik/expo-pdf-text-extract">github.com/gr8pathik/expo-pdf-text-extract</a></li><li><strong>Read the docs</strong>: <a href="https://www.npmjs.com/package/expo-pdf-text-extract">npmjs.com/package/expo-pdf-text-extract</a></li></ul><p>If this solves a problem for you, I’d appreciate a ⭐ on GitHub. Found a bug or have a feature request? Open an issue — I’m actively maintaining this and genuinely want to hear what would make it more useful.</p><p>Sometimes the best tools are the simplest ones. Happy extracting!</p><p><em>Pathik Gandhi is a technology consultant and React Native developer. He builds things that solve problems he actually has, then shares them with the community. Find him on </em><a href="https://github.com/gr8pathik"><em>GitHub</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0a414993e44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Isn’t Coming — It’s Already Pair Programming with Me]]></title>
            <link>https://medium.com/technogise/ai-isnt-coming-it-s-already-pair-programming-with-me-05648fcb764e?source=rss-8b7c1f9190fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/05648fcb764e</guid>
            <category><![CDATA[github-copilot]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Pathik Gandhi]]></dc:creator>
            <pubDate>Mon, 25 Aug 2025 09:39:25 GMT</pubDate>
            <atom:updated>2026-05-14T05:45:04.411Z</atom:updated>
            <content:encoded><![CDATA[<h3>AI Isn’t Coming — It’s Already Pair Programming with Me</h3><p><em>A Technology Consultant’s Journey from Skeptical Observer to AI-Powered Developer</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZfnFWviT3_vF63DGD1epQ.png" /></figure><p>Six months ago, I would have rolled my eyes at this headline. As a Technology Consultant with 15+ years of experience leading frontend teams at Technogise, I’d seen enough overhyped tools come and go. GitHub Copilot sat quietly in my VS Code, occasionally suggesting a line completion that I’d accept with mild appreciation before moving on with my day.</p><p>Today, I’m writing entire features through conversation with an AI agent. And frankly, it’s changed not just how I code, but how I think about software development entirely.</p><h3>The Evolution Beyond Autocomplete</h3><p>Let’s be clear about where we are in 2025. AI in software development has moved far beyond the “smart autocomplete” phase. While most developers are still thinking of AI tools as glorified IntelliSense, GitHub Copilot’s Agent Mode represents something fundamentally different: <strong>conversational code generation</strong>.</p><p>This isn’t theoretical. This isn’t a demo. This is my daily reality working with React, React Native, TypeScript, and mono-repo architectures in production healthcare applications where HIPAA compliance isn’t optional and bugs have real consequences.</p><p>The shift happened when I realized I wasn’t just getting code suggestions — I was having architectural discussions with an AI that could implement its recommendations in real-time.</p><h3>My Aha Moment: Building a Schema-Driven Form Engine</h3><p>The feature request seemed straightforward enough: build a dynamic form rendering system using JSONForms that could handle complex healthcare data entry workflows. Cross-platform compatibility between web and React Native. Real-time validation. Accessibility compliance. The works.</p><p>In the old world, this would have meant:</p><ul><li>Days of architectural planning</li><li>Creating boilerplate components</li><li>Writing countless utility functions</li><li>Debugging cross-platform quirks</li><li>Iterating through multiple code reviews</li></ul><p>Instead, I opened Copilot’s Agent Mode and started what felt like a design review session with a very smart junior developer who happened to write code at the speed of thought.</p><p><strong>My prompt wasn’t “write a form component.”</strong></p><p>It was more like this:</p><pre>I need to build a schema-driven form engine for a healthcare app that works across web (React) and mobile (React Native with Expo). <br><br>Architecture requirements:<br>- JSONForms as the core schema processor<br>- Custom field renderers for healthcare-specific inputs (medication selectors, dosage calculators)<br>- Real-time validation with custom business rules<br>- Accessibility support (screen readers, keyboard navigation)<br>- Theme-aware styling that matches our design system<br><br>Technical constraints:<br>- TypeScript strict mode<br>- Must integrate with our existing Redux store<br>- Error boundaries for graceful failures<br>- Test coverage for all custom renderers<br><br>The schema structure should support nested objects, conditional fields based on previous selections, and dynamic field arrays for things like &quot;list all current medications.&quot;<br>Can you start with the core architecture and main form renderer component?</pre><p>What happened next changed everything.</p><p>Copilot didn’t just generate a component. It created a complete architectural solution: the main form renderer, custom field components, validation hooks, accessibility utilities, and even suggested a folder structure that made sense for our mono-repo setup.</p><p><strong>My role shifted from implementer to architect and reviewer.</strong> I was describing the business logic, explaining the constraints, and evaluating the AI’s architectural decisions. When something didn’t align with our patterns, I’d explain why, and it would adjust — learning our codebase conventions in real-time.</p><p>Within two days, we had a working, tested, production-ready feature that would have traditionally taken two weeks.</p><blockquote><strong>“The AI didn’t just write code — it helped me think through edge cases I hadn’t considered. It asked about error handling, suggested accessibility improvements, and even questioned some of my architectural decisions.”</strong><br> — My reflection after the first Agent Mode project</blockquote><h3>The Team Transformation</h3><p>Initially, my team used Copilot’s “Ask Mode” sporadically — mostly for quick syntax questions or debugging help. The conversation usually went:</p><p><strong>Developer:</strong> “How do I fix this TypeScript error?” <strong>Copilot:</strong> <em>Provides a solution</em> <strong>Developer:</strong> <em>Implements and moves on</em></p><p>After experiencing Agent Mode’s capabilities, I ran a 45-minute internal session demonstrating the difference between asking for help and collaborating on solutions.</p><p>The transformation was immediate. Within a week:</p><ul><li>Junior developers were tackling complex features with newfound confidence</li><li>Senior developers were using AI to explore architectural alternatives before committing to approaches</li><li>Code reviews became discussions about AI-generated patterns versus our established conventions</li><li>Our sprint velocity increased by roughly 30% without sacrificing quality</li></ul><p>Most importantly, <strong>we started discussing AI-generated code the same way we discuss human-authored code.</strong> No stigma, no “cheating” concerns — just honest evaluation of whether the solution was clean, maintainable, and correct.</p><blockquote><strong>“It’s like having a really smart intern who never gets tired and can implement any pattern I can describe clearly.”</strong><br> <em>— Senior Frontend Developer</em></blockquote><h3>Where Copilot Excels (And Where It Doesn’t)</h3><p>After months of intensive use across our React, React Native, and Node.js stack, I’ve identified clear patterns:</p><h3>Copilot Agent Mode Works Brilliantly When:</h3><p><strong>Your prompts are structured like design documents.</strong> The more context you provide about architecture, constraints, and business logic, the better the output. Think of it as onboarding a new team member who’s brilliant but knows nothing about your specific domain.</p><p><strong>The technology stack is well-established.</strong> Our React/TypeScript/Redux patterns are well-represented in Copilot’s training data. It understands modern hooks patterns, knows about performance optimizations, and can navigate complex state management scenarios.</p><p><strong>Tasks have clear scope and boundaries.</strong> “Build a medication dosage calculator with validation” works much better than “improve the user experience.” Specific requirements yield specific solutions.</p><p><strong>You need to explore multiple approaches quickly.</strong> I regularly ask Copilot to show me 2–3 different architectural approaches for the same problem, then choose the best fit for our context.</p><h3>Copilot Struggles When:</h3><p><strong>Prompts are vague or rushed.</strong> “Make this component better” produces generic improvements. “Optimize this component for performance while maintaining accessibility and adding loading states for async operations” produces targeted solutions.</p><p><strong>Working with large, tightly-coupled codebases.</strong> While Copilot can work within existing patterns, it can’t reason about complex inter-module dependencies across a 100+ component system.</p><p><strong>Business logic is implicit or undocumented.</strong> If you can’t explain the business rules clearly to a human, Copilot won’t infer them correctly either.</p><h3>Prompt Engineering: Teaching an AI to Think Like Your Team</h3><p>The most crucial skill I’ve developed isn’t coding — it’s <strong>prompt engineering</strong>. And I’ve realized that effective prompting resembles good technical leadership: clarity, context, and explicit expectations.</p><h3>Before: Generic Prompting</h3><pre>&quot;Create a user profile component&quot;</pre><p><strong>Result:</strong> Generic component with basic fields, no integration with our patterns, doesn’t match our design system.</p><h3>After: Contextual Prompting</h3><pre>&quot;Create a user profile component for our healthcare platform that:<br><br>- Follows our existing design system (MUI-based with custom theme)<br>- Integrates with our Redux user slice<br>- Handles avatar upload with image optimization<br>- Includes form validation using react-hook-form<br>- Supports both view and edit modes with smooth transitions<br>- Meets WCAG accessibility standards<br>- Includes loading states and error boundaries<br>- Uses our existing API service patterns<br><br>The component should fit into our existing user management flow and match the patterns used in our UserSettings and AccountManagement components.&quot;</pre><p><strong>Result:</strong> Production-ready component that integrates seamlessly with our existing codebase.</p><p>The difference isn’t just in the output quality — it’s in the <strong>time saved on revisions and integration work.</strong></p><h3>Technical Leadership in the AI Era</h3><p>This experience has fundamentally changed how I think about technical leadership. I now mentor both <strong>junior developers and AI agents</strong>, and the skills surprisingly overlap.</p><h3>New Responsibilities Include:</h3><p><strong>Reviewing AI-generated pull requests with the same rigor as human-authored code.</strong> Just because an AI wrote it doesn’t mean it’s automatically correct or optimal. Code review processes remain crucial.</p><p><strong>Shaping effective prompts across the team.</strong> I’ve started treating prompt patterns like coding standards — documenting what works, sharing effective templates, and helping team members improve their AI collaboration skills.</p><p><strong>Validating architectural decisions made by AI.</strong> Copilot can suggest patterns and approaches, but human judgment is essential for evaluating long-term maintainability, performance implications, and business alignment.</p><p><strong>Balancing AI assistance with developer growth.</strong> Junior developers still need to understand the fundamentals. AI should accelerate learning, not replace it.</p><h3>The Reality Check: AI as a Team Member</h3><p>Six months into this journey, Copilot has become the most productive member of my team. Not because it’s replacing human creativity or judgment, but because it’s <strong>amplifying human capabilities</strong>.</p><p>When I’m architecting a new feature, I’m no longer limited by implementation time. I can explore multiple approaches, prototype rapidly, and focus my mental energy on business logic and user experience rather than boilerplate code.</p><p>When my team encounters complex problems, we’re not just searching Stack Overflow or documentation. We’re having real-time conversations with an AI that understands our codebase patterns and can generate solutions tailored to our specific context.</p><blockquote><strong>“Our retrospectives have changed. Instead of discussing blockers and bottlenecks, we’re discussing which AI-generated patterns we want to adopt as team standards.”</strong><br> <em>— Scrum Master observation</em></blockquote><p><strong>The future isn’t AI replacing developers.</strong> The future is developers who embrace AI collaboration outpacing those who don’t.</p><h3>My Challenge to You</h3><p>If you’re reading this and thinking “this sounds too good to be true” or “this won’t work for my specific situation,” I have a simple challenge:</p><p><strong>Pick one feature from your current backlog. Spend an hour with GitHub Copilot’s Agent Mode.</strong> Don’t just ask for code — have a conversation about architecture. Explain your constraints, describe your business logic, and see what happens.</p><p>Then reflect on how you felt during that hour. Were you frustrated by the tool’s limitations, or excited by its possibilities? Did you feel like you were cheating, or like you’d found a powerful new way to work?</p><p>That reflection will tell you everything you need to know about whether AI-assisted development fits into your workflow.</p><h3>Conclusion: The Shift Is Already Here</h3><p>I’m not writing about the future of software development. I’m writing about its present. Today, right now, AI agents are capable of being genuine pair programming partners for developers who know how to collaborate with them effectively.</p><p>The question isn’t whether AI will change software development — it already has. The question is whether you’ll be part of that change or left behind by it.</p><p>For me, there’s no going back. When I sit down to build a new feature, my first instinct isn’t to open a blank file and start typing. It’s to open a conversation with my AI pair programming partner and start designing.</p><p>And honestly? We build better software together than I ever did alone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05648fcb764e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technogise/ai-isnt-coming-it-s-already-pair-programming-with-me-05648fcb764e">AI Isn’t Coming — It’s Already Pair Programming with Me</a> was originally published in <a href="https://medium.com/technogise">Technogise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rethinking Frontend Architecture: Decoupling UI from Domain Logic for Scalable Applications]]></title>
            <link>https://medium.com/technogise/rethinking-frontend-architecture-decoupling-ui-from-domain-logic-for-scalable-applications-d721eeb731ef?source=rss-8b7c1f9190fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d721eeb731ef</guid>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Pathik Gandhi]]></dc:creator>
            <pubDate>Wed, 25 Jun 2025 08:52:48 GMT</pubDate>
            <atom:updated>2025-09-03T08:14:25.603Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Clean Frontend Architecture" src="https://cdn-images-1.medium.com/max/1024/1*5blpHReXih7aEdCQ8t1fFQ.png" /><figcaption>Clean Frontend Architecture</figcaption></figure><p>In the rapidly evolving landscape of frontend development, we often find ourselves caught in a familiar cycle: rapid prototyping leads to tightly coupled code, which eventually becomes a maintenance nightmare. As applications grow in complexity and teams expand, the technical debt accumulated from mixing UI concerns with business logic becomes increasingly expensive to address.</p><p>Today, I want to share an architectural approach that has transformed how we build and maintain frontend applications — one that draws inspiration from domain-driven design and clean architecture principles to create a clear separation between UI components and domain logic.</p><h3>The Problem with Traditional Frontend Architecture</h3><p>Most frontend applications suffer from tight coupling between UI and business logic:</p><ul><li><strong>Difficult testing:</strong> Business logic embedded within UI components is hard to isolate and test.</li><li><strong>Tight coupling with backend models:</strong> API request/response models are often intertwined with UI code, making backend changes ripple through the frontend.</li><li><strong>Framework lock-in</strong> → Want to add a mobile app or change the framework from React to Angular? Rewrite everything</li><li><strong>Scattered dependencies:</strong> Changes in backend services or data sources require widespread code modifications.</li><li><strong>Slow adaptability:</strong> Enterprise applications face frequent UI changes driven by product evolution, increasing backlog, and technical debt.</li><li><strong>Rigid data sources and library integrations:</strong> Switching data sources (e.g., GCP to S3) or third-party libraries can be cumbersome.</li></ul><p>This creates maintenance nightmares and slows down development as teams grow.</p><figure><img alt="Problem with Traditional Frontend Application" src="https://cdn-images-1.medium.com/max/1024/1*h4M336B8lkowpdzR6SItzg.png" /><figcaption>Problem with Traditional Frontend Application</figcaption></figure><h3>Our Solution: Clean Architecture for Frontend</h3><blockquote>“UI framework dependencies should be kept separate from business logic”</blockquote><p><strong>Layer Breakdown:</strong></p><ul><li><strong>Domain Logic Layer:</strong> Encapsulates business rules, validation, and state management, independent of any UI framework.</li><li><strong>UI Layer:</strong> Composed of framework-agnostic components responsible solely for rendering and user interaction.</li><li><strong>Abstraction Layer:</strong> Acts as a mediator, exposing domain logic to the UI via well-defined interfaces or services.</li></ul><figure><img alt="Frontend Clean Architecture Diagram" src="https://cdn-images-1.medium.com/max/1024/1*e0cuh7K31Esb0tRmDsfpew.png" /><figcaption>Frontend Clean Architecture Diagram</figcaption></figure><h3>Implementation Details</h3><p>Workspace and Code Structuring</p><p>We organize the codebase using a <strong>monorepo</strong> with packages structured by business domains:</p><ul><li><strong>Models Package:</strong> Shared domain models are maintained separately, synchronized with backend APIs to reflect changes automatically.</li><li><strong>Domain Modules:</strong> Business logic libraries encapsulated per domain.</li><li><strong>UI Components:</strong> Common UI components shared across ReactJS and React Native apps.</li><li><strong>Third-party Integrations:</strong> Authentication, storage, and analytics are integrated as pluggable services without impacting domain logic.</li></ul><p>This pattern cleanly separates UI from domain logic, enabling independent evolution and testing.</p><figure><img alt="Domain-Driven Monorepo Structure" src="https://cdn-images-1.medium.com/max/1024/1*HOw8qolKwdCHSGOyhbdIUQ.png" /><figcaption>Domain-Driven Monorepo Structure</figcaption></figure><p>Code Examples</p><p>Before: Tightly Coupled Architecture</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br><br>const UserProfile = () =&gt; {<br>  // State management in UI component<br>  const [user, setUser] = useState(null);<br>  const [loading, setLoading] = useState(false);<br>  const [error, setError] = useState(null);<br><br>  // 🔴 Problem 1: API fetching in UI layer<br>  useEffect(() =&gt; {<br>    const fetchUser = async () =&gt; {<br>      setLoading(true);<br>      try {<br>        const response = await fetch(&#39;/api/user&#39;);<br>        const data = await response.json();<br>        <br>        // 🔴 Problem 2: Business logic in UI<br>        if (data.orders &amp;&amp; data.orders.length &gt; 0) {<br>          data.isPremium = data.orders.some(order =&gt; <br>            order.total &gt; 1000 &amp;&amp; order.status === &#39;completed&#39;<br>          );<br>        }<br>        <br>        setUser(data);<br>      } catch (err) {<br>        setError(err.message);<br>      } finally {<br>        setLoading(false);<br>      }<br>    };<br>    <br>    fetchUser();<br>  }, []);<br><br>  // 🔴 Problem 3: Presentation mixed with logic<br>  return (<br>    &lt;div&gt;<br>      {loading &amp;&amp; &lt;p&gt;Loading...&lt;/p&gt;}<br>      {error &amp;&amp; &lt;p&gt;Error: {error}&lt;/p&gt;}<br>      {user &amp;&amp; (<br>        &lt;div className={user.isPremium ? &#39;premium-badge&#39; : &#39;&#39;}&gt;<br>          &lt;h2&gt;{user.name}&lt;/h2&gt;<br>          &lt;p&gt;Email: {user.email}&lt;/p&gt;<br>          {/* More UI... */}<br>        &lt;/div&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>};</pre><p>After: Clean Architecture Implementation</p><pre>// -------------------------------<br>// SERVICE LAYER (api/userService.ts)<br>// -------------------------------<br>export class UserService {<br>  // ✅ Only data fetching concerns<br>  async fetchUser(): Promise&lt;UserResponse&gt; {<br>    const response = await fetch(&#39;/api/user&#39;);<br>    return response.json();<br>  }<br>}<br><br>// -------------------------------<br>// DOMAIN LAYER (domain/userDomain.ts)<br>// -------------------------------<br>export class UserDomain {<br>  constructor(private userService: UserService) {}<br><br>  // ✅ Pure business logic<br>  async getUser(): Promise&lt;User&gt; {<br>    const userData = await this.userService.fetchUser();<br>    <br>    // Business rules encapsulated<br>    return {<br>      ...userData,<br>      isPremium: this.checkPremiumStatus(userData)<br>    };<br>  }<br><br>  // ✅ Testable without UI/API<br>  private checkPremiumStatus(user: UserResponse): boolean {<br>    return user.orders?.some(order =&gt; <br>      order.total &gt; 1000 &amp;&amp; order.status === &#39;completed&#39;<br>    ) || false;<br>  }<br>}<br><br>// -------------------------------<br>// UI LAYER (components/UserProfile.tsx)<br>// -------------------------------<br>import React, { useState, useEffect } from &#39;react&#39;;<br>import { UserDomain } from &#39;domain/userDomain&#39;;<br>import { UserService } from &#39;services/userService&#39;;<br><br>const UserProfile = () =&gt; {<br>  const [user, setUser] = useState&lt;User | null&gt;(null);<br>  const [loading, setLoading] = useState(true);<br><br>  useEffect(() =&gt; {<br>    // ✅ Clean composition<br>    const userDomain = new UserDomain(new UserService());<br>    <br>    userDomain.getUser()<br>      .then(setUser)<br>      .finally(() =&gt; setLoading(false));<br>  }, []);<br><br>  // ✅ Only presentation concerns<br>  return (<br>    &lt;div&gt;<br>      {loading ? &lt;p&gt;Loading...&lt;/p&gt; : user &amp;&amp; (<br>        &lt;div className={user.isPremium ? &#39;premium-badge&#39; : &#39;&#39;}&gt;<br>          &lt;h2&gt;{user.name}&lt;/h2&gt;<br>          &lt;p&gt;Email: {user.email}&lt;/p&gt;<br>        &lt;/div&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>};</pre><h3>Key Benefits We’ve Seen</h3><ul><li><strong>Improved maintainability:</strong> Changes in UI or domain logic remain isolated, reducing regression risk.</li><li><strong>Enhanced testability:</strong> Business logic is independently testable without UI dependencies.</li><li><strong>UI framework flexibility:</strong> The UI layer can switch frameworks (e.g., React to React Native or Angular) without rewriting domain logic.</li><li><strong>Scalability:</strong> Modular design supports large enterprise applications with multiple teams.</li><li><strong>Metrics:<br>- </strong>40% reduction in UI-related bugs<br>- 70% faster onboarding for new developers</li></ul><h3>Lessons Learned</h3><p><strong>Start Simple</strong>: Don’t over-abstract initially. Extract patterns as they emerge.</p><p><strong>Performance Matters</strong>: The extra indirection can impact performance. Use memoization and code splitting strategically.</p><p><strong>Team Adoption</strong>: Developers need time to adapt. Provide clear examples and gradual migration paths.</p><h3>When to Use This Approach</h3><p>This architecture works best for:</p><ul><li>Applications with complex business logic</li><li>Teams planning multiple UI platforms (web + mobile)</li><li>Long-term projects where maintainability matters</li><li>Codebases with frequent UI changes</li></ul><p>For simple CRUD apps or prototypes, it might be overkill.</p><h3>Conclusion</h3><ul><li>Recap the philosophy: <em>“UI frameworks are delivery mechanisms, not architecture.”</em></li><li>Call-to-action: <em>“Try isolating one domain in your codebase — we bet you’ll never go back.”</em></li></ul><p>Separating UI from business logic isn’t just good practice — it’s essential for building maintainable frontend applications at scale. While it requires initial setup, the long-term benefits in testability, maintainability, and flexibility make it worthwhile.</p><p>The key is treating your frontend like the complex application it is, not just a thin UI layer.</p><p><strong>What’s your experience with frontend architecture patterns? Have you faced similar challenges?</strong> I’d love to hear your thoughts in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d721eeb731ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technogise/rethinking-frontend-architecture-decoupling-ui-from-domain-logic-for-scalable-applications-d721eeb731ef">Rethinking Frontend Architecture: Decoupling UI from Domain Logic for Scalable Applications</a> was originally published in <a href="https://medium.com/technogise">Technogise</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>