<?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"><channel><title><![CDATA[kushal tech blogs]]></title><description><![CDATA[about the projects i am working and general tech]]></description><link>https://veyra-architecture.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Nov 2026 10:10:32 GMT</lastBuildDate><atom:link href="https://veyra-architecture.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building Drape: Combining Photo and Live AI Virtual Try-On]]></title><description><![CDATA[Inside Drape's FastAPI architecture, local FASHN VTON fallback, provider-aware photo pipeline, caching, and live Decart try-on.]]></description><link>https://veyra-architecture.hashnode.dev/building-drape-combining-photo-and-live-ai-virtual-try-on</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/building-drape-combining-photo-and-live-ai-virtual-try-on</guid><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Python]]></category><category><![CDATA[FastAPI]]></category><category><![CDATA[fashion tech]]></category><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:42:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/3a2d69f6-9106-45de-a962-3875d05c0784.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Virtual try-on sounds like a single AI problem: give a model a person and a garment, then generate the person wearing it. While building Drape, I found that a usable fashion-tech product is really a collection of different problems—image quality, garment fidelity, identity preservation, latency, GPU memory, API cost, privacy, and user feedback.</p>
<p>Drape is a virtual try-on application that lets a user see how a garment may look in two different ways: as a high-quality generated photo or as a continuously transformed live-camera experience.</p>
<p>The most interesting part is not only the AI model. It is the system around it. Drape coordinates image validation, asynchronous inference, provider selection, caching, hardware detection, secure API access, and a responsive browser interface in one local-first application.</p>
<p>At a high level, the system follows this architecture:</p>
<img src="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/15694339-c2e3-4599-8a9a-fb09f9b1a16b.png" alt="" style="display:block;margin:0 auto" />

<p>In parallel:</p>
<p>Webcam + Garment Reference ↓ Short-Lived Decart Token ↓ WebRTC Live Session ↓ Continuous Virtual Try-On</p>
<pre><code class="language-plaintext">
## Two Different Try-On Problems

A still photo and a live camera feed may look like versions of the same feature, but they create different engineering requirements.

Photo try-on can spend several seconds producing a polished result. It can validate both images, place the request in a queue, run an expensive inference job, cache the output, and let the user download the finished image.

Live try-on has a stricter latency budget. It must keep a video session active, transform frames continuously, and allow style changes without restarting the camera. Drape therefore treats the two experiences as separate inference paths instead of forcing one model and one API design to handle everything.

## FastAPI as the Coordination Layer

The backend is built with FastAPI and acts as the boundary between the browser, local model runtime, and external AI services.

It is responsible for:

- accepting person and garment uploads
- validating file size, format, and pixel count
- selecting a configured photo provider
- creating and tracking inference jobs
- serializing expensive local GPU work
- serving generated images
- reporting model, device, and provider status
- creating short-lived credentials for live sessions
- serving the static web application

This keeps provider credentials and inference details out of the frontend. The browser works with a stable set of Drape endpoints even when the selected AI provider changes.

## Input Validation Before Inference

AI image processing is expensive, so invalid input should be rejected before it reaches a model or consumes a paid API credit.

Drape limits each upload to 15 MB and rejects images above 30 million pixels. Pillow verifies the image data, applies EXIF orientation, and converts accepted JPG, PNG, or WebP files into a consistent RGB representation.

The interface also asks the user to identify the garment category as a top, bottom, or one-piece and to specify whether the source is a model photo or a flat-lay product image. These values give the selected provider more precise context and produce more predictable outputs.

## Provider Routing for Photo Try-On

The photo pipeline is deliberately provider-aware. An environment setting chooses the preferred route, while the backend checks whether the required credentials are actually available.

The current choices are:

- Genlook for a specialized hosted virtual try-on workflow
- OpenAI image editing for a two-reference, high-fidelity generation path
- local FASHN VTON v1.5 as the credential-free fallback

If the requested cloud provider is not configured, the application falls back to local inference instead of exposing a broken UI. This makes the same application useful for a polished demonstration, API experimentation, and offline development.

## Genlook Photo Pipeline

When a Genlook key is configured, Drape sends the person and garment as a multipart request to the virtual try-on API.

Before upload, the backend resizes images to satisfy the provider's resolution requirements while preserving aspect ratio. It also sends structured product context describing the garment category and whether the reference is flat-lay or worn by a model.

The service may complete synchronously or return a generation ID. In the asynchronous case, the backend polls until the result is ready, downloads the signed result URL immediately, and stores the image locally.

That download step matters because remote results have limited retention. Drape takes ownership of the completed output rather than depending on a temporary provider URL.

## OpenAI Two-Reference Editing

Drape also includes an OpenAI image-editing path. The person image is the first reference and the garment is the second.

The prompt is designed around two constraints: preserve the person and preserve the product. It asks the model to retain identity, pose, body shape, lighting, background, and framing while also retaining the garment's colour, print, material, logos, seams, sleeves, and hem.

The output dimensions are selected from the person's aspect ratio. Portrait, landscape, and square inputs therefore receive an appropriate generation size instead of being forced into one crop.

This route demonstrates an important fashion-tech lesson: visual quality is not only about generating plausible clothing. Product fidelity and identity preservation are equally important.

## Local FASHN VTON Fallback

Without a cloud key, Drape runs FASHN VTON v1.5 locally. The pretrained model performs maskless virtual try-on in pixel space and supports both model photos and flat-lay garment references.

The local pipeline uses supporting pose and human-parsing components, including DWPose, YOLOX, and a human parser. Model assets are loaded lazily so that the web application can start before the full inference pipeline is needed.

The default quality path uses a balanced 30-step schedule at a native 864 × 576 resolution. Device selection can be controlled through an environment variable, while the runtime detects CUDA availability and reports the active GPU or CPU to the interface.

Automatic low-VRAM behavior makes the application practical on hardware such as a 4 GB GTX 1650, with CPU available as a slower fallback.

## Job Queue and Concurrency Control

Photo inference is not executed directly inside the upload request. The backend creates a job with one of four states: queued, processing, complete, or failed.

A single-worker thread pool processes the expensive task. The frontend polls the job endpoint and updates the user-facing status until an image is available.

Serializing local inference is a sensible choice for a desktop-oriented application. Multiple simultaneous model runs can exhaust limited GPU memory and make every request slower. A one-worker queue trades throughput for stability and predictable resource use.

## Content-Based Caching

Every generated photo does not need to consume another API credit or repeat local inference.

Drape builds a SHA-256 cache key from the person image, garment image, category, photo type, provider, model settings, and prompt version. Identical inputs with identical generation settings resolve to the same cached output.

The cache has two useful effects:

- repeated demonstrations can return almost instantly
- paid provider credits are not spent on duplicate requests

The Genlook path also writes a small recovery record containing the completed remote result URL before the final local image is committed. If the application stops at the wrong moment, it can recover the already-generated result instead of paying for it again.

Images and metadata are saved atomically through temporary files and replacement. This reduces the chance that an interrupted write leaves a corrupt cache entry.

## Live Camera Try-On with Decart

The live path uses Decart Lucy VTON 3.6 over WebRTC. The webcam stream supplies the person, while a garment image acts as the visual reference for continuous transformation.

The permanent Decart API key remains on the backend. The browser requests a short-lived token scoped to the local origin and uses that token to establish the live session. This prevents the long-lived credential from being embedded in JavaScript or exposed through developer tools.

Once connected, the user can change the garment or styling instructions inside the active session without restarting the camera. This preserves the feeling of a live fitting room rather than turning every change into a new upload-and-wait cycle.

The interface also makes the cost boundary explicit: the session continues consuming live-generation credits until the camera is stopped.

## Frontend Experience

The browser layer is intentionally lightweight. It provides a responsive upload flow, category and source controls, job progress, provider and hardware diagnostics, result previews, downloads, and live-camera controls.

The frontend does not need to know how FASHN VTON loads its weights or how Genlook polling works. It submits inputs, observes job state, displays the returned image, and manages the live WebRTC experience.

This division keeps the interface responsive while the backend handles slower and more failure-prone operations.

## Privacy and Security Boundaries

Drape is local-first, but not every mode is fully offline.

Local FASHN inference keeps photo processing on the machine. When Genlook or OpenAI is selected, the person and garment images leave the computer for generation. During Decart live mode, camera frames are transmitted while the session is active.

The design makes several useful security choices:

- permanent API keys stay on the backend
- live browser access uses short-lived, origin-scoped tokens
- uploads are validated before processing
- generated provider results are downloaded to local storage
- configuration is supplied through environment variables
- photo providers fall back safely when credentials are missing

A production internet-facing version would still need authentication, per-user authorization, rate limiting, encrypted persistent storage, and a formal retention policy for uploaded and generated images.

## End-to-End Photo Flow

A typical photo request works like this:

