<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Riturathin Sharma</title>
    <description>The latest articles on DEV Community by Riturathin Sharma (@riturathin).</description>
    <link>https://dev.to/riturathin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F891545%2Fb3c7fd4b-8901-4a51-95d3-2b590ca5916d.jpeg</url>
      <title>DEV Community: Riturathin Sharma</title>
      <link>https://dev.to/riturathin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/riturathin"/>
    <language>en</language>
    <item>
      <title>A small architectural shift that made our product feel instant.</title>
      <dc:creator>Riturathin Sharma</dc:creator>
      <pubDate>Tue, 24 Feb 2026 07:26:51 +0000</pubDate>
      <link>https://dev.to/riturathin/a-small-architectural-shift-that-made-our-product-feel-instant-39ff</link>
      <guid>https://dev.to/riturathin/a-small-architectural-shift-that-made-our-product-feel-instant-39ff</guid>
      <description>&lt;p&gt;A few months ago, we had a critical problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slow dashboards&lt;/li&gt;
&lt;li&gt;Complaints about “laggy UI”&lt;/li&gt;
&lt;li&gt;Backend team saying APIs were fast&lt;/li&gt;
&lt;li&gt;Frontend team saying rendering was optimized&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everyone was right.&lt;br&gt;
But the product was still slow.&lt;/p&gt;

&lt;p&gt;The real issue wasn’t performance.&lt;/p&gt;

&lt;p&gt;It was &lt;strong&gt;architecture timing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We were recomputing personalization &lt;em&gt;on every user interaction&lt;/em&gt; instead of designing the system around &lt;strong&gt;perceived responsiveness&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So instead of optimizing components, we changed the mental model.&lt;/p&gt;
&lt;h3&gt;
  
  
  ❌ Old Thinking
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Action → API → Personalization → Compute → Render UI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Every interaction paid the full cost.&lt;/p&gt;


&lt;h3&gt;
  
  
  ✅ New Thinking
&lt;/h3&gt;

&lt;p&gt;Move intelligence earlier in the lifecycle.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Login
   ↓
Session Context Build
   ↓
Precomputed UI State
   ↓
Instant Interaction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We introduced &lt;strong&gt;session-scoped computation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A lightweight orchestration layer prepared UI data &lt;em&gt;before&lt;/em&gt; users needed it.&lt;/p&gt;




&lt;h3&gt;
  
  
  Example (simplified)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Before: compute on every request&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getDashboard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recommendations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;computeRecommendations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;renderDashboard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// After: compute once per session&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildSessionContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;recommendations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;computeRecommendations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`session:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getDashboard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sessionData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`session:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;renderDashboard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sessionData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Result was amazing
&lt;/h3&gt;

&lt;p&gt;• 42% faster perceived load time&lt;br&gt;
• API calls reduced significantly&lt;br&gt;
• Engineers stopped fighting across layers&lt;br&gt;
• Users described the app as “instant” — without major infra scaling&lt;/p&gt;

&lt;p&gt;No fancy framework.&lt;br&gt;
No rewrite.&lt;br&gt;
Just &lt;strong&gt;moving computation to the right moment&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  What this taught me
&lt;/h3&gt;

&lt;p&gt;Great engineering isn’t about writing more code.&lt;/p&gt;

&lt;p&gt;It’s about deciding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;When&lt;/strong&gt; computation should happen&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where&lt;/strong&gt; complexity should live&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What&lt;/strong&gt; the user should &lt;em&gt;feel&lt;/em&gt;, not just what the system does&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I enjoy solving problems exactly like this — where UX, systems thinking, and engineering intersect. I spend most of my time working on performance-driven UI architecture and developer platforms. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend Architecture&lt;/li&gt;
&lt;li&gt;Platform UI&lt;/li&gt;
&lt;li&gt;Performance &amp;amp; scalability&lt;/li&gt;
&lt;li&gt;AI-assisted developer experiences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conversations with teams tackling similar challenges are always interesting. Always happy to connect and discuss architecture, trade-offs, or product thinking.&lt;/p&gt;

</description>
      <category>frontendarchitecture</category>
      <category>systemdesign</category>
      <category>ui</category>
      <category>performance</category>
    </item>
    <item>
      <title>Supabase: Why Modern AI Applications Are Choosing Postgres Again</title>
      <dc:creator>Riturathin Sharma</dc:creator>
      <pubDate>Sat, 21 Feb 2026 08:00:57 +0000</pubDate>
      <link>https://dev.to/riturathin/supabase-why-modern-ai-applications-are-choosing-postgres-again-3fco</link>
      <guid>https://dev.to/riturathin/supabase-why-modern-ai-applications-are-choosing-postgres-again-3fco</guid>
      <description>&lt;h2&gt;
  
  
  Backend complexity is quietly becoming optional.
&lt;/h2&gt;

&lt;p&gt;For years, building a production application meant assembling a familiar stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A backend framework (Node/Express, Django, etc.)&lt;/li&gt;
&lt;li&gt;Authentication system&lt;/li&gt;
&lt;li&gt;Database APIs&lt;/li&gt;
&lt;li&gt;File storage&lt;/li&gt;
&lt;li&gt;Realtime infrastructure&lt;/li&gt;
&lt;li&gt;Permissions layer&lt;/li&gt;
&lt;li&gt;Deployment pipelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even before writing actual product logic, engineers spent weeks building infrastructure.&lt;/p&gt;

