<?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: mhk sameera</title>
    <description>The latest articles on DEV Community by mhk sameera (@mhk_sameera).</description>
    <link>https://dev.to/mhk_sameera</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%2F4115344%2F07df3b3f-746f-458f-b47f-42049e52bd1b.jpg</url>
      <title>DEV Community: mhk sameera</title>
      <link>https://dev.to/mhk_sameera</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mhk_sameera"/>
    <language>en</language>
    <item>
      <title>Building Ask Leya: Lessons Learned from Local ONNX Embeddings, Prisma Migrations, and Express Async Handlers</title>
      <dc:creator>mhk sameera</dc:creator>
      <pubDate>Tue, 08 Sep 2026 09:14:30 +0000</pubDate>
      <link>https://dev.to/mhk_sameera/building-ask-leya-lessons-learned-from-local-onnx-embeddings-prisma-migrations-and-express-async-29e4</link>
      <guid>https://dev.to/mhk_sameera/building-ask-leya-lessons-learned-from-local-onnx-embeddings-prisma-migrations-and-express-async-29e4</guid>
      <description>&lt;p&gt;Why build another chat widget? Because every widget I tried either followed a rigid script or confidently made things up. Ask Leya answers from a business's own content and hands off to a human when it can't.&lt;/p&gt;

&lt;p&gt;Here are three core architectural hurdles I ran into and how I solved them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cross-language retrieval is local, not the LLM
Retrieval uses paraphrase-multilingual-MiniLM-L12-v2 through ONNX, in-process — 384 dims, trained across 50+ languages. A business writes its knowledge base in English; an Arabic visitor asks in Arabic; the local model embeds that question into the same vector space as the English entries and finds the right one.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No translation step, no API call, no per-query embedding cost, and nothing leaves the server to be embedded. The chat model then only has to phrase the answer back in Arabic, which is the easy half.&lt;/p&gt;

&lt;p&gt;The trade: A cold start while the model loads, and it pulls in sharp, which cost me a 90-second production hang when a macOS binary got rsynced onto a Linux box.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Managing a database shared with unreleased modules&lt;br&gt;
The database is shared with the rest of my broader app under development — 67 tables total right now, many of which belong to unreleased modules. Since Prisma migrate tries to treat unreleased tables as drift, every migration currently requires hand-filtering additive statements via prisma migrate diff until the full suite ships.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Express 4 doesn't forward async rejections&lt;br&gt;
An unguarded async handler that throws gives you no response at all — the caller just hangs until it times out. That took /chat down for 90 seconds a request before I tracked it down.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Stack&lt;br&gt;
Frontend: Next.js App Router, React (with a dependency-free vanilla JS iframe widget so it can't collide with customer CSS).&lt;/p&gt;

&lt;p&gt;Backend: Node.js, Express.&lt;/p&gt;

&lt;p&gt;Database: Postgres (Neon) + pgvector.&lt;/p&gt;

&lt;p&gt;Real-time &amp;amp; AI: Socket.IO for live human handoff, gpt-4o-mini via OpenRouter for replies.&lt;/p&gt;

&lt;p&gt;Free tier, no credit card required. Features like WhatsApp, Instagram, and Messenger integrations are built out but kept behind the scenes until fully polished for self-serve.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fylsww6yafxhlfjekm7vo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fylsww6yafxhlfjekm7vo.png" alt=" " width="799" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>ai</category>
      <category>nextjs</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
