<?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: Ahammed Nibras</title>
    <description>The latest articles on DEV Community by Ahammed Nibras (@ahammednibras8).</description>
    <link>https://dev.to/ahammednibras8</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%2F3281956%2F053b7bd2-9a41-44f9-badf-0342e199009e.jpg</url>
      <title>DEV Community: Ahammed Nibras</title>
      <link>https://dev.to/ahammednibras8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahammednibras8"/>
    <language>en</language>
    <item>
      <title>Supabase and the Illusion of “Easy Caching”: Why PostgreSQL Reads Can’t Be Automatic</title>
      <dc:creator>Ahammed Nibras</dc:creator>
      <pubDate>Sun, 30 Nov 2025 12:54:37 +0000</pubDate>
      <link>https://dev.to/ahammednibras8/supabase-and-the-illusion-of-easy-caching-why-postgresql-reads-cant-be-automatic-1ed2</link>
      <guid>https://dev.to/ahammednibras8/supabase-and-the-illusion-of-easy-caching-why-postgresql-reads-cant-be-automatic-1ed2</guid>
      <description>&lt;p&gt;When I started digging into how Supabase handles PostgreSQL reads, something kept showing up in the logs that didn’t feel quite right on the surface. Identical .select() queries firing over and over again — triggered by navigation, hydration, multiple tabs, React rerenders, router prefetching, and every other natural quirk of modern frontends.&lt;/p&gt;

&lt;p&gt;It’s the classic pattern every SPA and SSR app has lived with for years, but it raises a question:&lt;/p&gt;

&lt;p&gt;“If the data hasn’t changed, why doesn’t Supabase just cache the read?”&lt;/p&gt;

&lt;p&gt;This question usually appears after someone gets surprised by egress usage or sees a spike in rpc calls for read-heavy pages. And the temptation is to assume that Supabase could solve this with a toggle: “smart caching,” “automatic caching,” “cache identical queries,” etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Automatic caching breaks the moment you introduce RLS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PostgREST applies Row Level Security for every request.&lt;br&gt;
Even two requests that look identical in URL form:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/rest/v1/orders?user_id=eq.42&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;may produce different results depending on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JWT claims&lt;/li&gt;
&lt;li&gt;authenticated user&lt;/li&gt;
&lt;li&gt;active roles&lt;/li&gt;
&lt;li&gt;policy filters&lt;/li&gt;
&lt;li&gt;session context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is no “same query” in a multi-tenant, policy-protected system.&lt;/p&gt;

&lt;p&gt;Auto-caching at the platform layer risks returning the wrong user’s data — which is a correctness failure, not a performance regression.&lt;/p&gt;

&lt;p&gt;This alone eliminates the idea of transparent caching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. PostgreSQL is not a document store and doesn’t behave like one&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Firebase mental model (“data is a tree; cache the path”) simply does not translate to SQL.&lt;/p&gt;

&lt;p&gt;PostgreSQL views, joins, computed columns, and filtered selects all make it nearly impossible to determine cache keys automatically.&lt;/p&gt;

&lt;p&gt;Caching is an application concern, not a database-adapter concern.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Staleness budgets are product decisions, not platform decisions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some data models tolerate seconds of staleness.&lt;br&gt;
Some tolerate milliseconds.&lt;br&gt;
Some tolerate none.&lt;/p&gt;

&lt;p&gt;Supabase cannot infer which category your endpoint falls into.&lt;/p&gt;

&lt;p&gt;Caching PostgreSQL reads without explicit developer intent is reckless — the database layer cannot safely decide correctness on your behalf.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Modern frontends will generate redundant reads by design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This isn’t a Supabase problem.&lt;br&gt;
It’s a framework behavior.&lt;/p&gt;

&lt;p&gt;React hydration, prefetching, tab duplication, visible → hidden visibility events, and router-level transitions all produce legitimate-but-redundant queries.&lt;/p&gt;

&lt;p&gt;Every database adapter suffers from this.&lt;br&gt;
Supabase simply exposes the truth in the logs.&lt;/p&gt;

&lt;p&gt;Caching isn’t a fix for frontend behavior — deduplication and memoization in the application layer are.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Supabase does give you the right caching primitives, but intentionally avoids magic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Supabase offers caching, but all of it is opt-in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP caching via Cache-Control&lt;/li&gt;
&lt;li&gt;Next.js server component memoization&lt;/li&gt;
&lt;li&gt;React Query stale-while-revalidate patterns&lt;/li&gt;
&lt;li&gt;KV/Redis for explicit caching when needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is deliberate.&lt;br&gt;
Caching is safe only when the developer defines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the staleness window&lt;/li&gt;
&lt;li&gt;the cache key&lt;/li&gt;
&lt;li&gt;the invalidation strategy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anything automatic would violate correctness guarantees.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Point: Supabase Trades “Magic” for “Predictability”
&lt;/h2&gt;