&lt;p&gt;Then tools like Supabase appeared — and something interesting happened.&lt;/p&gt;

&lt;p&gt;Developers started shipping full-stack applications without writing traditional backend code.&lt;/p&gt;

&lt;p&gt;This article explains what Supabase actually is, how it works technically, and why it’s becoming especially important in AI and RAG-based applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What Is Supabase?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Supabase is an open-source Backend-as-a-Service (BaaS) built around PostgreSQL.&lt;/p&gt;

&lt;p&gt;Instead of replacing databases with proprietary systems, Supabase does something different:&lt;/p&gt;

&lt;p&gt;It turns PostgreSQL into a complete backend platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supabase combines:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL database&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Auto-generated APIs&lt;/li&gt;
&lt;li&gt;Realtime subscriptions&lt;/li&gt;
&lt;li&gt;File storage&lt;/li&gt;
&lt;li&gt;Serverless edge functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All managed under a single platform.&lt;/p&gt;

&lt;p&gt;Think of it as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL + Backend Infrastructure = Supabase&lt;br&gt;
The Core Idea: Your Database Is the Backend&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Traditional architecture looks like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Frontend → Backend Server → Database&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Supabase simplifies it to:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Frontend → Supabase → PostgreSQL&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The backend layer doesn’t disappear — it becomes automated.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;
&lt;h2&gt;
  
  
  When you create a table in Supabase:
&lt;/h2&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;REST APIs are generated automatically&lt;/li&gt;
&lt;li&gt;Permissions are enforced via database policies &lt;/li&gt;
&lt;li&gt;Realtime listeners become available instantly&lt;/li&gt;
&lt;li&gt;Your database schema effectively defines your API.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Why PostgreSQL Matters&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Many backend platforms abstract databases away. Supabase does the opposite.&lt;/p&gt;

&lt;p&gt;You get full PostgreSQL capabilities:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;relational modeling&lt;/li&gt;
&lt;li&gt;joins and transactions&lt;/li&gt;
&lt;li&gt;indexing&lt;/li&gt;
&lt;li&gt;SQL queries&lt;/li&gt;
&lt;li&gt;extensions ecosystem&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is important because real applications eventually need relational data.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT users.name, projects.title
FROM users
JOIN projects ON users.id = projects.owner_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This kind of query becomes painful in NoSQL-first systems but natural in Postgres.&lt;/p&gt;

&lt;p&gt;Automatic APIs (Without Writing a Backend)&lt;/p&gt;

&lt;p&gt;Supabase exposes database tables as secure APIs automatically.&lt;/p&gt;

&lt;p&gt;Example (JavaScript client):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { data } = await supabase
  .from("projects")
  .select("*");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No server routes.&lt;br&gt;
No controllers.&lt;br&gt;
No ORM setup.&lt;/p&gt;

&lt;p&gt;The API layer is generated directly from your schema.&lt;/p&gt;

&lt;p&gt;Authentication Without Reinventing Login Systems&lt;/p&gt;

&lt;p&gt;Supabase Auth includes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Email/password login&lt;/li&gt;
&lt;li&gt;OAuth providers (Google, GitHub, etc.)&lt;/li&gt;
&lt;li&gt;Magic links&lt;/li&gt;
&lt;li&gt;JWT-based sessions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But the technically interesting part is how authorization works.&lt;/p&gt;

&lt;p&gt;Row Level Security (RLS): Security at the Database Layer&lt;/p&gt;

&lt;p&gt;Instead of enforcing permissions in backend code, Supabase uses PostgreSQL Row Level Security.&lt;/p&gt;

&lt;p&gt;Example policy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE POLICY "Users can see their own data"
ON projects
FOR SELECT
USING (auth.uid() = owner_id);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Even if APIs are accessed directly,the database itself enforces access rules.&lt;/li&gt;
&lt;li&gt;Security moves closer to the data — where it belongs.&lt;/li&gt;
&lt;li&gt;Realtime Systems Without WebSockets&lt;/li&gt;
&lt;li&gt;Supabase streams database changes in real time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  When data changes:
&lt;/h2&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;p&gt;Database update → Realtime event → UI update&lt;/p&gt;

&lt;p&gt;Use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;chat applications&lt;/li&gt;
&lt;li&gt;collaborative tools&lt;/li&gt;
&lt;li&gt;dashboards&lt;/li&gt;
&lt;li&gt;live notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No custom websocket infrastructure required.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Supabase Is Exploding in AI Development&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here’s where things get especially interesting.&lt;/p&gt;

&lt;p&gt;Modern AI applications need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;user data&lt;/li&gt;
&lt;li&gt;conversation history&lt;/li&gt;
&lt;li&gt;embeddings&lt;/li&gt;
&lt;li&gt;semantic search&lt;/li&gt;
&lt;li&gt;realtime responses&lt;/li&gt;
&lt;li&gt;secure execution environments
Supabase supports this stack surprisingly well.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Vector Storage with pgvector&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Postgres extension pgvector allows storing embeddings directly in the database.&lt;/p&gt;