1. The user uploads a person photo and garment reference.
2. The frontend submits both files with category and source metadata.
3. FastAPI validates the images and creates a queued job.
4. The worker computes a provider-specific cache key.
5. A cache hit returns the existing image without new inference.
6. Otherwise, the configured provider generates the try-on result.
7. The backend saves the image atomically and marks the job complete.
8. The frontend detects the completed state and displays a downloadable result.

## Why This Architecture Works

Drape separates product experience from model execution.

The browser owns interaction. FastAPI owns policy and orchestration. Provider adapters own external API details. The local model package owns inference. The queue protects constrained hardware, while content-based caching protects both time and API credits.

Most importantly, photo and live try-on are allowed to use different technologies. The photo path optimizes for fidelity and reproducibility; the live path optimizes for continuity and low latency. The user still experiences both as one coherent fashion application.

## What I Learned While Building It

The first lesson was that the best model is not automatically the best product architecture. A specialized API can produce an excellent demonstration, a local model can protect privacy and remove per-generation cost, and a general image-editing model can offer flexibility. Supporting more than one path made provider selection a backend concern instead of a limitation imposed on the user interface.

The second lesson was that caching is part of the product, not just a performance optimization. During repeated demos, identical generations should not consume more credits or force the audience to watch the same loading state. By including both the input images and generation configuration in the cache key, Drape can reuse a result without accidentally returning an image produced by different settings.

The third lesson was that failure recovery matters around paid inference. A request can finish successfully at the provider while the local process fails before saving the final file. Persisting recovery metadata lets the application retrieve work that has already been paid for.

The fourth lesson was that live video needs its own experience. A photo job can expose progress states and finish after several seconds. A live session must feel continuous, respond to garment changes, protect the permanent credential, and make ongoing credit usage visible. Treating live mode as a first-class path produced a cleaner design than trying to disguise repeated photo requests as video.

Finally, privacy needs to be described precisely. Calling an application local-first does not mean that every operation stays on the device. Drape keeps local inference available, but its cloud photo and live-video modes transmit media to their respective providers. Making that boundary visible is part of building a trustworthy AI product.

## Current Limitations

The current version is designed as a local showcase rather than a multi-user production platform. A larger deployment would need:

- durable jobs backed by a database or queue service
- authentication and tenant isolation
- object storage with explicit retention controls
- automatic retry policies and provider circuit breakers
- concurrency limits per user and per provider
- observability for latency, cache hits, failures, and credit usage
- evaluation datasets for identity and garment fidelity
- clearer consent and deletion controls for personal images
- horizontal workers for higher photo throughput

Virtual try-on also remains an approximation. Difficult poses, occlusion, unusual garments, poor lighting, and low-quality references can still produce unrealistic fits or altered details.

## Conclusion

Drape demonstrates that an AI fashion product is more than a model endpoint. A useful try-on experience needs validation, routing, secure credentials, asynchronous jobs, caching, hardware awareness, privacy boundaries, and a frontend that explains what the system is doing.

By combining specialized cloud generation, a local open-source fallback, and WebRTC-based live transformation, the project supports both polished still images and an interactive fitting-room experience without tying the entire application to one inference provider.

The main idea I am taking forward is simple: AI features become products only when the surrounding architecture makes them reliable, understandable, affordable, and safe enough to use.
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Understanding the Architecture Behind Xeno Analytics Pro]]></title><description><![CDATA[Xeno Analytics Pro is a full-stack Shopify embedded application that turns store activity into an operational analytics dashboard. It handles Shopify…]]></description><link>https://veyra-architecture.hashnode.dev/understanding-the-architecture-behind-xeno-analytics-pro</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/understanding-the-architecture-behind-xeno-analytics-pro</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:26:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/b2f63d2c-f431-4a4d-add1-059999a7824b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Xeno Analytics Pro is a full-stack Shopify embedded application that turns store activity into an operational analytics dashboard. It handles Shopify installation, OAuth authentication, real-time order webhooks, product retrieval, persistent storage, and visual reporting in one system.</p>
<p>The goal is to give a merchant a single place to inspect orders, customers, products, revenue, and sales trends without manually exporting data from Shopify.</p>
<p>At a high level, the application follows this flow:</p>
<pre><code class="language-text">Shopify Store
     ↓
OAuth Installation + Token Exchange
     ↓
Node.js / Express Backend
     ↓
MySQL Persistence
     ↓
Analytics APIs
     ↓
React Dashboard + Chart.js

In parallel:
Shopify orders/create Webhook
     ↓
HMAC Verification
     ↓
Order Upsert
     ↓
Updated Dashboard Metrics
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/29949522-90d1-491f-8173-4959f9614d3b.png" alt="" style="display:block;margin:0 auto" />

<h2>Shopify Integration Layer</h2>
<p>The application begins with the Shopify installation flow. When a merchant installs the app, the backend redirects the store through Shopify OAuth and receives a callback containing an authorization code.</p>
<p>The backend exchanges that code for a store-specific access token and saves the token on the server. The frontend never receives the secret token.</p>
<p>This layer is responsible for:</p>
<ul>
<li>starting the OAuth flow</li>
<li>validating the store domain</li>
<li>handling the OAuth callback</li>
<li>exchanging the authorization code</li>
<li>storing the access token per shop</li>
<li>registering the store for later API requests</li>
</ul>
<p>The stored token is then used when the backend calls the Shopify GraphQL Admin API for product data.</p>
<h2>Webhook Ingestion Layer</h2>
<p>Analytics should update when store activity happens, not only when a user refreshes the app. Xeno Analytics Pro uses Shopify webhooks to receive new order events.</p>
<p>When Shopify sends an <code>orders/create</code> webhook, the Express backend verifies the HMAC signature before trusting the payload. This step confirms that the event was signed with the application secret.</p>
<p>After verification, the order is written to MySQL. Webhook-driven ingestion keeps the local analytics store synchronized without repeatedly downloading every order.</p>
<p>The webhook layer provides:</p>
<ul>
<li>real-time order ingestion</li>
<li>signature verification</li>
<li>normalization of Shopify payloads</li>
<li>persistent storage for reporting</li>
<li>a clean boundary between external events and internal data</li>
</ul>
<h2>Express Backend Layer</h2>
<p>The Node.js and Express backend coordinates authentication, Shopify API access, storage, and analytics endpoints.</p>
<p>Its main routes include:</p>
<ul>
<li><code>/auth</code> to begin installation</li>
<li><code>/auth/callback</code> to complete OAuth and save the token</li>
<li><code>/webhooks/orders/create</code> to ingest signed order events</li>
<li><code>/api/products</code> to retrieve the live product catalogue</li>
<li><code>/api/orders</code> to return synchronized orders</li>
<li><code>/api/customers</code> to aggregate customer history</li>
<li><code>/api/analytics</code> to calculate dashboard metrics</li>
</ul>
<p>Keeping these responsibilities behind the backend prevents sensitive credentials from reaching the browser and gives the frontend a consistent API even when the underlying data comes from different sources.</p>
<h2>Data Persistence Layer</h2>
<p>The application uses MySQL hosted on Aiven with SSL connections.</p>
<p>Two core data groups drive the system:</p>
<ul>
<li>shop tokens, which associate a store with its server-side access token</li>
<li>shop orders, which contain webhook-sourced order information</li>
</ul>
<p>The backend uses SQL queries and aggregations to produce merchant-facing views. Customer totals can be calculated by grouping orders by customer, while time-based revenue trends can be created by grouping orders by date.</p>
<p>Persisting normalized order data locally has two benefits. Dashboard queries do not need to call Shopify for every chart, and historical analytics remain available through a database designed for aggregation.</p>
<h2>Product Retrieval Layer</h2>
<p>Products are fetched through Shopify's GraphQL Admin API rather than being copied into the local order tables.</p>
<p>The backend reads the correct access token for the current shop, sends a GraphQL query to Shopify, and returns a simplified product response to the React application.</p>
<p>This is a useful split: order events are stored for analytics, while the current catalogue remains sourced from Shopify.</p>
<h2>Frontend Layer</h2>
<p>The frontend is built with React 18, React Router, Vite, and Chart.js. It provides separate views for the dashboard, analytics, products, orders, and customers.</p>
<p>The interface is responsible for showing:</p>
<ul>
<li>live KPI cards</li>
<li>synchronized order tables</li>
<li>customer order history and total spend</li>
<li>product catalogue data</li>
<li>revenue-per-customer charts</li>
<li>orders-per-day trends</li>
</ul>
<p>Custom hooks handle the current shop parameter and reusable API requests. A layout component provides navigation and guards pages that require shop context.</p>
<h2>Analytics Layer</h2>
<p>The analytics layer converts raw order records into information a merchant can act on.</p>
<p>For example, the API can group orders by day to show sales volume over time, or group by customer to identify high-value buyers. Chart.js then turns those aggregates into bar and line charts.</p>
<p>The separation is intentional: MySQL performs the grouping and aggregation, the Express API shapes the response, and React focuses on presentation.</p>
<h2>End-To-End Flow</h2>
<p>A typical store session works like this:</p>
<ol>
<li>A merchant installs the application from Shopify.</li>
<li>Shopify OAuth returns an authorization code to the backend.</li>
<li>The backend exchanges the code and stores the shop token.</li>
<li>Shopify sends new-order webhooks as purchases occur.</li>
<li>The backend verifies each HMAC signature and saves the order.</li>
<li>The dashboard requests orders, customers, and analytics data.</li>
<li>MySQL aggregations produce revenue and activity metrics.</li>
<li>React and Chart.js display the results.</li>
<li>Product views are populated through server-side GraphQL calls to Shopify.</li>
</ol>
<h2>Security Design</h2>
<p>The project includes several important security boundaries:</p>
<ul>
<li>webhook HMAC verification before payload processing</li>
<li>server-side access-token storage</li>
<li>SSL for database connections</li>
<li>environment variables for credentials</li>
<li>no Shopify secrets exposed to the frontend</li>
</ul>
<p>For a production release, the OAuth flow should also enforce state or nonce validation, sessions should be hardened, and authorization should be checked for every shop-scoped API request.</p>
<h2>Why This Architecture Works</h2>
<p>The application separates external integration, data ingestion, analytics, and presentation.</p>
<p>Shopify remains the source of truth for the store and product catalogue. Webhooks deliver changes efficiently. MySQL provides queryable history. Express protects credentials and exposes stable APIs. React presents the results without needing to understand Shopify authentication details.</p>
<p>This separation also makes the system easier to extend. New webhook topics can be added without redesigning the dashboard, and new charts can reuse the existing analytics endpoints.</p>
<h2>Current Limitations</h2>
<p>The current version is a complete prototype, but a larger production deployment would still need:</p>
<ul>
<li>durable retry and dead-letter handling for failed webhooks</li>
<li>idempotency guarantees for duplicate webhook delivery</li>
<li>background jobs for historical order backfills</li>
<li>pagination for large stores</li>
<li>token encryption at rest</li>
<li>stronger session and tenant authorization</li>
<li>monitoring for webhook failures and Shopify API limits</li>
<li>automated data-retention and uninstall cleanup</li>
</ul>
<p>These are natural next steps when moving from a functional embedded app to a multi-store production service.</p>
<h2>Conclusion</h2>
<p>Xeno Analytics Pro connects Shopify's OAuth, GraphQL, and webhook systems to a secure Node.js backend, an SSL-enabled MySQL database, and a React analytics dashboard.</p>
<p>The architecture demonstrates how event-driven commerce data can move from a store action to a persistent record and finally to a useful visualization. It is a practical example of integrating an external platform while keeping credentials, data processing, and UI concerns cleanly separated.</p>
<p>If you found the project useful, consider giving it a star.</p>
<p><a class="embed-card" href="https://github.com/Kushal1213/shopify">https://github.com/Kushal1213/shopify</a></p>
]]></content:encoded></item><item><title><![CDATA[How WhisperShield Combines Browser Privacy And AI Assistance]]></title><description><![CDATA[WhisperShield is a communication privacy and productivity platform built around web messaging. It can blur sensitive text, summarize recent messages…]]></description><link>https://veyra-architecture.hashnode.dev/how-whispershield-combines-browser-privacy-and-ai-assistance</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/how-whispershield-combines-browser-privacy-and-ai-assistance</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:24:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/bfe6e6ec-e264-4ed0-be57-a3652d21ce3e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>WhisperShield is a communication privacy and productivity platform built around web messaging. It can blur sensitive text, summarize recent messages, generate replies in different tones, detect scams, and analyze sentiment.</p>
<p>The system spans three surfaces: a Chrome extension that works inside the messaging page, an Express API that performs validation and AI orchestration, and a Next.js dashboard for testing and using the same capabilities outside the extension.</p>
<pre><code class="language-text">Messaging Page
      ↓
