<?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: Adam Blansett</title>
    <description>The latest articles on DEV Community by Adam Blansett (@adamblansett).</description>
    <link>https://dev.to/adamblansett</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4281554%2F42b3ea67-e10d-4e5b-96e5-2da7cc112879.png</url>
      <title>DEV Community: Adam Blansett</title>
      <link>https://dev.to/adamblansett</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adamblansett"/>
    <language>en</language>
    <item>
      <title>How to Tell If Your Dev Agency Wrote Bad Code (Before Paying for a Rewrite)</title>
      <dc:creator>Adam Blansett</dc:creator>
      <pubDate>Fri, 04 Dec 2026 01:14:15 +0000</pubDate>
      <link>https://dev.to/adamblansett/how-to-tell-if-your-dev-agency-wrote-bad-code-before-paying-for-a-rewrite-5e11</link>
      <guid>https://dev.to/adamblansett/how-to-tell-if-your-dev-agency-wrote-bad-code-before-paying-for-a-rewrite-5e11</guid>
      <description>&lt;p&gt;Seven objective repository and operational red flags that reveal whether a dev agency wrote brittle software—and how to verify what is salvageable before signing a rewrite contract.&lt;/p&gt;

&lt;p&gt;Few situations burn startup runway faster than paying an outside development agency tens of thousands of dollars—only to end up with an app that stalls on simple changes, breaks whenever users log in, and triggers a pitch for an expensive 'Phase 2 rewrite.'&lt;/p&gt;

&lt;p&gt;You do not need to be a senior systems architect to inspect whether your codebase was engineered for production or duct-taped together for weekly demo calls. Use these seven objective checks alongside our &lt;a href="https://adamblansett.com/tools/production-readiness-grader/" rel="noopener noreferrer"&gt;Production Readiness Grader&lt;/a&gt; before committing another dollar.&lt;/p&gt;

&lt;h2&gt;
  
  
  7 Objective Red Flags Inside an Agency Codebase
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;1. You don't own the GitHub organization or cloud accounts: If code lives on an agency's private server and you only see screen-shared builds, you lack operational control over your own IP.&lt;/li&gt;
&lt;li&gt;2. No automated tests or failing CI silenced on merge: Open GitHub Actions (or &lt;code&gt;.github/workflows/&lt;/code&gt;). If there are zero test suites—or CI skips linting/typechecking with &lt;code&gt;|| true&lt;/code&gt;—every deployment is unverified guesswork.&lt;/li&gt;
&lt;li&gt;3. &lt;code&gt;// @ts-ignore&lt;/code&gt;, &lt;code&gt;any&lt;/code&gt; everywhere, or disabled strict mode: Suppressing compiler safety hides mismatched frontend/backend API contracts until customers hit runtime crashes.&lt;/li&gt;
&lt;li&gt;4. Secrets or &lt;code&gt;.env&lt;/code&gt; files committed to Git history: Hardcoded API keys, database passwords, or &lt;code&gt;NODE_TLS_REJECT_UNAUTHORIZED=0&lt;/code&gt; flags signal dangerous security shortcuts.&lt;/li&gt;
&lt;li&gt;5. No database migrations—only manual SQL edits: If schema changes aren't tracked via Prisma, Alembic, Drizzle, or versioned SQL migrations, staging and production will drift out of sync permanently.&lt;/li&gt;
&lt;li&gt;6. Fixing one bug breaks two unrelated screens: Tight coupling and duplicated business logic across giant 1,500-line files make regression bugs inevitable.&lt;/li&gt;
&lt;li&gt;7. Zero error monitoring or structured logging: When a customer hits a 500 error and the team says 'we can't reproduce it on our laptop,' Sentry/observability was never wired properly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;ten-minute-sanity-check.sh&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Check whether automated tests &amp;amp; typecheck actually run cleanly&lt;/span&gt;
npm run typecheck &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;span class="c"&gt;# 2. Scan for release-readiness blockers &amp;amp; committed secrets&lt;/span&gt;
npx release-readiness-action
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fixing vs. Rewriting: Get Evidence Before Spending
&lt;/h2&gt;