&lt;p&gt;Text → Embedding → Stored in Postgres → Similarity search&lt;/p&gt;

&lt;p&gt;This enables Retrieval Augmented Generation (RAG) systems without separate vector databases.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Unified Data + AI Context&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;p&gt;App DB + Vector DB + Auth System + API Server&lt;/p&gt;

&lt;p&gt;You can use:&lt;/p&gt;

&lt;p&gt;Supabase (single platform)&lt;/p&gt;

&lt;p&gt;Relational data and embeddings live together.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Edge Functions for AI Workflows&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Edge functions allow secure execution of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LLM API calls&lt;/li&gt;
&lt;li&gt;document processing&lt;/li&gt;
&lt;li&gt;background jobs&lt;/li&gt;
&lt;li&gt;webhooks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This becomes the orchestration layer for AI pipelines.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Architectural Shift: Backend-Light Applications&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Supabase represents a broader shift:&lt;/p&gt;

&lt;p&gt;Engineers are moving from infrastructure engineering to product intelligence engineering.&lt;/p&gt;

&lt;p&gt;Instead of building systems around databases, we configure platforms on top of databases.&lt;/p&gt;

&lt;p&gt;The developer focus shifts toward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UX&lt;/li&gt;
&lt;li&gt;AI workflows&lt;/li&gt;
&lt;li&gt;data modeling&lt;/li&gt;
&lt;li&gt;system design&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Supabase vs Firebase (Quick Comparison)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feature Supabase    Firebase&lt;br&gt;
Database    PostgreSQL  NoSQL&lt;br&gt;
SQL Support ✅ ❌&lt;br&gt;
Open Source ✅ ❌&lt;br&gt;
Vendor Lock-in  Low High&lt;br&gt;
Relational Queries  Excellent   Limited&lt;br&gt;
When Supabase Is a Great Choice&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supabase works particularly well for:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✅ AI applications (RAG, copilots)&lt;br&gt;
✅ SaaS platforms&lt;br&gt;
✅ dashboards&lt;br&gt;
✅ collaborative tools&lt;br&gt;
✅ MVPs that need production scalability&lt;/p&gt;

&lt;p&gt;When You Might Not Use It&lt;/p&gt;

&lt;p&gt;You may prefer a custom backend if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you need highly complex backend business logic&lt;/li&gt;
&lt;li&gt;heavy background processing dominates the system&lt;/li&gt;
&lt;li&gt;strict on-prem enterprise constraints exist&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;Supabase isn’t just a productivity tool — it reflects a deeper architectural change.&lt;/p&gt;

&lt;p&gt;PostgreSQL is evolving from “database” to application platform.&lt;/p&gt;

&lt;p&gt;And as AI-driven products grow, platforms that reduce infrastructure complexity while keeping architectural flexibility will likely define the next generation of web development.&lt;/p&gt;

&lt;p&gt;The interesting question isn’t whether Supabase replaces backend engineering.&lt;/p&gt;

&lt;p&gt;It’s whether backend engineering itself is being redefined.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Evolution of Frontend Architecture</title>
      <dc:creator>Riturathin Sharma</dc:creator>
      <pubDate>Mon, 09 Feb 2026 18:08:41 +0000</pubDate>
      <link>https://dev.to/riturathin/evolution-of-frontend-architecture-1nk7</link>
      <guid>https://dev.to/riturathin/evolution-of-frontend-architecture-1nk7</guid>
      <description>&lt;p&gt;One pattern I’ve consistently seen across high-scale frontend systems is this:&lt;/p&gt;

&lt;p&gt;Most scaling problems are not React problems. They’re architecture problems.&lt;/p&gt;

&lt;p&gt;Framework choice matters far less than how you design boundaries, ownership, and evolution paths.&lt;/p&gt;

&lt;p&gt;In the past few years working on enterprise platforms and real-time systems, a few principles have proven far more impactful than any specific library:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Clear ownership boundaries &amp;gt; shared complexity&lt;/strong&gt;&lt;br&gt;
Micro-frontends, when done right, are less about technology and more about enabling independent evolution.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Performance is decided at architecture time, not optimization time&lt;/strong&gt;&lt;br&gt;
Rendering strategy, data flow, and component isolation matter far more than memoization tweaks later.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Design systems are scaling primitives, not UI libraries&lt;/strong&gt;&lt;br&gt;
They reduce cognitive load, align teams, and enable velocity at organizational scale.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Frontend architecture is platform engineering&lt;/strong&gt;&lt;br&gt;
The role evolves from building features → to building systems that make building features faster and safer.&lt;/p&gt;

&lt;p&gt;At scale, frontend engineering becomes less about components and more about systems design, constraints, and long-term maintainability.&lt;/p&gt;