Chrome Content Script
      ↓
Background Service Worker
      ↓
Node.js / Express API
  ↙                 ↘
Local Rules       OpenAI Analysis
      ↘             ↙
Summary, Replies, Scam Risk, Sentiment
      ↓
Injected Side Panel Or Next.js Dashboard
</code></pre>
<h2>Browser Extension Layer</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/9a1fb5bd-0547-440a-b383-eeb1c1de9315.png" alt="" style="display:block;margin:0 auto" />

<p>The extension uses Chrome Manifest V3. A content script observes the messaging page, while a background service worker relays requests to the API.</p>
<p>The content layer is responsible for:</p>
<ul>
<li>detecting newly added messages with <code>MutationObserver</code></li>
<li>blurring text that appears to contain sensitive information</li>
<li>temporarily revealing a blurred message on click</li>
<li>collecting a bounded set of visible messages</li>
<li>displaying summaries, reply suggestions, and warnings</li>
<li>rendering a slide-in assistant panel</li>
</ul>
<p>Using <code>MutationObserver</code> is more efficient and responsive than continuously scanning the document on a timer. It lets WhisperShield react when the page changes.</p>
<h2>Sensitive-Text Protection Layer</h2>
<p>Smart Blur uses local pattern matching for content such as OTPs, passwords, bank details, CVVs, and account numbers.</p>
<p>This feature is deliberately local. Obvious sensitive patterns can be hidden without sending the text to an AI provider. The user can reveal a message temporarily when needed.</p>
<p>Rule-based detection is fast and predictable, but it can produce both false positives and false negatives. The feature should be treated as an additional privacy aid rather than a guarantee that all sensitive information will be recognized.</p>
<h2>Background Service Worker</h2>
<p>The Manifest V3 service worker acts as a boundary between the injected page logic and the external API.</p>
<p>It receives requests from the content script, calls the configured backend, and returns structured results. This design keeps API communication and extension lifecycle handling out of the page-facing code.</p>
<p>The service worker also avoids placing provider credentials in the extension. The browser calls the project's backend, and the backend owns model access.</p>
<h2>Express API Layer</h2>
<p>The Node.js and Express backend exposes endpoints for:</p>
<ul>
<li>summarization</li>
<li>three-tone reply generation</li>
<li>scam detection</li>
<li>sentiment analysis</li>
<li>service health</li>
</ul>
<p>Security middleware includes Helmet, request rate limiting, configured CORS, and input validation. Errors are returned to the caller instead of being hidden behind a hardcoded response.</p>
<p>When an OpenAI key is available, the API uses GPT-4o-mini. A mock fallback keeps the product demonstrable without a provider key.</p>
<h2>Scam Detection Layer</h2>
<p>Scam detection combines deterministic signals with AI analysis.</p>
<p>Local rules check for patterns commonly associated with phishing or financial scams. The AI layer can consider broader context across the recent conversation. A warning banner is shown when the combined result crosses the configured confidence boundary.</p>
<p>This hybrid approach is useful because rules are consistent for known patterns, while the model can identify suspicious language that does not match an exact expression.</p>
<p>However, the result must remain advisory. It should not claim that a message is safe simply because no pattern or model signal was found.</p>
<h2>Summarization And Reply Layer</h2>
<p>The extension can collect a bounded window of recent visible messages and send it for summarization. Keeping the window small reduces latency and prevents the system from processing more conversation than necessary.</p>
<p>Smart Reply returns three options:</p>
<ul>
<li>professional</li>
<li>friendly</li>
<li>brief</li>
</ul>
<p>The user chooses and copies a reply. The system does not send the message automatically, which preserves an important human-review step.</p>
<h2>Next.js Dashboard Layer</h2>
<p>The web dashboard provides a standalone interface to the same API. It is built with Next.js, TypeScript, and Tailwind CSS.</p>
<p>This surface is useful for testing the endpoints, demonstrating the product without installing the extension, and giving users access to analysis features outside the messaging page.</p>
<p>Keeping the dashboard and extension on one API also prevents the AI logic from being duplicated across clients.</p>
<h2>End-To-End Flow</h2>
<p>A typical scam check works like this:</p>
<ol>
<li>The content script collects the most recent visible messages.</li>
<li>The extension sends the text to its background service worker.</li>
<li>The service worker calls the Express scam-detection endpoint.</li>
<li>The backend validates the request.</li>
<li>Regex patterns identify known warning signals.</li>
<li>The AI layer evaluates the broader conversation context.</li>
<li>The API returns a risk assessment and explanation.</li>
<li>The content script displays a warning when the result is sufficiently suspicious.</li>
</ol>
<p>Smart Blur follows a shorter local path and does not require the API for basic pattern detection.</p>
<h2>Privacy And Security Boundaries</h2>
<p>WhisperShield handles message content, so privacy boundaries are central to the architecture.</p>
<p>Useful protections already include local blurring, bounded message collection, server-side model credentials, rate limiting, input validation, and explicit user selection before copying a reply.</p>
<p>A production version should go further with:</p>
<ul>
<li>clear disclosure before message text leaves the browser</li>
<li>encryption in transit and strict log redaction</li>
<li>no retention of message content by default</li>
<li>allowlisted page origins</li>
<li>minimal extension permissions</li>
<li>prompt-injection defenses for message content</li>
<li>provider data-retention documentation</li>
<li>user controls for each AI feature</li>
</ul>
<h2>Why This Architecture Works</h2>
<p>The extension handles page context and local privacy actions. The service worker handles browser-to-server communication. Express owns validation and AI orchestration. Next.js provides a separate product surface.</p>
<p>This separation keeps provider secrets out of the browser and allows deterministic privacy features to work even when the AI service is unavailable.</p>
<h2>Current Limitations</h2>
<p>The current prototype still depends on the structure of the target messaging page. DOM changes can break selectors or panel placement.</p>
<p>Other limitations include:</p>
<ul>
<li>rule-based sensitive-data detection is incomplete</li>
<li>model-based scam detection can be wrong</li>
<li>localhost API configuration is intended for development</li>
<li>message context is limited to visible content</li>
<li>the extension is not a substitute for platform security features</li>
<li>mock mode is useful for demos but cannot validate real model behavior</li>
</ul>
<h2>Conclusion</h2>
<p>WhisperShield demonstrates how local browser protections and AI-assisted communication tools can coexist in one architecture.</p>
<p>The key design is a layered workflow: keep simple privacy actions local, send only user-requested analysis through the service worker and API, and leave the final communication decision with the user.</p>
<p>If you found the project useful, consider giving it a star.</p>
<p><a class="embed-card" href="https://github.com/Kushal1213/Whispershield">https://github.com/Kushal1213/Whispershield</a></p>
]]></content:encoded></item><item><title><![CDATA[Understanding the Architecture Behind Sleep Oracle]]></title><description><![CDATA[Sleep Oracle is a full-stack machine learning application that predicts whether a person's health and lifestyle profile is associated with no sleep…]]></description><link>https://veyra-architecture.hashnode.dev/understanding-the-architecture-behind-sleep-oracle</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/understanding-the-architecture-behind-sleep-oracle</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:23:40 GMT</pubDate><content:encoded><![CDATA[<p>Sleep Oracle is a full-stack machine learning application that predicts whether a person's health and lifestyle profile is associated with no sleep disorder, insomnia, or sleep apnea.</p>
<p>The project connects a trained Random Forest model to a Flask API and a React interface. A user enters lifestyle and physiological information, the backend prepares the values for the model, and the application returns a prediction with supporting health-oriented guidance.</p>
<p>At a high level, Sleep Oracle follows this flow:</p>
<pre><code class="language-text">User Health And Lifestyle Inputs
              ↓
        React Interface
              ↓
       Flask REST API
              ↓
Validation + Feature Encoding
              ↓
Serialized Random Forest Model
              ↓
Sleep Disorder Prediction
              ↓
Result And General Recommendations
</code></pre>
<h2>Problem And Dataset</h2>
<p>Sleep quality is influenced by many connected factors, including stress, physical activity, occupation, heart rate, daily steps, and sleep duration. Sleep Oracle explores whether these signals can help classify common sleep-disorder categories.</p>
<p>The model is trained on the Sleep Health and Lifestyle Dataset, which contains 374 records and 13 features. Inputs used by the project include:</p>
<ul>
<li>age and gender</li>
<li>occupation</li>
<li>sleep duration and sleep quality</li>
<li>physical activity level</li>
<li>stress level</li>
<li>BMI category</li>
<li>heart rate</li>
<li>daily steps</li>
<li>blood pressure</li>
</ul>
<p>The target contains three classes: no sleep disorder, sleep apnea, and insomnia.</p>
<h2>Exploration And Preprocessing Layer</h2>
<p>Before model training, the project uses pandas, NumPy, Matplotlib, and Seaborn to inspect the dataset.</p>
<p>This stage helps identify class balance, missing values, feature distributions, and relationships between lifestyle measurements and the target label.</p>
<p>Categorical inputs such as gender, occupation, and BMI category must be converted into the same numeric representation used during training. Numeric inputs must also arrive in the correct order and format.</p>
<p>The preprocessing layer is responsible for:</p>
<ul>
<li>cleaning the training data</li>
<li>separating features and labels</li>
<li>encoding categorical values</li>
<li>preserving fitted encoders</li>
<li>preparing API inputs in the training feature order</li>
</ul>
<p>The trained encoders are serialized alongside the model so that the web application uses the same mappings as the notebook pipeline.</p>
<h2>Machine Learning Layer</h2>
<p>Sleep Oracle uses a Random Forest classifier. A Random Forest combines many decision trees and aggregates their predictions, making it a useful baseline for mixed tabular data with nonlinear relationships.</p>
<p>Individual trees can learn rules such as interactions between stress, activity, age, sleep duration, and physiological measures. The ensemble reduces the instability of relying on a single tree.</p>
<p>The model-development workflow includes:</p>
<ul>
<li>exploratory data analysis</li>
<li>feature preparation</li>
<li>training and evaluation</li>
<li>cross-validation</li>
<li>model serialization with <code>pickle</code></li>
</ul>
<p>The serialized model is stored with the Flask application so predictions can be generated without retraining on every request.</p>
<h2>Flask API Layer</h2>
<p>The backend is built with Flask and exposes a small REST interface.</p>
<p>The main endpoints are:</p>
<ul>
<li><code>POST /predict</code> for sleep-disorder prediction</li>
<li><code>GET /health</code> for service-health checks</li>
</ul>
<p>When a prediction request arrives, the backend validates the payload, applies the saved encoders, arranges the feature vector, loads the trained model, and returns the predicted class.</p>
<p>This layer keeps machine learning logic outside the browser. The frontend only needs to submit structured data and display the response.</p>
<h2>React Frontend Layer</h2>
<p>The React frontend provides a responsive, sleep-themed interface for entering health and lifestyle values.</p>
<p>Its main responsibilities are:</p>
<ul>
<li>collecting the model's required inputs</li>
<li>applying basic form validation</li>
<li>sending prediction requests to Flask</li>
<li>showing loading and error states</li>
<li>presenting the predicted category</li>
<li>displaying general, non-diagnostic recommendations</li>
</ul>
<p>Separating the interface from the model service allows the user experience to evolve without retraining the model.</p>
<h2>Model Serialization Layer</h2>
<p>The trained Random Forest and categorical encoders are stored as serialized artifacts.</p>
<p>This is an important bridge between experimentation and deployment. The Jupyter notebook produces the artifacts, while Flask loads them for inference.</p>
<p>For the prediction pipeline to remain correct, training and inference must use identical:</p>
<ul>
<li>feature names</li>
<li>feature order</li>
<li>categorical mappings</li>
<li>data types</li>
<li>missing-value behavior</li>
</ul>
<p>A mismatch in any of these can produce incorrect predictions even if the API continues to run.</p>
<h2>End-To-End Prediction Flow</h2>
<p>A typical prediction works like this:</p>
<ol>
<li>The user enters lifestyle and physiological information in React.</li>
<li>The frontend validates the required fields.</li>
<li>The form is sent as JSON to the Flask prediction endpoint.</li>
<li>Flask converts the values into the model's expected representation.</li>
<li>Saved encoders transform categorical fields.</li>
<li>The Random Forest predicts one of the three sleep-disorder classes.</li>
<li>Flask returns the result as JSON.</li>
<li>React displays the prediction and general guidance.</li>
</ol>
<h2>Deployment Layer</h2>
<p>The project includes configuration for deployment on Render. The frontend and backend can be deployed as separate services.</p>
<p>The Flask service installs the Python requirements and runs behind Gunicorn. The React application builds into static assets and sends requests to the deployed API URL.</p>
<p>This setup keeps the runtime simple:</p>
<ul>
<li>React handles the browser experience</li>
<li>Flask and Gunicorn handle API requests</li>
<li>the serialized artifacts provide local inference</li>
</ul>
<h2>Why This Architecture Works</h2>
<p>Sleep Oracle separates experimentation, inference, and presentation.</p>
<p>The notebook environment is used for analysis and training. Flask provides a stable prediction boundary. React provides a focused interface. Serialized artifacts connect the training pipeline to the deployed application.</p>
<p>This design is easy to understand, test, and extend. A different classifier can replace the Random Forest without rewriting the entire frontend, and the UI can be redesigned without changing the notebook workflow.</p>
<h2>Current Limitations</h2>
<p>The project is an educational prediction application, not a medical diagnostic system. Important limitations include:</p>
<ul>
<li>the dataset contains only 374 records</li>
<li>the training data may not represent every population</li>
<li>self-reported lifestyle inputs can be inaccurate</li>
<li>the model does not use clinical sleep-study data</li>
<li>a single prediction does not establish a diagnosis</li>
<li>serialized pickle artifacts require trusted storage and version control</li>
<li>production deployment would need stronger validation, monitoring, and privacy controls</li>
</ul>
<p>The output should be treated as a demonstration of machine learning architecture and not as medical advice. Anyone concerned about a sleep disorder should consult a qualified healthcare professional.</p>
<h2>Possible Improvements</h2>
<p>Future versions could add:</p>
<ul>
<li>calibrated class probabilities</li>
<li>feature-importance explanations for each result</li>
<li>artifact versioning and a model registry</li>
<li>drift monitoring</li>
<li>stronger schema validation</li>
<li>automated tests for preprocessing parity</li>
<li>a larger and more diverse clinical dataset</li>
<li>explicit uncertainty messaging in the interface</li>
</ul>
<h2>Conclusion</h2>
<p>Sleep Oracle demonstrates the complete path from exploratory data analysis to a usable web application. It combines a Random Forest classifier, saved preprocessing artifacts, a Flask inference API, and a React frontend in a clean end-to-end workflow.</p>
<p>The project also highlights an important lesson: deploying machine learning is not only about training a model. The preprocessing contract, API boundary, user experience, limitations, and safety messaging are equally important parts of the system.</p>
<p>If you found the project useful, consider giving it a star.</p>
<p><a href="https://github.com/Kushal1213/Sleep-Oracle">GitHub - Kushal1213/Sleep-Oracle</a></p>
]]></content:encoded></item><item><title><![CDATA[Understanding the Architecture Behind InsightBoard]]></title><description><![CDATA[InsightBoard is a lightweight analytics platform that turns a CSV file into an interactive, AI-assisted dashboard. A user uploads data, asks a question in…]]></description><link>https://veyra-architecture.hashnode.dev/understanding-the-architecture-behind-insightboard</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/understanding-the-architecture-behind-insightboard</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:21:31 GMT</pubDate><content:encoded><![CDATA[<p>InsightBoard is a lightweight analytics platform that turns a CSV file into an interactive, AI-assisted dashboard. A user uploads data, asks a question in plain English, and receives a validated SQL query, result table, and chart that can be pinned for later use.</p>
<p>The project combines React, Flask, PostgreSQL, Pydantic, Recharts, and Claude. Its central challenge is not only generating SQL, but generating SQL that is constrained to the uploaded dataset and safe to execute.</p>
<pre><code class="language-text">CSV Upload
    ↓
