<?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: Abraham Moreno</title>
    <description>The latest articles on DEV Community by Abraham Moreno (@abmserrut).</description>
    <link>https://dev.to/abmserrut</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%2F4283739%2F375b0a35-8d39-4c20-997c-7c1c4671dc8a.jpg</url>
      <title>DEV Community: Abraham Moreno</title>
      <link>https://dev.to/abmserrut</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abmserrut"/>
    <language>en</language>
    <item>
      <title>How I Built an Open-Source Bilingual AI Social PWA with FastAPI, pgvector &amp; QLoRA Qwen</title>
      <dc:creator>Abraham Moreno</dc:creator>
      <pubDate>Sat, 05 Dec 2026 00:48:27 +0000</pubDate>
      <link>https://dev.to/abmserrut/how-i-built-an-open-source-bilingual-ai-social-pwa-with-fastapi-pgvector-qlora-qwen-fge</link>
      <guid>https://dev.to/abmserrut/how-i-built-an-open-source-bilingual-ai-social-pwa-with-fastapi-pgvector-qlora-qwen-fge</guid>
      <description>&lt;p&gt;Most social feeds optimize for outrage and endless scrolling. I wanted to build the opposite: a calm, bilingual (&lt;strong&gt;EN/ES&lt;/strong&gt;) space where people share pure thoughts, cross ideas semantically with other thinkers like neurons, and synthesize perspectives with AI—without addictive algorithms.&lt;/p&gt;

&lt;p&gt;That became &lt;strong&gt;Think it&lt;/strong&gt; (&lt;a href="https://thinkit-saas.vercel.app" rel="noopener noreferrer"&gt;Live App&lt;/a&gt; · &lt;a href="https://github.com/abmserrut/thinkit-saas" rel="noopener noreferrer"&gt;MIT GitHub Repo&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Rather than just shipping prompts in a wrapper, I focused on the &lt;strong&gt;system design, database isolation, and cloud/local AI parity&lt;/strong&gt; behind it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. 3-Layer Decoupled Architecture
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[React 19 + TypeScript + Tailwind v4 PWA (Vercel)]&lt;br&gt;
                    │  HTTPS + JWT + FormData&lt;br&gt;
                    ▼&lt;br&gt;
[Async FastAPI + SQLAlchemy (Render)]&lt;br&gt;
   ├── /api/auth         -&amp;gt; JWT, bcrypt, server-enforced is_demo blocks&lt;br&gt;
   ├── /api/thoughts     -&amp;gt; Feeds, private Daily Think, pgvector HNSW RAG&lt;br&gt;
   ├── /api/interactions -&amp;gt; Sparks, Bounces, Neurons, Follows&lt;br&gt;
   └── /api/messages     -&amp;gt; 1-on-1 DMs with privacy enforcement&lt;br&gt;
                    │&lt;br&gt;
      ┌─────────────┴─────────────┐&lt;br&gt;
      ▼                           ▼&lt;br&gt;
[Groq / QLoRA Qwen .gguf]   [Supabase PostgreSQL 16 + pgvector]&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;Hard-Won Production Lessons
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;
&lt;h3&gt;


Async SQLAlchemy + PgBouncer (&lt;code&gt;statement_cache_size=0&lt;/code&gt;)
&lt;/h3&gt;


&lt;p&gt;Deploying async FastAPI (&lt;code&gt;asyncpg&lt;/code&gt;) behind managed PostgreSQL transaction pooling (PgBouncer) immediately breaks prepared statements unless &lt;code&gt;statement_cache_size=0&lt;/code&gt; is explicitly configured in the async engine connect args. Catching and enforcing that early keeps pooled serverless connections stable under load.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dual Cloud / Local AI Parity (&lt;code&gt;THINKIT_AI_PROVIDER&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;During development, I fine-tuned &lt;strong&gt;Qwen 2.5 7B&lt;/strong&gt; via QLoRA (Unsloth) and quantized it to &lt;code&gt;q4_k_m.gguf&lt;/code&gt; running locally in &lt;strong&gt;Ollama&lt;/strong&gt; for 5 synthesis lenses (&lt;em&gt;Perspective Spark, Critical Contrast, Micro-Steps, Synthesis Quote, Open Question&lt;/em&gt;). For zero-GPU cloud production, a single environment switch routes the exact same lens prompts through &lt;strong&gt;Groq&lt;/strong&gt;—while semantic crossing uses &lt;code&gt;pgvector&lt;/code&gt; HNSW cosine similarity over 384d embeddings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server-Enforced Demo Isolation &amp;amp; Rate Limiting
&lt;/h3&gt;

&lt;p&gt;Interactive demo accounts (&lt;code&gt;is_demo&lt;/code&gt;) let visitors test the live app safely without polluting real users' DMs or mutating restricted account settings—all blocked server-side in FastAPI dependencies alongside sliding-window rate limiting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Packaging Reproducible Rules in &lt;code&gt;SKILL.md&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To avoid losing architectural context between iterations, I documented the deployment topology, pooler constraints, test gates (&lt;code&gt;pytest&lt;/code&gt;, &lt;code&gt;tsc --noEmit&lt;/code&gt;, &lt;code&gt;oxlint&lt;/code&gt;, &lt;code&gt;ruff&lt;/code&gt;), and launch policies in &lt;code&gt;.skills/thinkit-lifecycle/SKILL.md&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It &amp;amp; Inspect the Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Web &amp;amp; Installable PWA:&lt;/strong&gt; &lt;a href="https://thinkit-saas.vercel.app" rel="noopener noreferrer"&gt;thinkit-saas.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Source Code + 30s Demo Video:&lt;/strong&gt; &lt;a href="https://github.com/abmserrut/thinkit-saas" rel="noopener noreferrer"&gt;github.com/abmserrut/thinkit-saas&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/abraham-moreno-dev/" rel="noopener noreferrer"&gt;Abraham Moreno&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Would love feedback from fellow Python, FastAPI, and React engineers on the architecture trade-offs!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>python</category>
      <category>react</category>
    </item>
  </channel>
</rss>