&lt;p&gt;Supabase could add a toggle tomorrow:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Cache identical reads for N seconds.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But it would produce nondeterministic correctness issues the moment RLS, session context, or multi-tenant data enters the picture.&lt;/p&gt;

&lt;p&gt;Supabase chooses predictable behavior over premature optimization.&lt;/p&gt;

&lt;p&gt;That’s not a limitation — it’s the right engineering decision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What We should optimize instead&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re building on Supabase, the real wins come from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deduping reads at the &lt;strong&gt;framework level&lt;/strong&gt; (RSC memoization, React Query, SWR)&lt;/li&gt;
&lt;li&gt;controlling staleness budgets explicitly&lt;/li&gt;
&lt;li&gt;designing your data model with read patterns in mind&lt;/li&gt;
&lt;li&gt;understanding where user-specific filtering intersects with caching&lt;/li&gt;
&lt;li&gt;using CDN caching for public or shared data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Supabase handles the PostgREST layer correctly.&lt;br&gt;
It’s up to the application to avoid redundant reads caused by the frontend environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;Supabase’s job is to be correct — not clever.&lt;br&gt;
PostgreSQL + RLS + policy-based access means there is no such thing as “automatic caching” that wouldn’t eventually break someone’s app.&lt;/p&gt;

&lt;p&gt;Supabase gives you the primitives.&lt;br&gt;
You make the rules.&lt;br&gt;
That’s the right separation of responsibilities for any serious application.&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Your Backend Isn’t Broken — It’s Blind</title>
      <dc:creator>Ahammed Nibras</dc:creator>
      <pubDate>Sat, 21 Jun 2025 09:29:02 +0000</pubDate>
      <link>https://dev.to/ahammednibras8/your-backend-isnt-broken-its-blind-2lf3</link>
      <guid>https://dev.to/ahammednibras8/your-backend-isnt-broken-its-blind-2lf3</guid>
      <description>&lt;p&gt;Most backends don’t crash.&lt;/p&gt;

&lt;p&gt;They slowly degrade.&lt;br&gt;
Silently. Invisibly.&lt;br&gt;
Until a user churns, a feature fails, or an engineer is debugging logs from three layers deep.&lt;/p&gt;

&lt;p&gt;I’ve seen it over and over:&lt;br&gt;
    • Alerts come too late&lt;br&gt;
    • Dashboards miss the root cause&lt;br&gt;
    • Logs are full of noise&lt;br&gt;
    • Everyone’s guessing instead of fixing&lt;/p&gt;

&lt;p&gt;And here’s the hard truth:&lt;/p&gt;

&lt;p&gt;The issue isn’t your framework. It’s the fact that your system doesn’t observe itself.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  You Don’t Need More Code. You Need Command.
&lt;/h2&gt;

&lt;p&gt;We spend months writing code, shipping features, and scaling systems…&lt;br&gt;
But we forget to ask: What happens when this breaks in production?&lt;/p&gt;

&lt;p&gt;How will I know?&lt;br&gt;
Who gets notified?&lt;br&gt;
Will I get to the root cause — or just patch symptoms?&lt;/p&gt;

&lt;p&gt;For most teams, that answer is: “We’ll find out when it happens.”&lt;/p&gt;

&lt;p&gt;I was tired of backends acting like black boxes.&lt;br&gt;
So I built something that sees through the dark.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  I Built InfraMind — A Self-Healing Backend Brain for Spring Boot
&lt;/h2&gt;

&lt;p&gt;It’s not just a monitoring tool.&lt;br&gt;
It’s not just a dashboard.&lt;/p&gt;

&lt;p&gt;InfraMind is a backend brain:&lt;br&gt;
– Detects slow degradation before users do&lt;br&gt;
– Observes runtime behavior in real-time&lt;br&gt;
– Learns patterns from your services&lt;br&gt;
– Helps your system defend itself&lt;/p&gt;

&lt;p&gt;No more guessing.&lt;br&gt;
No more waiting for things to break to understand them.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  It’s Open Source Now.
&lt;/h2&gt;

&lt;p&gt;If you’re working with Spring Boot and building something serious —&lt;br&gt;
run it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ahammednibras8/InfraMind" rel="noopener noreferrer"&gt;Demo/Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your backend isn’t broken.&lt;br&gt;
It’s just blind.&lt;br&gt;
Let it see.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>java</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