Flask Upload Service
    ↓
PostgreSQL Dynamic Dataset Table
    ↓
Natural-Language Question + Dataset Schema
    ↓
Claude SQL Generation
    ↓
Safety Validation + SELECT-Only Policy
    ↓
Query Execution + History
    ↓
React Chart, Table, Or Pinned Widget
</code></pre>
<h2>Dataset Ingestion Layer</h2>
<p>The workflow begins when a user uploads a CSV. The backend parses the file, infers columns, and creates a PostgreSQL table for that dataset.</p>
<p>Each table uses a generated name with a hash suffix. This avoids collisions and makes dataset identifiers harder to guess. Metadata about the dataset is stored separately from the uploaded rows.</p>
<p>The ingestion layer is responsible for:</p>
<ul>
<li>validating the file</li>
<li>reading headers and values</li>
<li>mapping CSV types into database types</li>
<li>creating the dynamic table</li>
<li>inserting rows</li>
<li>recording dataset metadata</li>
</ul>
<p>Dynamic tables make arbitrary CSV uploads flexible, but they also introduce cleanup, naming, and lifecycle responsibilities.</p>
<h2>Natural-Language Query Layer</h2>
<p>When a user asks a question, InsightBoard does not send only the question to the model. It includes the actual dataset schema and a fixed set of prompt rules.</p>
<p>The AI is instructed to produce a single <code>SELECT</code> statement, stay within the provided tables and columns, and apply a result limit. This schema grounding reduces hallucinated names and keeps the request tied to the selected dataset.</p>
<p>Claude is used only for SQL generation. Database execution, validation, visualization, and persistence remain deterministic application code.</p>
<h2>SQL Safety Layer</h2>
<p>Executing model-generated SQL creates an obvious security boundary. InsightBoard applies multiple checks before a query reaches PostgreSQL.</p>
<p>Pydantic validates the incoming question and rejects forbidden tokens. The generated output is scanned for non-read-only statements and constrained to a row limit. Query history is recorded for auditability.</p>
<p>The safety flow is:</p>
<ol>
<li>Validate the request schema.</li>
<li>Bind the question to one known dataset.</li>
<li>Provide only the permitted schema to the model.</li>
<li>Require <code>SELECT</code>-only output.</li>
<li>Reject forbidden SQL keywords and multiple statements.</li>
<li>Enforce <code>LIMIT 100</code>.</li>
<li>Execute and log the result.</li>
</ol>
<p>Regex validation is a useful prototype safeguard, but production systems should also use a SQL parser, a read-only database role, statement timeouts, and resource limits.</p>
<h2>Flask Service Layer</h2>
<p>The backend uses Flask with separate services for uploads, AI generation, query execution, and dashboards.</p>
<p>Its API supports:</p>
<ul>
<li>uploading and listing datasets</li>
<li>asking natural-language questions</li>
<li>reading query history</li>
<li>fetching dashboard widgets</li>
<li>pinning and removing visualizations</li>
<li>reordering dashboard items</li>
</ul>
<p>This service structure keeps route handlers small and separates transport logic from business logic.</p>
<h2>PostgreSQL Layer</h2>
<p>PostgreSQL stores three kinds of information:</p>
<ul>
<li>dataset metadata</li>
<li>query history</li>
<li>dashboard widgets</li>
</ul>
<p>It also stores the rows from each uploaded CSV in a generated dataset table.</p>
<p>SQLAlchemy handles the application's stable metadata models, while carefully controlled SQL is used for dynamic tables and generated queries. The query history connects a user's question, generated SQL, result metadata, and execution outcome.</p>
<h2>Frontend Layer</h2>
<p>The React frontend is built with Vite, Tailwind CSS, and Recharts. It provides four main experiences:</p>
<ul>
<li>Home for uploads and dataset selection</li>
<li>Dataset for natural-language questions</li>
<li>Dashboard for saved visualizations</li>
<li>History for previous queries</li>
</ul>
<p>The result renderer decides whether a response is best shown as a table or chart. Users can preview bar, line, or pie visualizations and pin useful results to the dashboard.</p>
<p>The frontend does not generate SQL or manipulate database schemas. It communicates through a focused API and renders structured results.</p>
<h2>Dashboard Layer</h2>
<p>A useful query becomes more valuable when it can be saved. InsightBoard stores widget configuration alongside the query result context.</p>
<p>The dashboard service supports creating, deleting, listing, and reordering widgets. This turns the product from a one-time chat interface into a small self-service BI workspace.</p>
<h2>End-To-End Flow</h2>
<p>A typical analytics question moves through the system like this:</p>
<ol>
<li>The user uploads a CSV.</li>
<li>Flask validates and parses the file.</li>
<li>PostgreSQL stores the data in a generated table.</li>
<li>The user asks a question in natural language.</li>
<li>The backend combines the question, schema, and safety rules.</li>
<li>Claude returns a candidate <code>SELECT</code> query.</li>
<li>The safety layer validates and limits the SQL.</li>
<li>PostgreSQL executes the query.</li>
<li>The response and query history are stored.</li>
<li>React renders a table or Recharts visualization.</li>
<li>The user can pin the result to the dashboard.</li>
</ol>
<h2>Why This Architecture Works</h2>
<p>InsightBoard gives the model a narrow responsibility. The model translates intent into SQL; application code decides what data exists, what operations are allowed, whether the query is safe, and how the result is displayed.</p>
<p>This boundary reduces the blast radius of model errors and keeps the analytics workflow observable. Every generated query can be inspected, tested, rejected, or replayed.</p>
<h2>Current Limitations</h2>
<p>The current version is a strong prototype, but production use would need:</p>
<ul>
<li>authentication and per-user dataset isolation</li>
<li>a parser-based SQL policy instead of regex alone</li>
<li>read-only database credentials for generated queries</li>
<li>query timeouts and cost limits</li>
<li>protection against prompt injection inside uploaded data</li>
<li>background processing for large CSV files</li>
<li>multi-table joins and richer type inference</li>
<li>model fallback and evaluation suites</li>
<li>dashboard export and scheduled refresh</li>
</ul>
<p>The single-model dependency also means generation is unavailable when the provider is down.</p>
<h2>Conclusion</h2>
<p>InsightBoard demonstrates how generative AI can make analytics more accessible without giving the model unrestricted control of the database.</p>
<p>Schema grounding, read-only validation, query history, deterministic execution, and reusable dashboards work together to turn natural-language questions into traceable analytics results.</p>
<p>If you found the project useful, consider giving it a star.</p>
<p><a href="https://github.com/Kushal1213/insightboard">GitHub - Kushal1213/insightboard</a></p>
]]></content:encoded></item><item><title><![CDATA[How Temporal Graphs Power a Fraud Detection System]]></title><description><![CDATA[Fraud is rarely an isolated event. A suspicious transaction may look normal on its own, but become obvious when it is connected to the same card, device…]]></description><link>https://veyra-architecture.hashnode.dev/how-temporal-graphs-power-a-fraud-detection-system</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/how-temporal-graphs-power-a-fraud-detection-system</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:20:02 GMT</pubDate><content:encoded><![CDATA[<p>Fraud is rarely an isolated event. A suspicious transaction may look normal on its own, but become obvious when it is connected to the same card, device, email domain, or group of accounts used in earlier transactions.</p>
<p>This is the idea behind my Temporal Motif-Aware Fraud Detection System. Instead of treating every payment as an independent row, the project models transactions as a graph that changes over time. It combines static and temporal graph neural networks with tabular machine learning, then uses SHAP to explain the final prediction.</p>
<p>At a high level, the system follows this flow:</p>
<pre><code class="language-text">IEEE-CIS Transaction + Identity Data
                ↓
      Preprocessing Pipeline
                ↓
      Graph Construction Layer
        ↙                 ↘