&lt;p&gt;Even a messy codebase often hides years of real business logic and working UI flows that are far cheaper to rescue than rebuild from scratch. Read &lt;a href="https://adamblansett.com/vs/refactor-vs-rewrite/" rel="noopener noreferrer"&gt;Refactor vs. Rewrite&lt;/a&gt; and &lt;a href="https://adamblansett.com/vs/freelance-engineer-vs-dev-agency/" rel="noopener noreferrer"&gt;Senior Freelance Engineer vs. Software Dev Agency&lt;/a&gt; for a direct breakdown of when targeted rescue beats a new agency SOW.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; If your developer disappeared or an agency stalled, start on the App Rescue Triage page or book a fixed-scope $2,500 48-Hour Codebase Audit backed by a 100% actionability guarantee.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Get an Honest Second Opinion in 48 Hours
&lt;/h2&gt;

&lt;p&gt;Whether you are preparing to transition away from an agency or deciding how to stabilize an MVP before raising capital, visit &lt;a href="https://adamblansett.com/start/" rel="noopener noreferrer"&gt;/start/&lt;/a&gt;, explore &lt;a href="https://adamblansett.com/services/technical-consulting/" rel="noopener noreferrer"&gt;Technical Consulting &amp;amp; Advisory&lt;/a&gt;, or &lt;a href="https://adamblansett.com/book/" rel="noopener noreferrer"&gt;schedule a free 30-minute call&lt;/a&gt; for straight answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can a non-technical founder spot bad engineering without reading every file?
&lt;/h3&gt;

&lt;p&gt;Yes. Operational symptoms—missing automated CI checks, inability to spin up staging cleanly, every small bug fix breaking another screen, and refusal to grant direct GitHub admin access—are reliable indicators of structural technical debt.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why would an agency push for a ground-up rewrite instead of fixing what exists?
&lt;/h3&gt;

&lt;p&gt;Full rewrites reset expectations and lock in months of predictable retainer billing, whereas an honest audit often proves 70% of the product can be stabilized through targeted refactoring and automated tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does a 48-Hour Codebase Audit check?
&lt;/h3&gt;

&lt;p&gt;It inspects repository security, database queries and migrations, authentication boundaries, CI/CD reliability, error observability, and module coupling—delivering a prioritized risk matrix and concrete remediation patches.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://adamblansett.com/blog/how-to-tell-if-your-dev-agency-wrote-bad-code/" rel="noopener noreferrer"&gt;adamblansett.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>engineering</category>
      <category>saas</category>
      <category>programming</category>
    </item>
    <item>
      <title>Self-Hosting Qwen 3 &amp; Llama 4 vs. GPT-5 and Claude 4.5: Real Production Cost Math</title>
      <dc:creator>Adam Blansett</dc:creator>
      <pubDate>Fri, 04 Dec 2026 01:13:28 +0000</pubDate>
      <link>https://dev.to/adamblansett/self-hosting-qwen-3-llama-4-vs-gpt-5-and-claude-45-real-production-cost-math-38g3</link>
      <guid>https://dev.to/adamblansett/self-hosting-qwen-3-llama-4-vs-gpt-5-and-claude-45-real-production-cost-math-38g3</guid>
      <description>&lt;p&gt;Concrete 2026 cost comparison between Anthropic Claude Sonnet 4.5, OpenAI GPT-5, Gemini 2.5 Flash, and self-hosting Qwen 3 or Llama 4 on dedicated GPUs with Ollama and vLLM.&lt;/p&gt;

&lt;p&gt;Teams building production AI features keep running into the same architectural fork: keep paying per token to OpenAI, Anthropic, or Google—or rent dedicated GPUs to self-host open-weight models like Qwen 3 and Llama 4 inside a private VPC. The wrong guess either drains tens of thousands in unnecessary API spend or leaves expensive GPUs sitting idle.&lt;/p&gt;