&lt;p&gt;Curious how others have seen frontend architecture evolve as systems and teams scale.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>architecture</category>
      <category>platformengineering</category>
    </item>
    <item>
      <title>Rethinking State Management in React: A UI Architect’s Deep Dive Into “State Boundaries”</title>
      <dc:creator>Riturathin Sharma</dc:creator>
      <pubDate>Wed, 26 Nov 2025 08:24:58 +0000</pubDate>
      <link>https://dev.to/riturathin/rethinking-state-management-in-react-a-ui-architects-deep-dive-into-state-boundaries-7o4</link>
      <guid>https://dev.to/riturathin/rethinking-state-management-in-react-a-ui-architects-deep-dive-into-state-boundaries-7o4</guid>
      <description>&lt;p&gt;In the React ecosystem, we’ve spent years debating which state management library to use — Redux, MobX, Recoil, Zustand, Jotai, XState, and the ever-humble React Context.&lt;/p&gt;

&lt;p&gt;But the real architectural question we often forget is far more fundamental:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where should state live?&lt;/li&gt;
&lt;li&gt;How far should it travel?&lt;/li&gt;
&lt;li&gt;And how do we prevent state from becoming a silent source of UI slowdown?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's discuss in depth on an unglamorous yet powerful topic that every UI architect should obsess about:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;State Boundaries — The Most Important Concept in Scalable React Apps&lt;/em&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;State boundaries define how far a piece of state is allowed to influence the UI.&lt;/p&gt;

&lt;p&gt;If your components re-render “too much,” lag under load, or behave unpredictably, the root cause 90% of the time is:&lt;/p&gt;

&lt;p&gt;Your state boundaries are broken.&lt;/p&gt;

&lt;p&gt;Let’s understand this architecturally.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;1. Why State Boundaries Matter More Than the Library You Choose&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most engineers think state problems are library problems:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Redux is too verbose”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Context causes re-renders”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Zustand feels easier”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“useState is enough for everything”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“React Query replaces global state”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;…but performance issues rarely stem from the library. They stem from incorrect scoping.&lt;/p&gt;

&lt;p&gt;Poor state boundaries → excess re-renders → wasted CPU → janky UI.&lt;/p&gt;

&lt;p&gt;A simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ❌ Anti-pattern
&amp;lt;App&amp;gt;
  &amp;lt;Navbar user={user} /&amp;gt;
  &amp;lt;Sidebar user={user} /&amp;gt;
  &amp;lt;Dashboard user={user} /&amp;gt;
&amp;lt;/App&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ve just created a gigantic state boundary — one tiny state change in user will re-render half the application.&lt;/p&gt;

&lt;p&gt;Now imagine 200 components relying on the same global state.&lt;br&gt;
This is how “React feels slow” stories are born.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;2. The Architect’s Rule: “State Should Be as Local as Possible”&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;React is built on the idea of locality of state.&lt;/p&gt;

&lt;p&gt;A simple rule:&lt;/p&gt;

&lt;p&gt;Move state down until it stops mattering to everyone above it.&lt;br&gt;
Move shared state up only when two siblings need it.&lt;/p&gt;

&lt;p&gt;Micro Example:&lt;/p&gt;