Static Graph          Temporal Snapshots
        ↓                 ↓
   GraphSAGE             A3TGCN
        ↘                 ↙
       GNN Embeddings + Tabular Features
                       ↓
               XGBoost Classifier
                       ↓
          Fraud Score + SHAP Explanation
</code></pre>
<h2>The Problem With Row-Only Fraud Models</h2>
<p>Traditional models usually inspect attributes such as transaction amount, time, device, and account history. These features are useful, but they can miss coordinated behavior.</p>
<p>Fraudsters often reuse infrastructure across multiple identities. Several accounts may share a device, cards may appear across related email domains, or a group of transactions may form a repeated pattern within a short time window. These relationships are naturally represented as a graph.</p>
<p>The system is designed to detect three kinds of signals:</p>
<ul>
<li>ring fraud involving coordinated entities</li>
<li>temporal drift as behavior changes over time</li>
<li>velocity anomalies such as sudden bursts of activity</li>
</ul>
<h2>Data And Preprocessing Layer</h2>
<p>The project uses the IEEE-CIS Fraud Detection dataset, which contains transaction and identity data. The raw inputs include missing values, categorical variables, numeric features, and a heavily imbalanced fraud label.</p>
<p>The preprocessing pipeline handles:</p>
<ul>
<li>missing-value imputation</li>
<li>categorical encoding</li>
<li>numeric feature scaling</li>
<li>class resampling</li>
<li>entity extraction for graph construction</li>
<li>chronological splitting for temporal evaluation</li>
</ul>
<p>Class imbalance is especially important. A model that predicts every transaction as legitimate can look accurate while being useless. The training process therefore uses weighted loss and controlled resampling so that fraudulent cases influence learning without overwhelming the original distribution.</p>
<h2>Graph Construction Layer</h2>
<p>The graph contains multiple entity types. Card IDs, device IDs, and email domains become nodes, while transactions create connections between them.</p>
<p>For example, a transaction can connect a card to a device and a card to an email domain. If several cards repeatedly use the same device, the shared structure becomes visible to the model.</p>
<p>Edge weights are based on the transaction amount using a logarithmic transformation. This keeps very large transactions from dominating the graph while preserving useful magnitude information.</p>
<p>The project creates two views of this data:</p>
<ul>
<li>a static graph containing the overall relational structure</li>
<li>20 temporal snapshots showing how the graph evolves</li>
</ul>
<p>These views support two complementary graph models.</p>
<h2>Static GraphSAGE Layer</h2>
<p>GraphSAGE learns an embedding for each node by aggregating information from its neighborhood. A card is not represented only by its own attributes; it also learns from the devices, email domains, and nearby entities connected to it.</p>
<p>The implementation uses a three-layer GraphSAGE network with batch normalization, dropout, and a weighted binary classification loss.</p>
<p>This layer is useful for finding persistent relational patterns. If a suspicious group repeatedly shares infrastructure, GraphSAGE can encode that neighborhood into the learned representation.</p>
<h2>Temporal A3TGCN Layer</h2>
<p>Static graphs cannot fully describe when relationships appeared or how behavior changed. The A3TGCN layer processes a sequence of graph snapshots and learns time-aware node representations.</p>
<p>The temporal split is chronological: the model trains on the earliest snapshots and is evaluated on later, unseen snapshots. This is closer to a real fraud setting than a random split because production systems must detect future behavior.</p>
<p>The temporal model helps capture:</p>
<ul>
<li>newly forming fraud rings</li>
<li>sudden changes in transaction frequency</li>
<li>relationships that become suspicious only within a time window</li>
<li>patterns that drift as attackers change tactics</li>
</ul>
<h2>Hybrid XGBoost Layer</h2>
<p>Graph models are strong at relational learning, while gradient-boosted trees remain highly effective on tabular data. The final architecture combines both.</p>
<p>The learned GNN embeddings are joined with the engineered transaction features and passed to an XGBoost classifier. This gives the final model access to both the transaction itself and the structure surrounding it.</p>
<p>The repository reports the following evaluation results:</p>
<table>
<thead>
<tr>
<th>Model</th>
<th align="right">AUROC</th>
<th align="right">AUPRC</th>
<th align="right">Precision@100</th>
</tr>
</thead>
<tbody><tr>
<td>XGBoost, tabular only</td>
<td align="right">0.881</td>
<td align="right">0.612</td>
<td align="right">0.74</td>
</tr>
<tr>
<td>GraphSAGE</td>
<td align="right">0.903</td>
<td align="right">0.668</td>
<td align="right">0.81</td>
</tr>
<tr>
<td>A3TGCN</td>
<td align="right">0.917</td>
<td align="right">0.701</td>
<td align="right">0.85</td>
</tr>
<tr>
<td>Hybrid A3TGCN + XGBoost</td>
<td align="right">0.943</td>
<td align="right">0.741</td>
<td align="right">0.89</td>
</tr>
</tbody></table>
<p>The comparison shows why the hybrid design matters: tabular, relational, and temporal signals contribute different information.</p>
<h2>Explainability Layer</h2>
<p>In fraud detection, a score is not enough. Analysts need to understand why a transaction was flagged, especially when decisions may be reviewed for compliance or customer impact.</p>
<p>The system uses SHAP for both global and local explanations.</p>
<p>Global explanations show which features influence the model across the evaluation set. Local explanations show which features pushed an individual prediction toward fraud or non-fraud.</p>
<p>An important result from the project is that graph embedding features appear in 14 of the top 20 features. This supports the central hypothesis that relational information adds useful fraud signals beyond the raw transaction fields.</p>
<h2>End-To-End Prediction Flow</h2>
<p>A typical prediction moves through the system like this:</p>
<ol>
<li>Transaction and identity data are cleaned and encoded.</li>
<li>Entity relationships are converted into graph edges.</li>
<li>The static graph is processed by GraphSAGE.</li>
<li>Time-binned graph snapshots are processed by A3TGCN.</li>
<li>The resulting embeddings are joined with tabular features.</li>
<li>XGBoost produces the fraud probability.</li>
<li>SHAP produces a human-readable explanation of the decision.</li>
</ol>
<h2>Why This Architecture Works</h2>
<p>The architecture separates three different questions:</p>
<ul>
<li>What does this transaction look like?</li>
<li>What entities is it connected to?</li>
<li>How have those relationships changed over time?</li>
</ul>
<p>XGBoost answers the first question, GraphSAGE helps with the second, and A3TGCN addresses the third. The fusion layer combines the answers into one decision.</p>
<p>This modular design also makes experimentation easier. Each model can be trained and evaluated separately, and a simpler baseline remains available when temporal processing is too expensive.</p>
<h2>Current Limitations</h2>
<p>The project is a strong research and engineering prototype, but a production system would still need:</p>
<ul>
<li>streaming graph updates instead of batch snapshots</li>
<li>online feature computation with strict latency guarantees</li>
<li>model and data-drift monitoring</li>
<li>a case-management workflow for fraud analysts</li>
<li>threshold calibration based on investigation cost</li>
<li>stronger privacy controls and access auditing</li>
<li>evaluation on institution-specific transaction data</li>
</ul>
<p>The reported results are dataset-specific and should not be interpreted as guaranteed performance in a live financial environment.</p>
<h2>Conclusion</h2>
<p>The Temporal Motif-Aware Fraud Detection System shows why fraud detection benefits from looking beyond individual rows. Static graph learning reveals shared infrastructure, temporal graph learning captures changing behavior, XGBoost preserves strong tabular performance, and SHAP makes the final output easier to audit.</p>
<p>The result is a practical hybrid architecture for detecting fraud patterns that are relational, time-dependent, and difficult to spot with rules alone.</p>
<p>If you found the project useful, consider giving it a star.</p>
<p><a href="https://github.com/Kushal1213/fraud-detection">GitHub - Kushal1213/fraud-detection</a></p>
]]></content:encoded></item><item><title><![CDATA[How Cuepoint Builds Screen-Aware AI for Windows]]></title><description><![CDATA[Cuepoint is a Windows desktop assistant designed around a simple interaction: point at what is on the screen, ask a question, and receive help next to the…]]></description><link>https://veyra-architecture.hashnode.dev/how-cuepoint-builds-screen-aware-ai-for-windows</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/how-cuepoint-builds-screen-aware-ai-for-windows</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 05 Nov 2026 10:17:21 GMT</pubDate><content:encoded><![CDATA[<p>Cuepoint is a Windows desktop assistant designed around a simple interaction: point at what is on the screen, ask a question, and receive help next to the detail that matters.</p>
<p>Unlike a normal chatbot, Cuepoint works with live visual context. It can explain an interface, draw an on-screen walkthrough, or complete a task under the user's control. The application combines a Tauri desktop client, local screen capture, a loopback-only FastAPI service, multimodal AI providers, and optional browser automation.</p>
<p>At a high level, the system follows this flow:</p>
<pre><code class="language-text">Global Shortcut Or Region Selection
                ↓
      Tauri Windows Client
                ↓