&lt;p&gt;You can run your exact numbers live with the &lt;a href="https://adamblansett.com/tools/ai-cost-calculator/" rel="noopener noreferrer"&gt;AI Token &amp;amp; GPU Cost Estimator&lt;/a&gt; and &lt;a href="https://adamblansett.com/tools/llm-gpu-calculator/" rel="noopener noreferrer"&gt;LLM GPU &amp;amp; VRAM Sizing Calculator&lt;/a&gt;. Here is the real production math behind both options.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Baseline 2026 API Token Math (With Prompt Caching)
&lt;/h2&gt;

&lt;p&gt;Consider a standard enterprise RAG request: 1,200 input tokens, 350 output tokens, and a 30% prompt cache hit rate. At 10,000 requests per day (~305,000 requests/month), monthly token invoices diverge sharply by tier:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Sonnet 4.5 ($3.00 in / $15.00 out / $0.30 cached): roughly $2,400–$2,700/month—already above the lease cost of a 2x H100 80GB node (~$2,200/month).&lt;/li&gt;
&lt;li&gt;GPT-5 ($1.25 in / $10.00 out / $0.125 cached): roughly $1,400–$1,550/month.&lt;/li&gt;
&lt;li&gt;GPT-5 mini ($0.25 in / $2.00 out) or Gemini 2.5 Flash ($0.30 in / $2.50 out): roughly $280–$360/month.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice the immediate implication: if your application routes simple classification and extraction to mini/Flash models and uses 60–90% prompt caching on static instructions, cloud APIs stay remarkably cheap below 30,000 daily requests. Conversely, flagship-heavy agents cross GPU break-even much earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Hidden Variable in Self-Hosting: KV-Cache VRAM &amp;amp; Concurrency
&lt;/h2&gt;

&lt;p&gt;Many first-time self-hosting estimates only multiply parameter count by quantization bytes—forgetting KV-cache memory. A 32B 4-bit AWQ model weighs roughly 18 GB on disk, which sounds like it fits on a single 24 GB RTX 4090. Once 12 concurrent users send 16k-token RAG prompts, however, KV-cache allocations push total VRAM past 30 GB, forcing you onto a 48 GB L40S (~$680/month) or 80 GB GPU.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;model_router_policy.py&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;select_inference_target&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;contains_privileged_pii&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Hard boundary: privileged legal, PHI, or financial records stay inside private VPC&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;contains_privileged_pii&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"vllm://private-vpc/qwen3-32b-awq"&lt;/span&gt;
    &lt;span class="c1"&gt;# Route 80% of routine classification/extraction to low-cost distilled or flash tiers&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;task_type&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"classify"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"extract_json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"triage"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"vllm://private-vpc/qwen3-14b-awq"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"anthropic://claude-sonnet-4-5"&lt;/span&gt;  &lt;span class="c1"&gt;# Escalate sanitized complex synthesis only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Why Privacy &amp;amp; Compliance Beat Pure Token Math in Regulated Industries
&lt;/h2&gt;

&lt;p&gt;Even when a cloud mini model looks cheaper on paper, law firms, healthcare providers, and finance controllers often cannot send unredacted client records outside their VPC. In those cases, self-hosting Qwen 3 or Llama 4 paired with PostgreSQL &lt;code&gt;pgvector&lt;/code&gt; (compare storage costs in the &lt;a href="https://adamblansett.com/tools/rag-cost-calculator/" rel="noopener noreferrer"&gt;RAG &amp;amp; Vector DB Cost Calculator&lt;/a&gt;) delivers fixed monthly predictability and zero external data egress.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The highest-ROI enterprise pattern is a hybrid ModelRouter: sensitive or high-volume workloads run on self-hosted Ollama/vLLM GPUs, while sanitized complex edge cases escalate selectively to frontier cloud APIs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Explore Private AI Blueprints
&lt;/h2&gt;

&lt;p&gt;See full open-weight architectures in &lt;a href="https://adamblansett.com/vs/self-hosted-llm-vs-openai-api/" rel="noopener noreferrer"&gt;Self-Hosted LLMs vs. Cloud APIs&lt;/a&gt;, explore industry deployments on the &lt;a href="https://adamblansett.com/solutions/" rel="noopener noreferrer"&gt;Private AI Solutions Hub&lt;/a&gt;, or &lt;a href="https://adamblansett.com/book/" rel="noopener noreferrer"&gt;book an AI architecture session&lt;/a&gt; to design a cost-controlled pipeline for your team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  At what traffic volume does self-hosting beat cloud LLM APIs on cost?
&lt;/h3&gt;

