<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dawitsovm on Medium]]></title>
        <description><![CDATA[Stories by Dawitsovm on Medium]]></description>
        <link>https://medium.com/@dawitsovm?source=rss-a81047836dc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5v9wIfa44AOO2N6hnRCwgg.png</url>
            <title>Stories by Dawitsovm on Medium</title>
            <link>https://medium.com/@dawitsovm?source=rss-a81047836dc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:36:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dawitsovm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Day I Realized My AI Backend Was Doing Too Much]]></title>
            <link>https://medium.com/@dawitsovm/the-day-i-realized-my-ai-backend-was-doing-too-much-5a3044f5cdd4?source=rss-a81047836dc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a3044f5cdd4</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Dawitsovm]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 08:21:00 GMT</pubDate>
            <atom:updated>2026-07-08T08:21:00.806Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASehZP9SJ61yIVDFZt3OmA.png" /></figure><p>Most AI developers have the same instinct.</p><p>Need to index a repository? Do it on the backend. It’s the obvious place. Read the files there, chunk them there, embed them there, store the vectors there. The server is where the work happens that’s just how it’s done.</p><p>Mine did too.</p><p>Then I deployed TebibX to Render’s free tier. 512MB of RAM.</p><p>Everything changed.</p><h3>The Original Architecture</h3><p>Here’s what the first version looked like:</p><pre>Developer<br>   ↓<br>Submit repo URL<br>   ↓<br>Backend<br> ├─ Fetch repo via GitHub API<br> ├─ Chunk the files<br> ├─ Generate embeddings<br> ├─ Write vectors to Qdrant<br> └─ Answer questions</pre><p>Looks clean. Standard RAG playbook, honestly I don’t think I invented anything here. It’s the architecture every tutorial shows you.</p><p>It held up fine in testing. Then a real user pointed it at a real codebase about 400 files, 60,000 lines of Python and asked TebibX to index it.</p><h3>The Symptoms</h3><p>I wasn’t watching for a crash. I was watching the memory graph, mostly out of curiosity.</p><p>It climbed steadily through chunking. Climbed more during embedding. Somewhere around 490MB, the process just stopped responding — no graceful error, no queue, just silence, and then Render’s watchdog restarting the service like nothing happened.</p><p>I refreshed the dashboard a few times before I let myself admit what was going on. The AI wasn’t the problem. The prompts were fine, the retrieval logic was fine. The architecture was asking one small process to hold an entire codebase in memory while also serving live queries from other users. That was never going to end well it was just a matter of which repo would be the one to prove it.</p><h3>The Question</h3><p>The obvious next move is to scale up. Bigger instance, more RAM, problem solved. I actually considered it for about ten minutes.</p><p>Then I thought about what that money would actually be buying. Ingestion is bursty and per-user one developer adds one repo, once, and then it’s idle. Scaling vertically means paying for peak load that happens rarely, across every user, to cover a spike that isn’t even mine to smooth out. And it doesn’t fix anything structurally add a few more concurrent users and I’m back in the same place, just with a bigger bill.</p><p>So I asked myself a simpler question:</p><p><strong>Why is my backend doing work that the user’s machine is perfectly capable of doing?</strong></p><p>Ingestion is just reading files, splitting them into chunks, and generating embeddings in small batches. None of that actually requires a server. It requires <em>a</em> computer. The user already has one open, pointed at their own repo, doing nothing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*vdl9CAXyTQxQCjSw4GiYhA.png" /></figure><h3>The New Architecture</h3><pre>Browser<br>   ↓<br>Read repository<br>   ↓<br>Chunk files (Web Worker)<br>   ↓<br>Generate embeddings (small batches)<br>   ↓<br>Store vectors in IndexedDB<br>   ↓<br>Send only what&#39;s relevant<br>   ↓<br>Backend<br>   ↓<br>Hybrid search + LLM synthesis</pre><p>A Web Worker handles the chunking off the main thread, so the UI doesn’t freeze while a repo is being processed. Embeddings still go through the server but one chunk at a time, never the whole corpus at once, so the server’s memory footprint during ingestion stays flat no matter how big the repo is. The vectors themselves live in IndexedDB, in the user’s own browser.</p><p>When someone actually asks a question, the client pulls the relevant vectors and sends them into a six-stage pipeline: query embedding, Qdrant semantic search, SQLite lexical matching for exact identifiers, call graph traversal for structural context, then a Gemini Flash map phase and a Groq Llama reduce phase to synthesize the answer.</p><p>The server went from <em>holding</em> the codebase to just <em>answering questions about it</em>. It doesn’t prepare data anymore. It serves it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ql_macvAi40hrME4_iBa5A.png" /></figure><h3>Trade-offs</h3><p>This isn’t free, and I’m not going to pretend it is.</p><p><strong>What I gained:</strong></p><blockquote>Flat, predictable memory usage during ingestion</blockquote><blockquote>Lower hosting cost, since the server stopped being the bottleneck</blockquote><blockquote>A backend that scales horizontally, because every user’s ingestion is isolated in their own browser</blockquote><blockquote>A genuinely simpler mental model — the server does one job now</blockquote><p><strong>What it cost me:</strong></p><blockquote>Cross-device persistence got harder. Index a repo on your laptop, and it isn’t magically available on your desktop — the vectors live in that specific browser’s IndexedDB.</blockquote><blockquote>First-time ingestion depends on the client’s hardware and browser. Most machines handle it fine; some don’t.</blockquote><blockquote>IndexedDB has storage quotas that vary by browser. Fine for most repos, a real constraint for very large monorepos.</blockquote><blockquote>A refresh mid-ingestion can interrupt the job in a way that a server-side queue wouldn’t.</blockquote><p>No architecture is free. You’re not eliminating problems, you’re choosing which ones you’d rather have.</p><h3>What Surprised Me</h3><p>I went into this expecting a memory optimization. What I got was something closer to a design cleanup.</p><p>Moving ingestion off the server didn’t just fix the RAM problem it simplified almost everything downstream of it. Fewer moving pieces in the backend. Less to reason about when something breaks. Less infrastructure to pay for and maintain. The 512MB constraint didn’t just get worked around; it forced a cleaner separation between “things that need centralized infrastructure” (retrieval, synthesis, the LLM calls) and “things that don’t” (reading and chunking a repo that’s already sitting on the user’s disk).</p><p>Sometimes the best optimization isn’t making the existing work faster. It’s noticing that the work didn’t need to happen where you put it in the first place.</p><p>Everyone talks about scaling by adding servers. Fewer people talk about scaling by asking whether the server needed to be doing that thing at all.</p><p>That question is the one that actually changed TebibX’s architecture not a bigger instance, not a clever cache, just refusing to accept that “the backend does the indexing” was a law of nature instead of a default.</p><p>If you’re building an AI developer tool right now: would you keep indexing on the backend, or would you push it to the client? I’m genuinely curious where people land on the cross-device trade-off in particular it’s the one piece of this I haven’t fully solved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a3044f5cdd4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When your server has 512MB and your users have entire codebases]]></title>
            <link>https://medium.com/@dawitsovm/when-your-server-has-512mb-and-your-users-have-entire-codebases-877432a75a4d?source=rss-a81047836dc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/877432a75a4d</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Dawitsovm]]></dc:creator>
            <pubDate>Sun, 21 Jun 2026 07:18:16 GMT</pubDate>
            <atom:updated>2026-06-21T07:18:16.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*H1Rgv55r0TiJCnc9eEjh2A.png" /></figure><h3>The constraint nobody talks about</h3><p>When you’re a solo builder deploying on a budget, your server has limits. TEBIBX runs on a Render instance with 512MB of RAM. That’s not a complaint — it’s cheap, it’s fast to deploy, and for serving API responses it’s more than enough.</p><p>The problem showed up the moment users started indexing real repositories. A mid-size production codebase — say, 400 files, 60,000 lines of Python — doesn’t fit cleanly inside a 512MB process. Not when you’re chunking it, embedding it, and holding those vectors in memory during ingestion. The first time I watched the server spike to 490MB and then silently die, I understood the problem clearly: the original architecture was going to fight this constraint every single day.</p><h4>what I was originally building</h4><p>The first version of TEBIBX followed the standard RAG playbook:</p><ol><li>User submits a GitHub repository URL</li><li>Server clones or fetches the repo via GitHub API</li><li>FastAPI pipeline chunks the files, generates embeddings, writes vectors to Qdrant</li><li>User queries hit the retrieval pipeline — Qdrant for semantic search, SQLite for lexical matching, call graph traversal for structural context</li></ol><p>Simple. Clean. Completely wrong for a 512MB deployment. The issue isn’t query time — retrieval is fast and memory-stable. The issue is ingestion. Chunking and embedding a large codebase is a memory-hungry, time-consuming operation. Running it inside the same process that serves user queries means one large ingestion job can starve everything else</p><h3>Why the obvious fix was wrong</h3><p>The obvious answer is to scale up. Upgrade the instance, get more RAM, solve it with money. I considered it for about ten minutes. Then I thought about what that actually buys.</p><p>Ingestion is a per-user, per-repository operation. Every developer who uses TEBIBX has their own set of repos they care about. Scaling the server vertically means I’m paying for peak ingestion load across all users — which is unpredictable, bursty, and mostly idle. I’d be buying RAM to handle spikes that happen when someone first adds a repo, and that RAM sits unused 90% of the time.</p><p>Worse: vertical scaling doesn’t actually solve the architecture problem. It just delays it. Add enough concurrent users and you’re back to the same fight. The real question wasn’t “how do I give the server more memory?” It was: does ingestion need to happen on the server at all?</p><blockquote>The shift: make the client do the work</blockquote><blockquote>Ingestion and retrieval are separate operations. Retrieval needs the server — it needs the six-stage hybrid pipeline, the vector index, the LLM calls. But ingestion? Ingestion is just reading files, splitting them into chunks, and generating embeddings. Nothing about that requires a server. The browser can do it.</blockquote><blockquote>The solution I built moves the entire ingestion pipeline to the client:</blockquote><blockquote>A <strong>Web Worker</strong> handles chunking and processing off the main thread, so the UI stays responsive during ingestion</blockquote><blockquote>Embeddings are generated in small batches via lightweight API calls that don’t spike server memory — the server processes one chunk at a time and returns the vector, never holding the full corpus</blockquote><blockquote>The resulting vectors are stored in <strong>IndexedDB</strong> — the browser’s built-in structured storage, which can handle hundreds of megabytes without touching the server</blockquote><blockquote>When the user queries, the client reads vectors from IndexedDB and sends them to the server’s retrieval pipeline. The server sees a stateless request — it doesn’t know or care how the vectors were generated or where they’re stored. From the server’s perspective, memory usage during ingestion is now flat. It processes one chunk, returns one vector, forgets it. The 512MB limit became irrelevant for ingestion overnight.</blockquote><h3>How the retrieval pipeline works</h3><p>Queries go through six stages:</p><ol><li><strong>Query embedding</strong> — the user’s natural language question is embedded server-side</li><li><strong>Qdrant semantic search</strong> — vector similarity against the repository corpus</li><li><strong>SQLite lexical search</strong> — BM25 keyword matching for exact identifiers (function names, class names, file paths)</li><li><strong>Call graph traversal</strong> — structural context, tracing how functions call each other</li><li><strong>Map phase</strong> — Gemini Flash processes each retrieved chunk in parallel, extracting relevant context</li><li><strong>Reduce phase</strong> — Groq Llama synthesizes the mapped results into a coherent answer</li></ol><p>The hybrid retrieval (semantic + lexical + structural) means TEBIBX doesn’t miss results that are conceptually similar but syntactically exact — which matters enormously when a developer asks about a specific function they know by name.</p><h3>What I gave up</h3><p>This architecture has real tradeoffs and I’m not going to pretend otherwise.</p><ul><li><strong>Cross-device persistence is harder.</strong> A user who indexes a repo on their laptop doesn’t automatically have it available on their desktop. The vectors live in that browser’s IndexedDB, not on a central server. This is a meaningful UX cost for heavy users.</li><li><strong>First ingestion takes longer client-side.</strong> The browser is doing real work. On a large repo, that’s noticeable.</li><li><strong>Browser storage quotas are real.</strong> IndexedDB has limits that vary by browser and available disk space. For most codebases this is fine. For very large monorepos, it becomes a constraint.</li></ul><p>These are known tradeoffs, not surprises. And against them: the server stays stable regardless of how many users are indexing simultaneously. Costs stay predictable. The architecture scales horizontally because each user’s ingestion is fully isolated in their own browser.</p><h3>What I learned</h3><p>The 512MB limit felt like a problem. It turned out to be a forcing function. The standard playbook for RAG systems assumes you control the compute — that you can scale the server when you need to. When you can’t, you have to ask which parts of the pipeline actually need centralized infrastructure. For TEBIBX, the answer was: retrieval, synthesis, and the LLM calls. Not ingestion.</p><p>Pushing ingestion to the client made the architecture cleaner, not messier. The server does less. Each component has a clearer responsibility. The system is easier to reason about.</p><p>If I’d solved the problem with money — more RAM, bigger instance — I’d have a more expensive system with the same structural weakness. The constraint forced a better answer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=877432a75a4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>