Screenshot + Question + Mode
                ↓
   Local FastAPI Service (Loopback)
                ↓
Gemini Or OpenAI Under The User's Key
                ↓
Answer + Coordinates + Action Plan
                ↓
Overlay, Visual Guide, Or Controlled Action
</code></pre>
<h2>Interaction Model</h2>
<p>Cuepoint supports three primary modes.</p>
<ul>
<li>Ask answers a question using the current screen.</li>
<li>Guide produces a narrated walkthrough with points, boxes, and arrows.</li>
<li>Act completes supported tasks while keeping the user in control.</li>
</ul>
<p>A region-selection shortcut lets the user narrow the context when the entire screen is too broad. Voice input is also supported through either on-device transcription or OpenAI under the user's own key.</p>
<p>This mode-based design matters because answering, teaching, and acting are different risk levels. Cuepoint can choose a response contract that matches the user's intent instead of treating every request like an autonomous action.</p>
<h2>Tauri Desktop Layer</h2>
<p>The desktop client is built with Tauri 2. Tauri provides a native Windows shell while keeping the interface web-based and the executable smaller than a traditional Electron bundle.</p>
<p>The client is responsible for:</p>
<ul>
<li>registering global shortcuts</li>
<li>capturing the current screen or a selected region</li>
<li>presenting the compact question interface</li>
<li>rendering answers beside the relevant content</li>
<li>drawing walkthrough annotations</li>
<li>starting and supervising the bundled local service</li>
<li>exposing settings for providers, models, and optional features</li>
</ul>
<p>Release builds package the Python service as a background executable, so the user does not need to install Python or manually start a server.</p>
<h2>Local Service Layer</h2>
<p>The backend is a FastAPI service bound to the loopback interface. It behaves as a local relay rather than a hosted Cuepoint data store.</p>
<p>Requests can include the screenshot, selected mode, user question, and relevant settings. The service validates the request, calls the selected provider, and returns a structured result to the desktop client.</p>
<p>Keeping this layer local provides a clean boundary for:</p>
<ul>
<li>provider authentication</li>
<li>multimodal request construction</li>
<li>response parsing</li>
<li>coordinate normalization</li>
<li>voice transcription</li>
<li>task planning and tool coordination</li>
</ul>
<p>The desktop interface does not need to implement provider-specific API behavior, and the Python service can evolve independently from the Tauri UI.</p>
<h2>Multimodal AI Layer</h2>
<p>Cuepoint supports Gemini and OpenAI through a bring-your-own-key model. The available model list is loaded from the user's provider account and filtered for screenshot support.</p>
<p>For an Ask request, the provider receives the visual context and question, then returns a focused explanation. For Guide, the response must also identify meaningful locations so the client can draw annotations. Act requests can produce a plan that is executed only through supported tools and user controls.</p>
<p>The key architectural requirement is structured output. A paragraph alone is enough for a chatbot, but an overlay needs positions, labels, and ordered steps. The backend therefore turns a multimodal model response into a contract the desktop client can render reliably.</p>
<h2>Visual Guidance Layer</h2>
<p>Guide mode converts instructions into visible, spatial help.</p>
<p>For example, instead of saying “open the settings menu in the upper-right corner,” Cuepoint can mark the menu, draw an arrow, and keep the explanation close to it. This reduces the mental translation between a text answer and the interface.</p>
<p>Coordinate handling must account for the captured image, display scale, window geometry, and overlay surface. The client maps model-provided locations back onto the user's screen before rendering points, boxes, and arrows.</p>
<h2>Act Layer</h2>
<p>Act mode extends the product from explanation into controlled execution. It can type, open applications, search connected sources, or perform supported browser tasks.</p>
<p>This layer needs more safeguards than Ask or Guide. A useful design separates planning from execution, restricts available tools, records task outcomes locally, and keeps destructive or sensitive steps behind user control.</p>
<p>Cuepoint stores the latest task history locally while deliberately avoiding screenshot storage in that history. This preserves useful audit information without retaining the most sensitive visual context.</p>
<h2>Privacy Design</h2>
<p>Cuepoint does not operate a central screenshot-processing server. Screenshots, questions, and answers pass through the local service in memory and are sent directly to the provider selected by the user.</p>
<p>Diagnostics are optional and disabled by default. The documented telemetry design excludes screenshots, questions, task text, clipboard content, file content, model answers, keys, and tokens.</p>
<p>This architecture does not make provider calls private by default—the selected provider still receives the content required for the request—but it removes an additional Cuepoint-operated data layer and makes the destination explicit.</p>
<h2>End-To-End Flow</h2>
<p>A typical Guide request works like this:</p>
<ol>
<li>The user presses the global shortcut.</li>
<li>Cuepoint captures the current screen or selected region.</li>
<li>The user enters a <code>guide:</code> request.</li>
<li>The Tauri client sends the visual context to the local FastAPI service.</li>
<li>The service builds a multimodal request for the selected provider.</li>
<li>The provider returns an explanation and relevant screen positions.</li>
<li>The service validates and normalizes the result.</li>
<li>The client renders the instructions and annotations in place.</li>
</ol>
<p>An Act request adds planning, approved tool execution, and a local task-history record.</p>
<h2>Why This Architecture Works</h2>
<p>Cuepoint separates native desktop concerns, AI-provider concerns, and action execution.</p>
<p>Tauri owns shortcuts, capture, windows, and overlays. FastAPI owns model requests and structured processing. The user's provider performs multimodal reasoning. Optional action tools are introduced only when the user explicitly asks the system to act.</p>
<p>This separation makes the product easier to package, test, and extend. A new model provider can be added without redesigning the overlay, while visual guidance can improve without changing provider authentication.</p>
<h2>Current Limitations</h2>
<p>Screen-aware assistance still has practical limits:</p>
<ul>
<li>visual models can misidentify small or ambiguous controls</li>
<li>coordinate mapping becomes harder across multiple displays and scaling modes</li>
<li>UI changes can invalidate an action plan</li>
<li>browser automation requires additional dependencies</li>
<li>provider latency affects how immediate the experience feels</li>
<li>screenshots may contain sensitive information and should be reviewed before sending</li>
<li>complex or destructive actions require conservative user confirmation</li>
</ul>
<p>These limitations are why Cuepoint keeps distinct Ask, Guide, and Act modes instead of hiding every interaction behind a single autonomous agent.</p>
<h2>Conclusion</h2>
<p>Cuepoint combines a native Windows surface, local orchestration, multimodal reasoning, visual annotations, and controlled actions into one screen-aware workflow.</p>
<p>Its most important architectural decision is not simply the choice of Tauri or FastAPI. It is the separation between answering, guiding, and acting, with each mode receiving the context and control level it needs.</p>
<p>If you found the project useful, consider giving it a star.</p>
<p><a href="https://github.com/Kushal1213/cuepoint">GitHub - Kushal1213/cuepoint</a></p>
]]></content:encoded></item><item><title><![CDATA[understanding the architect behind veyra]]></title><description><![CDATA[Veyra is a voice intelligence platform designed for customer conversations in banking and insurance. The idea is simple: while an agent is speaking with a…]]></description><link>https://veyra-architecture.hashnode.dev/understanding-the-architect-behind-veyra</link><guid isPermaLink="true">https://veyra-architecture.hashnode.dev/understanding-the-architect-behind-veyra</guid><dc:creator><![CDATA[Kushal Choudhary]]></dc:creator><pubDate>Thu, 24 Sep 2026 15:32:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/f1921634-2343-4111-b94a-5806fdef372f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Veyra is a voice intelligence platform designed for customer conversations in banking and insurance. The idea is simple: while an agent is speaking with a customer, Veyra listens to the conversation, understands the customer’s intent, retrieves useful knowledge, suggests the next best action, and shows live insights on a dashboard.</p>
<p>At a high level, Veyra connects voice input, AI retrieval, realtime analytics, and agent assistance into one workflow.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6ab533d1edcc88a213deb52f/7d981e2e-71df-433e-a9a0-181faefcbe31.png" alt="" style="display:block;margin:0 auto" />