&lt;p&gt;A toggle button controlling its own UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Toggle() {
  const [on, setOn] = useState(false);
  return &amp;lt;button onClick={() =&amp;gt; setOn(!on)}&amp;gt;{on ? "ON" : "OFF"}&amp;lt;/button&amp;gt;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perfectly local. No need for global state. No need for context. Zero re-renders outside the component.&lt;/p&gt;

&lt;p&gt;Macro Example:&lt;/p&gt;

&lt;p&gt;A user object needed by 15 components across the page.&lt;/p&gt;

&lt;p&gt;Context or Zustand makes sense here.&lt;/p&gt;

&lt;p&gt;But what if only two components need the user’s theme preference?&lt;br&gt;
Then create a smaller local boundary:&lt;/p&gt;

&lt;p&gt;User State (global)&lt;br&gt;
 ├── Theme Preference (local to UI shell)&lt;br&gt;
 └── User Metadata (local to specific feature)&lt;/p&gt;

&lt;p&gt;Architectures break when everything is global “just in case.”&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;3. The Hidden Performance Killer: “Derived State Leaks”&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A subtle but deadly anti-pattern:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const user = useUserStore(state =&amp;gt; state.user);&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const isAdmin = user.role === 'admin';  `// ❌ derived but inside` global boundary

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This component now re-renders whenever anything inside user changes — phone number, profile pic, status, anything.&lt;/p&gt;

&lt;p&gt;Fix: keep derived state as close to its usage as possible.&lt;/p&gt;

&lt;p&gt;const isAdmin = useUserStore(state =&amp;gt; state.user.role === 'admin'); // ✔ only re-renders when role changes&lt;/p&gt;

&lt;p&gt;You've just reduced re-renders by 90%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;4. State Machines: Creating Predictable Boundaries&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the cleanest ways to define strict state boundaries is using UI state machines (XState or custom).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Example: A checkout UI.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const checkoutMachine = {
  id: "checkout",
  initial: "cart",
  states: {
    cart: { on: { NEXT: "address" }},
    address: { on: { NEXT: "payment", BACK: "cart" }},
    payment: { on: { NEXT: "review", BACK: "address" }},
    review: { on: { SUBMIT: "complete", BACK: "payment" }},
    complete: {}
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, each boundary is a strict, predictable “mode.”&lt;/p&gt;

&lt;p&gt;Why is this beneficial?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;- UI cannot accidentally access out-of-scope state&lt;/em&gt;&lt;br&gt;
&lt;em&gt;- Reduces invalid transitions&lt;/em&gt;&lt;br&gt;
&lt;em&gt;- Less conditional UI logic (“if cart then… else if payment then…”)&lt;/em&gt;&lt;br&gt;
&lt;em&gt;- Fewer re-renders since each state is independent&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;5. How to Design State Boundaries in a Real Project (Architect’s Checklist)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✔ &lt;strong&gt;Step 1:&lt;/strong&gt; &lt;br&gt;
Identify State Types&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Local UI state (modals, text inputs)&lt;/li&gt;
&lt;li&gt;Server state (React Query / SWR)&lt;/li&gt;
&lt;li&gt;Global app state (theme, auth, settings)&lt;/li&gt;
&lt;li&gt;Ephemeral UI logic (hover, focus, scroll) &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;✔ Step 2: Assign State Ownership&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Local state → useState, useReducer&lt;/li&gt;
&lt;li&gt;Shared UI state → Context (carefully)&lt;/li&gt;
&lt;li&gt;Large-scale global logic → Zustand / Redux&lt;/li&gt;
&lt;li&gt;Data fetching → React Query&lt;/li&gt;
&lt;li&gt;Flow control → state machines&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;✔ Step 3: Prevent State Leakage&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Map state slices with selectors&lt;/li&gt;
&lt;li&gt;Avoid passing entire objects down props&lt;/li&gt;
&lt;li&gt;Memoize expensive selectors&lt;/li&gt;
&lt;li&gt;Use “compound component patterns” for local boundaries&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;✔ Step 4: Measure before optimizing&lt;/p&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React DevTools Profiler&lt;/li&gt;
&lt;li&gt;Flamegraph &lt;/li&gt;
&lt;li&gt;Why Did You Render (WDR) &lt;/li&gt;
&lt;li&gt;Browser performance panel&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a boundary causes 30+ rerenders, consider splitting it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Example: A Poorly Architected Component Tree
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;App&amp;gt;
  &amp;lt;UserProvider&amp;gt;          // global and huge
    &amp;lt;Layout&amp;gt;
      &amp;lt;Sidebar /&amp;gt;
      &amp;lt;Dashboard /&amp;gt;
      &amp;lt;Notifications /&amp;gt;
      &amp;lt;Search /&amp;gt;
      &amp;lt;Profile /&amp;gt;
    &amp;lt;/Layout&amp;gt;
  &amp;lt;/UserProvider&amp;gt;
&amp;lt;/App&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If user changes → everything re-renders.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Same App With Better State Boundaries
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;App&amp;gt;
  &amp;lt;AuthProvider&amp;gt; // only login/logout
    &amp;lt;Layout&amp;gt;
      &amp;lt;UserPreferencesProvider&amp;gt; // theme, language
        &amp;lt;Sidebar /&amp;gt;
        &amp;lt;Profile /&amp;gt;
      &amp;lt;/UserPreferencesProvider&amp;gt;

      &amp;lt;Dashboard /&amp;gt; // fetches its own data

      &amp;lt;NotificationProvider&amp;gt;
        &amp;lt;Notifications /&amp;gt;
      &amp;lt;/NotificationProvider&amp;gt;

      &amp;lt;Search /&amp;gt; // local debounced state
    &amp;lt;/Layout&amp;gt;
  &amp;lt;/AuthProvider&amp;gt;
&amp;lt;/App&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each provider now has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;isolated re-renders&lt;/li&gt;
&lt;li&gt;purpose-specific state&lt;/li&gt;
&lt;li&gt;predictable ownership&lt;/li&gt;
&lt;li&gt;This is real UI architecture.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;The Takeaway (And What Most Engineers Miss)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;React doesn’t get slow because:
“React is slow”
“Context is bad”
“Redux is heavy”

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;React gets slow because state boundaries are drawn carelessly.&lt;/p&gt;

&lt;p&gt;A UI Architect’s job isn’t to decide between Redux or Zustand.&lt;br&gt;
It is to decide where state should live and where it shouldn’t.&lt;/p&gt;

&lt;p&gt;When boundaries are clean:&lt;/p&gt;

&lt;p&gt;Features become independent&lt;/p&gt;

&lt;p&gt;Re-renders shrink&lt;/p&gt;

&lt;p&gt;Debugging becomes trivial&lt;/p&gt;

&lt;p&gt;Onboarding becomes easier&lt;/p&gt;

&lt;p&gt;Performance becomes natural—not an afterthought&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;In a world obsessed with new React libraries, one of the most traditional—and most overlooked—topics remains the true pillar of scalable UI architecture:&lt;/p&gt;

&lt;p&gt;State Boundaries decide whether your React app survives scale or collapses under it.&lt;/p&gt;

&lt;p&gt;If you master this, tools become replaceable.&lt;br&gt;
Architecture becomes future-proof.&lt;br&gt;
Teams become faster.&lt;/p&gt;

&lt;p&gt;And your React UI becomes predictable, fast, and delightful.&lt;/p&gt;

</description>
      <category>react</category>
      <category>statemanagement</category>
      <category>performance</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Rethinking Frontend Scalability: The “UI Composition Architecture” Pattern for Large React Applications</title>
      <dc:creator>Riturathin Sharma</dc:creator>
      <pubDate>Thu, 20 Nov 2025 11:13:56 +0000</pubDate>
      <link>https://dev.to/riturathin/rethinking-frontend-scalability-the-ui-composition-architecture-pattern-for-large-react-3mpn</link>
      <guid>https://dev.to/riturathin/rethinking-frontend-scalability-the-ui-composition-architecture-pattern-for-large-react-3mpn</guid>
      <description>&lt;p&gt;When your React application grows beyond a few feature modules, you begin to feel pain:&lt;br&gt;
    • Components become too tightly coupled&lt;br&gt;
    • Teams accidentally overwrite each other’s UI behavior&lt;br&gt;
    • Feature releases require risky regression cycles&lt;br&gt;
    • Reusable components… aren’t really reusable&lt;br&gt;
    • Code reviews turn into debates on folder structure&lt;/p&gt;

&lt;p&gt;As UI Architects, our job is to design UI systems that scale, not just UI screens.&lt;/p&gt;

&lt;p&gt;One of the most powerful architectural approaches I’ve used in large-scale frontend apps (50+ developers, multi-year lifespan) is the UI Composition Architecture.&lt;/p&gt;

&lt;p&gt;This post breaks down the pattern with concepts, diagrams, examples, and real-world React code you can try immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Problem Does UI Composition Solve?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Traditional React architecture looks like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;strong&gt;Pages → Feature Modules → Widgets → Components → UI Elements&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Works great… until:&lt;br&gt;
    • Two teams need to extend the same screen&lt;br&gt;
    • A feature needs to plug into multiple pages&lt;br&gt;
    • A global rule (e.g., dark theme, tracking, A/B test) must wrap UI without modifying every page&lt;br&gt;
    • You need to ship new UI without touching “core” code&lt;/p&gt;

&lt;p&gt;UI Composition flips the mental model.&lt;/p&gt;

&lt;p&gt;Instead of pages owning components, components own behaviors, and pages compose them.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Core Idea: Behavior is a Plugin, Not a Hardcoded Feature&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of a giant “God Page,” you have:&lt;/p&gt;

&lt;p&gt;Base Layout + Registrable UI Slots&lt;/p&gt;

&lt;p&gt;┌─────────────────────────────┐&lt;br&gt;
 │        Page Layout          │&lt;br&gt;
 │ ┌──────────┐  ┌──────────┐ │&lt;br&gt;
 │ │ Slot A   │  │ Slot B   │ │&lt;br&gt;
 │ └──────────┘  └──────────┘ │&lt;br&gt;
 │ ┌──────────┐               │&lt;br&gt;
 │ │ Slot C   │               │&lt;br&gt;
 │ └──────────┘               │&lt;br&gt;
 └─────────────────────────────┘&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ↓ Features register ↓
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Feature 1 → Slot A&lt;br&gt;
 Feature 2 → Slot B&lt;br&gt;
 Feature 3 → Slot C&lt;/p&gt;

&lt;p&gt;This makes UI extensible, testable, and team-friendly.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Real Example: Pluggable Dashboard Widgets in React&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider a dashboard where different teams own different widgets.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define a Slot Component&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// framework/Slot.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const Slot = ({ name, registry }) =&amp;gt; {
  const Component = registry[name];
  return Component ? &amp;lt;Component /&amp;gt; : null;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a Central Widget Registry&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// framework/registry.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const widgetRegistry = {};

 export const registerWidget = (name, component) =&amp;gt; {
   widgetRegistry[name] = component;
 };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;The Dashboard Layout Uses Slots&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// pages/Dashboard.jsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Slot } from "../framework/Slot";
 import { widgetRegistry } from "../framework/registry";

 export default function Dashboard() {
  return (
    &amp;lt;div className="dashboard"&amp;gt;
      &amp;lt;div className="left-panel"&amp;gt;
        &amp;lt;Slot name="weather" registry={widgetRegistry} /&amp;gt;
        &amp;lt;Slot name="news" registry={widgetRegistry} /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="right-panel"&amp;gt;
        &amp;lt;Slot name="profile" registry={widgetRegistry} /&amp;gt;
        &amp;lt;Slot name="trends" registry={widgetRegistry} /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;`&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Teams Independently Register New Widgets&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Team weather:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
import { registerWidget } from "../../framework/registry";&lt;/p&gt;

&lt;p&gt;const WeatherWidget = () =&amp;gt; (&lt;br&gt;
  &lt;/p&gt;☀️ Current Temperature: 28°C&lt;br&gt;
);

&lt;p&gt;registerWidget("weather", WeatherWidget);&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Team trends:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;// features/trends/index.js&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
import { registerWidget } from "../../framework/registry";&lt;/p&gt;

&lt;p&gt;const TrendsWidget = () =&amp;gt; (&lt;br&gt;
  &lt;/p&gt;📈 Trending Searches: React, AI&lt;br&gt;
);

&lt;p&gt;registerWidget("trends", TrendsWidget);&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Result?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Without modifying Dashboard.jsx, you can add:&lt;br&gt;
    • A new widget&lt;br&gt;
    • A new behavior&lt;br&gt;
    • A different version (A/B testing)&lt;br&gt;
    • User-based personalization&lt;/p&gt;

&lt;p&gt;This pattern scales incredibly well in real enterprise applications.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;Why This Pattern Works (Architectural Advantages)&lt;/p&gt;

&lt;p&gt;✔ Zero coupling&lt;/p&gt;

&lt;p&gt;Features plug into slots — no imports, no dependencies, no cross-team breaking changes.&lt;/p&gt;

&lt;p&gt;✔ Continuous Delivery&lt;/p&gt;

&lt;p&gt;Teams ship independently without touching layout code.&lt;/p&gt;

&lt;p&gt;✔ Powerful Customization&lt;/p&gt;

&lt;p&gt;Just register different components per tenant, role, or feature flag.&lt;/p&gt;

&lt;p&gt;✔ Perfect for Micro-Frontends&lt;/p&gt;

&lt;p&gt;Each widget can even be loaded as a federated module (Module Federation).&lt;/p&gt;

&lt;p&gt;✔ Enables “Dynamic UI”&lt;/p&gt;

&lt;p&gt;UI becomes a dynamic system, not a static tree.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optional: Slot with Props Injection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A more advanced slot allows the layout to pass context:&lt;/p&gt;

&lt;p&gt;export const Slot = ({ name, registry, props }) =&amp;gt; {&lt;br&gt;
  const Component = registry[name];&lt;br&gt;
  return Component ?  : null;&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;Now we can do:&lt;/p&gt;



&lt;p&gt;Widget:&lt;/p&gt;

&lt;p&gt;const WeatherWidget = ({ city }) =&amp;gt; (&lt;br&gt;
  &lt;/p&gt;Weather in {city}: 29°C&lt;br&gt;
);

&lt;p&gt;&lt;strong&gt;Real-World Use Cases You Can Implement&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Role-based UI&lt;br&gt;
• Admin sees 6 widgets&lt;br&gt;
• User sees 3&lt;br&gt;
• Guest sees only 1&lt;br&gt;
No branching logic on the page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Marketplace Extensibility&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Plugins from 3rd-party developers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Experimentation (A/B Testing)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Register the experiment version based on a flag.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Theming&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Slots can even swap different component trees for entire themes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multi-tenant SaaS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Different clients get different UI behavior.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As UI Architects, our goal is to build systems that:&lt;br&gt;
    • allow rapid iteration&lt;br&gt;
    • scale organizationally&lt;br&gt;
    • remain flexible for years&lt;br&gt;
    • empower teams to build without stepping on each other&lt;/p&gt;

&lt;p&gt;UI Composition Architecture is one of the most pragmatic and powerful ways to achieve that.&lt;/p&gt;

&lt;p&gt;If your app feels “rigid” or “hard to extend,” try introducing Slots + Registries into your architecture — your future self (and your developers) will thank you.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>architecture</category>
      <category>react</category>
      <category>ui</category>
    </item>
    <item>
      <title>Implementing custom functions in Arrays</title>
      <dc:creator>Riturathin Sharma</dc:creator>
      <pubDate>Tue, 10 Jan 2023 08:13:58 +0000</pubDate>
      <link>https://dev.to/riturathin/implementing-custom-functions-in-arrays-13ia</link>
      <guid>https://dev.to/riturathin/implementing-custom-functions-in-arrays-13ia</guid>
      <description>&lt;p&gt;There are quite a lot of handy functions in Javascript arrays that developers can easily use. Some of these are higher-order-functions like map, reduce and filter. Apart from these there are lot of other functions too like flatten, splice etc. We would be looking into re-creating some of the functions out of scratch.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Flatten&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Flatten method takes a depth as parameter and converts an array containing arrays into an array of plain primitives. &lt;/p&gt;

&lt;p&gt;e.g&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;let arr = [1,2,[3,4],5];&lt;br&gt;
        arr.flat(1); // outputs [1,2,3,4,5]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;We can pass any numeric value to flatten the Array data-structure to the level of depths. Let's try to mock this function and create our own custom implementation.&lt;/p&gt;

&lt;p&gt;First let's go ahead and create a function called &lt;strong&gt;&lt;em&gt;myFlatFn&lt;/em&gt;&lt;/strong&gt; that takes an array. Initially we will try to implement the function in such a way that it doen't take any flattening parameter. We will try to return the entire array flattened into a single array.&lt;/p&gt;

&lt;p&gt;For this, we need to think of a recursive approach. We will take a &lt;em&gt;for&lt;/em&gt; loop for looping through all the elements. We need to check if at any index, the value is an array or not. If it's an array, we will pass the array at that index into our custom &lt;em&gt;myFlatFn&lt;/em&gt;. We then return the array from the function.&lt;/p&gt;

&lt;p&gt;After this the callstack moves back to the original index + 1 and we continue to repeat the above steps till we have traversed the entire array. In the final step we return our result. &lt;em&gt;Code is written below&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array.prototype.myFlatFn = function() { 
   let res = [];
   if( depth === undefined ) {
      for( let i = 0 ; i &amp;lt; this.length; i++ ) {
         if( !Array.isArray(this[i]) ) res.push(this[i]);
         else{
            let flattened = this[i].myFlatFn();
            res = [...res, ...flattened ]
         }
      }
   }

return res
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, we have got the custom implementation for custom flat without a depth value. Now , let us try to implement the implementation when we have a &lt;strong&gt;&lt;em&gt;depth parameter&lt;/em&gt;&lt;/strong&gt; passed. &lt;/p&gt;

&lt;p&gt;What change do we need to make to our previous implementation here? If we observe closely, we can see that the depth value will flatten the array to a point where the depth of any index of the original array is  &amp;gt; 0 . Let's try to grab out heads around this.&lt;/p&gt;

&lt;p&gt;Suppose , we have an array&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;[1,2,[3,4,[5,[6, [7,8]]]]]&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 and we pass a depth of let's say 2. So , we continue to flatten our array till we have a flattened structure &amp;lt;= 2 . it means, if we check the ...[5,6,[7,8]]] value, it is at a depth of 4. So, we need to keep flattening it to depth &amp;lt;= 2. Max depth will be 2. We will still be left off with a depth of 4-2 = 2. Hence , we can't flatten the ...[5,6,[7,8]]] beyond ...[6,[7,8]]. Let's try to implement the code now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array.prototype.myFlatFn = function(depth) { 
    let res = [];
    if( depth ===undefined ) {
      for( let i = 0 ; i &amp;lt; this.length; i++ ) {
        if( !Array.isArray(this[i]) ) res.push(this[i]);
        else{
          let flattened = this[i].myFlatFn();
          res = [...res, ...flattened ]
        }
      }
    }else{
        for( let i = 0 ; i &amp;lt; this.length; i++ ) {
        if( !Array.isArray(this[i]) ) res.push(this[i]);
        else{
           if( depth &amp;gt; 0 &amp;amp;&amp;amp; depth ) { 
              let flattened = this[i].myFlatFn(depth-1);
              res = [...res, ...flattened ]
           }else{
              res.push(this[i])
           }
         }
      }
   }
   return res
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key here is the recursion which we need to handle based on whether the array element at index &lt;strong&gt;i&lt;/strong&gt; is an array or not.&lt;/p&gt;

&lt;p&gt;Let's finally refactor our code to give a more concise look.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array.prototype.myFlatFn = function(param) { 
   let res = [], arr = this ; 
   for( let i = 0 ; i &amp;lt; arr.length; i++ ) {
      if( param === undefined ) {
         if( !Array.isArray(arr[i]) ) res.push(arr[i])
         else{
            let flattened = arr[i].myFlatFn();
            res = [...res, ...flattened ]
         }
      }else if( param &amp;gt;= 0 &amp;amp;&amp;amp; param !== undefined) { 
         if( !Array.isArray(arr[i]) ) res.push(arr[i])
         else {
           let flattened = arr[i].myFlatFn(param-1);
           res = [...res, ...flattened ]
      }
    }
    else res.push(arr[i])
  }
  return res
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, we have successfully implemented our own flatten function. This can be extended to any array in Javascript&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Map&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Another useful utility function in Javascript is the map function. Along with reduce and filter, the map functions is a convenient way to perform some operation on each element of a given array. We are going to discuss each of these functions in details and try to replicate the same with our custom implementation.&lt;/p&gt;

&lt;p&gt;First of all what does map function do. Well, it takes a function and an array and returns a modified array with each element in the array converted based on the function provided. Let's see an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arr = [1,2,3,4,5] ;
arr.map( el =&amp;gt; el*el ) // Outputs the squares of each element .i.e. [ 1,4,9, 25]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is straightforward. It squares each element in the array. How can we achieve this?&lt;/p&gt;

&lt;p&gt;We need to initialize an array, let's just say &lt;strong&gt;&lt;em&gt;result&lt;/em&gt;&lt;/strong&gt; and then keep pushing each element from the original array to the result array after the operation. We will try to understand this with code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array.prototype.customMap = function( fn ) {
   let result = [];
   for( let i of this ) 
      result.push( fn(i) )
      return result;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, what have we done? We are just taking each element in the array, taking the transformer function(&lt;strong&gt;fn&lt;/strong&gt;) and applying it to each of them before pushing it to the result array. Finally , we are just returning the result. Thus we have completed our custom map function too. Let's move to the filter function.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Filter&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Just like map, filter also returns a modified array based on a condition being passed as a parameter and filters out all the elements that don't pass the specific condition. Let's see an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arr = [1,2,3,4,5,6,7] ;
arr.filter( el =&amp;gt; el &amp;gt; 3 ); // returns a new array 
[4,5,6,7] in this case
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
.&lt;/p&gt;

&lt;p&gt;So, how can we implement this. Simple. We need to have the same "&lt;strong&gt;result&lt;/strong&gt;" array and keep pushing any element that satisfies the passed condition before finally returning the result array. Let's see this with the help of code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array.prototype.customFilter = function(condition){
   let result = [];
   for( let i of this )
      if( condition(i) ) result.push(i)
   return result
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have now successfully implemented a custom filter function in Javascript. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