&lt;p&gt;Against flagship models like Claude Sonnet 4.5 ($3/$15 per MTok), dedicated GPU clusters typically break even around 8,000–15,000 RAG requests per day. Against mini/Flash tiers ($0.25–$0.30 input), self-hosting wins earlier on privacy, compliance, or high-output workloads than raw per-token price alone.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does vLLM save money compared to Ollama in multi-user production?
&lt;/h3&gt;

&lt;p&gt;vLLM uses PagedAttention and continuous batching to process many concurrent requests simultaneously on one GPU, whereas Ollama queues concurrent streams more conservatively. Upgrading to vLLM often prevents needing extra GPUs.&lt;/p&gt;

&lt;h3&gt;
  
  
  How much VRAM does a 32B or 70B model need with concurrent users?
&lt;/h3&gt;

&lt;p&gt;A 32B 4-bit AWQ model needs ~18GB for weights plus KV-cache memory per concurrent stream—fitting comfortably on a single 48GB L40S GPU. A 70B 4-bit model needs ~40GB+ for weights and generally runs best across 1x–2x 80GB H100/A100 GPUs under concurrency.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://adamblansett.com/blog/self-hosting-qwen-llama-vs-gpt5-claude-production-cost/" rel="noopener noreferrer"&gt;adamblansett.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>5 Supabase RLS Mistakes in Lovable Apps That Leak Customer Data</title>
      <dc:creator>Adam Blansett</dc:creator>
      <pubDate>Fri, 04 Dec 2026 01:02:06 +0000</pubDate>
      <link>https://dev.to/adamblansett/5-supabase-rls-mistakes-in-lovable-apps-that-leak-customer-data-3lf8</link>
      <guid>https://dev.to/adamblansett/5-supabase-rls-mistakes-in-lovable-apps-that-leak-customer-data-3lf8</guid>
      <description>&lt;p&gt;The five most dangerous Supabase Row-Level Security (RLS) bugs generated in Lovable prototypes—from USING (true) policies to missing WITH CHECK clauses—and how to harden them.&lt;/p&gt;

&lt;p&gt;Lovable's Supabase integration makes building full-stack prototypes feel effortless—until you inspect the generated PostgreSQL policies under the hood. Because the browser talks directly to PostgREST using your public anon key, a single Row-Level Security (RLS) mistake can expose every customer record on the internet or silently break writes for paying users.&lt;/p&gt;

&lt;p&gt;When rescuing &lt;a href="https://adamblansett.com/fix-lovable-app/" rel="noopener noreferrer"&gt;Lovable applications for production&lt;/a&gt;, these are the five Supabase RLS mistakes I see most frequently—along with the exact SQL patterns required to fix them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Leaving Tables Created Without ENABLE ROW LEVEL SECURITY
&lt;/h2&gt;

&lt;p&gt;Whenever an AI prompt generates a new migration table in the public schema without explicitly enabling RLS, PostgreSQL leaves the table readable and writable via the public anon API key. Any visitor who inspects your network tab can read or mutate rows directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Silencing Errors With USING (true) Policies
&lt;/h2&gt;

&lt;p&gt;A classic debugging loop happens when an app throws a &lt;code&gt;403&lt;/code&gt; permission error during development and a follow-up prompt adds &lt;code&gt;CREATE POLICY "allow_all" ON items FOR ALL USING (true);&lt;/code&gt; to make the screen work. That fixes the demo immediately—and makes every customer's records visible to every other authenticated (or anonymous) user.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Writing SELECT Policies Without WITH CHECK on INSERT/UPDATE
&lt;/h2&gt;