<pre><code class="language-text">Customer Voice
     ↓
Speech-to-Text
     ↓
Node.js API Gateway
     ↓
RAG Knowledge Service
     ↓
AI Response + Sources
     ↓
Voice Reply + Agent Dashboard

In parallel:
Conversation Transcript
     ↓
Realtime Insights Service
     ↓
Nudges, Risk Signals, Escalation Alerts
</code></pre>
<p><strong>Frontend Layer</strong></p>
<p>The frontend is built with React, Vite, Tailwind CSS, Framer Motion, and Recharts. It provides the main user interface for the voice demo, live transcript, insights dashboard, analytics views, and knowledge hub.</p>
<p>In the browser demo, Veyra uses the browser’s speech recognition API to convert customer speech into text. It also uses browser speech synthesis to speak the assistant’s answer back to the user. This makes the prototype easy to run without depending on a full telephony setup.</p>
<p>The frontend is responsible for showing:</p>
<ul>
<li><p>live conversation transcript</p>
</li>
<li><p>assistant responses</p>
</li>
<li><p>detected customer signals</p>
</li>
<li><p>suggested agent nudges</p>
</li>
<li><p>call/session state</p>
</li>
<li><p>analytics-style dashboards</p>
</li>
</ul>
<p><strong>API Gateway Layer</strong></p>
<p>The Node.js Express API gateway is the central coordination layer. It receives voice queries from the frontend, manages call sessions, sends conversation turns to the RAG service, and broadcasts realtime updates using Socket.IO.</p>
<p>This gateway keeps track of active sessions in memory. For each call, it stores things like customer name, intent, loan amount, income, frustration level, missing fields, and conversation turns.</p>
<p>The gateway has three major responsibilities:</p>
<ul>
<li><p>receive and validate user speech text</p>
</li>
<li><p>call the RAG service to get grounded answers</p>
</li>
<li><p>send transcript and insight updates to the frontend in realtime</p>
</li>
</ul>
<p>It also supports optional integration points such as Vapi custom LLM webhooks and Deepgram transcript routes, although the main browser demo uses browser speech recognition.</p>
<p><strong>RAG Knowledge Layer</strong></p>
<p>The RAG service is built with Python FastAPI. RAG stands for Retrieval-Augmented Generation. In Veyra, this means the system does not answer only from a generic model. Instead, it searches a knowledge base first and then uses the retrieved information to form an answer.</p>
<p>Veyra uses Google Gemini embeddings to convert text into vectors. These vectors are stored in FAISS, a fast similarity search engine. When a customer asks a question, the RAG service embeds the query, searches FAISS for the most relevant chunks, and returns an answer with source information.</p>
<p>For example, if a customer asks about a home loan, Veyra can retrieve relevant policy chunks about loan eligibility, tenure, rates, or documents and use them in the response.</p>
<p>The RAG layer includes:</p>
<ul>
<li><p>query embedding</p>
</li>
<li><p>vector similarity search</p>
</li>
<li><p>market-aware retrieval</p>
</li>
<li><p>answer synthesis</p>
</li>
<li><p>source citation</p>
</li>
<li><p>fallback handling when no strong match is found</p>
</li>
</ul>
<p><strong>Knowledge Ingestion Layer</strong></p>
<p>Before the RAG service can answer questions, documents need to be added to the knowledge base. That is handled by the ingestion service, also built with Python FastAPI.</p>
<p>The ingestion service can process:</p>
<ul>
<li><p>PDF files</p>
</li>
<li><p>website URLs</p>
</li>
<li><p>raw text</p>
</li>
</ul>
<p>It extracts text, breaks it into chunks, generates Gemini embeddings, and stores the vectors in FAISS along with metadata such as source, title, page, market, category, and version.</p>
<p>This design allows Veyra to be updated with new policy documents, FAQs, product brochures, compliance notes, or regional banking information.</p>
<p><strong>Realtime Insights Layer</strong></p>
<p>The realtime insights service analyzes conversation text while the call is happening. It is designed to help the agent notice important moments during the conversation.</p>
<p>This service uses rule-based detection with keyword patterns, regex rules, and conversation heuristics. It can identify signals such as:</p>
<ul>
<li><p>customer frustration</p>
</li>
<li><p>payment difficulty</p>
</li>
<li><p>buying intent</p>
</li>
<li><p>missed cross-sell opportunity</p>
</li>
<li><p>compliance disclosure gap</p>
</li>
<li><p>need for human escalation</p>
</li>
</ul>
<p>For example, if a customer says they are worried about monthly payments, the system may detect payment difficulty. If an agent discusses rates or fees without a required disclosure, it may raise a compliance nudge.</p>
<p>These nudges are sent back to the frontend through the gateway so the agent can respond while the conversation is still active.</p>
<p><strong>CRM And Session Layer</strong></p>
<p>Veyra also includes simple CRM-style functionality. It can create mock leads, callbacks, and customer records during a conversation. In the current prototype, this data is stored in memory using JavaScript maps.</p>
<p>This is useful for demonstrating how voice intelligence can connect to business workflows. For production, this layer could be connected to a real CRM like Salesforce, HubSpot, Zoho, or an internal banking CRM.</p>
<p><strong>End-to-End Flow</strong></p>
<p>A typical Veyra conversation works like this:</p>
<ol>
<li><p>A customer speaks into the browser.</p>
</li>
<li><p>The frontend converts speech to text.</p>
</li>
<li><p>The text is sent to the Node.js API gateway.</p>
</li>
<li><p>The gateway stores the user turn in the session.</p>
</li>
<li><p>The gateway sends the query to the RAG service.</p>
</li>
<li><p>The RAG service retrieves relevant knowledge from FAISS.</p>
</li>
<li><p>The system returns an answer with sources.</p>
</li>
<li><p>The frontend displays and speaks the answer.</p>
</li>
<li><p>In parallel, the realtime insights service checks the conversation for nudges.</p>
</li>
<li><p>The dashboard updates with live transcript, signals, and recommendations.</p>
</li>
</ol>
<p><strong>Why This Architecture Works</strong></p>
<p>Veyra uses separate services for separate responsibilities. The frontend handles the user experience, the gateway manages realtime coordination, the RAG service handles knowledge retrieval, the ingestion service manages document processing, and the insights service focuses on live call intelligence.</p>
<p>This separation makes the system easier to explain, test, and improve. For example, the RAG service can be upgraded without changing the frontend. The insights engine can become more advanced without rewriting the voice interface. A real CRM can be added later without changing the core conversation flow.</p>
<p><strong>Current Prototype Limitations</strong></p>
<p>The current version is a strong prototype, but it is not yet a full production system. Some parts are intentionally simple:</p>
<ul>
<li><p>session data is stored in memory</p>
</li>
<li><p>CRM data is mock data</p>
</li>
<li><p>realtime insights are rule-based</p>
</li>
<li><p>browser speech recognition depends on browser support</p>
</li>
<li><p>some dashboard analytics values are demo-style</p>
</li>
<li><p>escalation events are emitted, but not connected to real call transfer</p>
</li>
<li><p>production authentication, database storage, observability, and security hardening would still need to be added</p>
</li>
</ul>
<p><strong>Conclusion</strong></p>
<p>Veyra’s architecture combines voice interaction, RAG-based knowledge retrieval, realtime insights, and agent assistance into one practical system. It shows how AI can support customer-facing teams by helping them answer questions faster, detect customer intent, reduce missed opportunities, and improve compliance during live conversations.</p>
<p>Consider giving a STAR if u find it helpful.</p>
<p><a class="embed-card" href="https://github.com/Kushal1213/darwinxvapi">https://github.com/Kushal1213/darwinxvapi</a></p>
]]></content:encoded></item></channel></rss>