&lt;p&gt;Even when &lt;code&gt;SELECT&lt;/code&gt; is locked down to &lt;code&gt;auth.uid() = user_id&lt;/code&gt;, forgetting &lt;code&gt;WITH CHECK&lt;/code&gt; on &lt;code&gt;INSERT&lt;/code&gt; and &lt;code&gt;UPDATE&lt;/code&gt; allows an attacker to write records stamped with someone else's &lt;code&gt;user_id&lt;/code&gt; or &lt;code&gt;organization_id&lt;/code&gt;, poisoning another tenant's workspace.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Trusting Client-Supplied organization_id Instead of Membership Subqueries
&lt;/h2&gt;

&lt;p&gt;B2B SaaS apps often check &lt;code&gt;organization_id = (auth.jwt() -&amp;gt;&amp;gt; 'org_id')::uuid&lt;/code&gt; or compare against a mutable profile field. Unless the policy checks a server-controlled membership table, users removed from a team or tampering with request payloads can still hit tenant rows.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;hardened_tenant_rls.sql&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="no"&gt;ENABLE&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="no"&gt;LEVEL&lt;/span&gt; &lt;span class="no"&gt;SECURITY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="no"&gt;FORCE&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="no"&gt;LEVEL&lt;/span&gt; &lt;span class="no"&gt;SECURITY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="no"&gt;POLICY&lt;/span&gt; &lt;span class="s2"&gt;"tenant_members_select"&lt;/span&gt;
  &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
  &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organization_memberships&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
      &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organization_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organization_id&lt;/span&gt;
        &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="no"&gt;POLICY&lt;/span&gt; &lt;span class="s2"&gt;"tenant_members_insert"&lt;/span&gt;
  &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt;
  &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
  &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organization_memberships&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
      &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organization_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;organization_id&lt;/span&gt;
        &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Exposing service_role Keys or Missing Indexes on Policy Columns
&lt;/h2&gt;

&lt;p&gt;Two operational traps show up right alongside broken policies: accidentally bundling &lt;code&gt;SUPABASE_SERVICE_ROLE_KEY&lt;/code&gt; into a &lt;code&gt;VITE_&lt;/code&gt; or &lt;code&gt;NEXT_PUBLIC_&lt;/code&gt; variable (which bypasses RLS completely), and omitting PostgreSQL indexes on &lt;code&gt;organization_id&lt;/code&gt; and &lt;code&gt;user_id&lt;/code&gt; inside &lt;code&gt;EXISTS&lt;/code&gt; subqueries, causing table scans as soon as rows grow past a few thousand records.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Always test RLS policies from an unauthenticated anon client AND two distinct authenticated tenant users in automated integration tests—never assume UI route guards protect your database.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Harden Your Lovable App Before Launch
&lt;/h2&gt;

&lt;p&gt;Run your current setup through the &lt;a href="https://adamblansett.com/tools/production-readiness-grader/" rel="noopener noreferrer"&gt;Production Readiness Grader&lt;/a&gt; or the &lt;a href="https://adamblansett.com/tools/app-rescue-estimator/" rel="noopener noreferrer"&gt;App Rescue Cost &amp;amp; Risk Estimator&lt;/a&gt;. If you want a thorough line-by-line RLS, auth, and deployment audit in 48 business hours, &lt;a href="https://adamblansett.com/book/" rel="noopener noreferrer"&gt;book an audit call&lt;/a&gt; or review my &lt;a href="https://adamblansett.com/services/full-stack-engineering/" rel="noopener noreferrer"&gt;Full-Stack Engineering Services&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why do Lovable apps pass testing and still fail Supabase RLS in production?
&lt;/h3&gt;

&lt;p&gt;During prototyping, builders test with a single demo account or with permissive policies created to silence permission errors. Under multi-user traffic, overly broad policies leak other tenants' rows while overly strict policies silently block legitimate inserts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is hiding UI routes in React enough if Supabase RLS is misconfigured?
&lt;/h3&gt;

&lt;p&gt;No. Because Supabase anon keys are intentionally public in browser bundles, any user can query your PostgREST endpoint directly using curl or browser DevTools. Row-Level Security inside PostgreSQL is your true enforcement boundary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can we fix Supabase RLS policies without taking our live app offline?
&lt;/h3&gt;

&lt;p&gt;Yes. By writing integration tests for every role against a staging branch first, you can apply tightened policies and indexes cleanly in a backward-compatible migration.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://adamblansett.com/blog/supabase-rls-mistakes-in-lovable-apps/" rel="noopener noreferrer"&gt;adamblansett.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>postgres</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How Much Does It Cost to Fix a Lovable, Cursor, or Bolt MVP? (2026 Breakdown)</title>
      <dc:creator>Adam Blansett</dc:creator>
      <pubDate>Fri, 04 Dec 2026 01:01:28 +0000</pubDate>
      <link>https://dev.to/adamblansett/how-much-does-it-cost-to-fix-a-lovable-cursor-or-bolt-mvp-2026-breakdown-470o</link>
      <guid>https://dev.to/adamblansett/how-much-does-it-cost-to-fix-a-lovable-cursor-or-bolt-mvp-2026-breakdown-470o</guid>
      <description>&lt;p&gt;Realistic engineering cost tiers for stabilizing an AI-built MVP from Lovable, Cursor, Bolt.new, or Replit—and how to avoid paying for an unnecessary full rewrite.&lt;/p&gt;

&lt;p&gt;AI app builders like Lovable, Cursor, Bolt.new, Replit, and Vercel v0 make it remarkably fast to put a clickable SaaS prototype in front of customers. The shock arrives a few weeks later when real users try to sign up, pay, or save records—and everything starts breaking in ways no follow-up prompt seems to fix.&lt;/p&gt;

&lt;p&gt;When founders ask how much it costs to rescue an AI-generated codebase, the honest answer depends on which layer is actually broken. Most projects do not need a six-figure agency rebuild; they need surgical stabilization across persistence, auth, integrations, and deployment hygiene. You can run a fast baseline check using our &lt;a href="https://adamblansett.com/tools/app-rescue-estimator/" rel="noopener noreferrer"&gt;App Rescue Cost &amp;amp; Risk Estimator&lt;/a&gt; or explore platform-specific guides on the &lt;a href="https://adamblansett.com/rescue/" rel="noopener noreferrer"&gt;App Rescue Hub&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Three Realistic Cost Tiers for Rescuing an AI-Built App
&lt;/h2&gt;

&lt;p&gt;Across real-world Next.js, React, Supabase, and Python builds, stabilization work falls into three predictable scope tiers depending on how much architectural drift accumulated during prompting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tier 1 — Quick Production Hardening ($2,500–$5,500 / 3–7 business days): Ideal when the UI and core flows work, but you need Supabase RLS fixed, exposed client secrets moved server-side, custom-domain CORS/auth repaired, and smoke tests wired into GitHub Actions.&lt;/li&gt;
&lt;li&gt;Tier 2 — Full Backend &amp;amp; Integration Stabilization ($6,000–$14,000 / 1.5–3 weeks): Needed when data fails to save reliably, Stripe webhooks miss subscription updates, N+1 queries stall pages under load, or duplicated prompt-generated modules must be consolidated behind strict TypeScript/Zod contracts.&lt;/li&gt;
&lt;li&gt;Tier 3 — Strangler-Fig Migration or Partial Rebuild ($15,000–$28,000 / 3–5 weeks): Required when a prototype lives inside Replit ephemeral storage or SQLite locks under concurrency and must be migrated cleanly to PostgreSQL, object storage, background queues, and Docker/cloud hosting.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Paying an Agency for a Full Rewrite Usually Wastes Runway
&lt;/h2&gt;

&lt;p&gt;Traditional dev agencies frequently recommend throwing away an AI-built repo and starting over from scratch. That proposal protects their margin with a $35,000–$75,000 multi-month contract—but it throws away months of product iteration, design decisions, and user feedback you already paid to discover.&lt;/p&gt;

&lt;p&gt;Unless the underlying stack is completely incompatible with your product, targeted refactoring keeps your working frontend and routes one broken boundary at a time into tested modules. For a full breakdown of that trade-off, read &lt;a href="https://adamblansett.com/vs/refactor-vs-rewrite/" rel="noopener noreferrer"&gt;Refactor vs. Rewrite&lt;/a&gt; and &lt;a href="https://adamblansett.com/vs/freelance-engineer-vs-dev-agency/" rel="noopener noreferrer"&gt;Senior Freelance Engineer vs. Software Dev Agency&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where AI-Built Codebases Actually Break in Production
&lt;/h2&gt;

&lt;p&gt;Even when an app passes every check inside a browser preview, five recurring structural gaps consistently cause outages with live customers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Silent database write failures caused by broken Supabase RLS policies, missing foreign keys, or optimistic UI updates that ignore HTTP errors.&lt;/li&gt;
&lt;li&gt;Client-side authorization checks that hide buttons in React while leaving the underlying API or database table wide open.&lt;/li&gt;
&lt;li&gt;Stripe checkout redirects trusted without idempotent HMAC webhook verification, leaving paid accounts stuck on free plans.&lt;/li&gt;
&lt;li&gt;Environment drift between WebContainers/localhost and custom production domains (cookies, CORS, OAuth callback URLs, connection pooling).&lt;/li&gt;
&lt;li&gt;Zero automated test coverage, causing every new feature prompt to silently break existing signup or billing paths.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;quick-repo-triage.sh&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run a zero-dependency static production check before spending on a sprint&lt;/span&gt;
npx ai-app-production-auditor .
&lt;span class="c"&gt;# Check for exposed NEXT_PUBLIC_/VITE_ secrets, localhost leaks, and missing build/test gates&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Before booking a large engineering retainer, start with a fixed-fee $2,500 48-Hour Codebase Audit (credited 100% toward follow-on stabilization). You get exact file-level findings, security fixes, and a firm sprint estimate in two business days.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Next Steps by Platform
&lt;/h2&gt;

&lt;p&gt;Inspect the failure checklist tailored to your builder—&lt;a href="https://adamblansett.com/fix-lovable-app/" rel="noopener noreferrer"&gt;Fix a Lovable App&lt;/a&gt;, &lt;a href="https://adamblansett.com/fix-cursor-app/" rel="noopener noreferrer"&gt;Fix a Cursor App&lt;/a&gt;, &lt;a href="https://adamblansett.com/fix-bolt-app/" rel="noopener noreferrer"&gt;Fix a Bolt.new App&lt;/a&gt;, &lt;a href="https://adamblansett.com/fix-replit-app/" rel="noopener noreferrer"&gt;Fix a Replit App&lt;/a&gt;, or &lt;a href="https://adamblansett.com/fix-v0-app/" rel="noopener noreferrer"&gt;Turn a v0 Prototype into Production&lt;/a&gt;—or &lt;a href="https://adamblansett.com/book/" rel="noopener noreferrer"&gt;book a free 30-minute triage call&lt;/a&gt; to review your repository directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do most AI-built apps require a complete rewrite?
&lt;/h3&gt;

&lt;p&gt;No. In most Lovable, Cursor, Bolt, and v0 projects, 60–80% of the React/Next.js UI components and product flows are worth keeping. The stabilization work focuses on the database schema, Row-Level Security, authentication boundaries, webhooks, and automated tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does a typical AI-built MVP rescue cost?
&lt;/h3&gt;

&lt;p&gt;Targeted hardening for a clean MVP usually runs $3,000–$6,000 (1–2 weeks), while complex multi-tenant SaaS rescues with Stripe billing, migrations, and CI suites typically land between $6,000–$14,000—a fraction of a $30,000–$60,000 agency rebuild.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can I get an exact price before committing to a sprint?
&lt;/h3&gt;

&lt;p&gt;Start with a fixed-scope $2,500 48-Hour Codebase Audit (credited in full toward follow-on fixes). In two business days you receive a prioritized 10-point risk matrix, remediation patches, and an exact sprint quote.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://adamblansett.com/blog/how-much-does-it-cost-to-fix-a-lovable-cursor-or-bolt-mvp/" rel="noopener noreferrer"&gt;adamblansett.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>saas</category>
      <category>startup</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
