惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
U
Unit 42
腾讯CDC
D
Docker
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
I
InfoQ
Jina AI
Jina AI
爱范儿
爱范儿
宝玉的分享
宝玉的分享
博客园 - Franky
G
Google Developers Blog
P
Proofpoint News Feed

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Build a Private AI Search on Your Device: Local RAG in th...
Pure Life Tr · 2026-05-27 · via DEV Community
Cover image for Build a Private AI Search on Your Device: Local RAG in the Browser

Pure Life Tribe

How many times have you wanted to search your private PDFs, notes, or code files using AI, but hesitated?

We all want the power of AI search. But uploading sensitive documents to external servers is a big privacy risk.

What if you could build a complete search engine that runs 100% inside your browser? No servers, no APIs, and no cost.

At Utilora, we built exactly this. We call it Personal RAG. Here is how we made it work, and how you can do it too.

The Architecture: How to Run RAG on a Web Page

Retrieval-Augmented Generation (RAG) usually requires a backend database, python servers, and API keys. To make it run entirely on the client side, we

combined three modern browser technologies:

  1. Origin Private File System (OPFS): A fast, private storage space in the browser to save indexed document vectors.
  2. Web Workers & Comlink: To run CPU-heavy vector searches without freezing the user interface.
  3. Local Machine Learning Models: Using ONNX Runtime Web and Transformers.js to generate embeddings directly on your CPU or GPU.

Here is the exact flow of how a document is processed:

[ Your File ] ➔ [ Client Parser ] ➔ [ Chunking ] ➔ [ Local ML Embedding ] ➔ [ OPFS Storage ]

Step 1: Storing Vectors Privately (OPFS)

You cannot store millions of text numbers in normal browser storage like LocalStorage. It is too slow and has a 5MB limit.

Instead, we use the Origin Private File System (OPFS). It gives web
apps a private, highly optimized filesystem. Here is a simple look at how we write vector indexes to OPFS:

// Access the private root directory                                                                                                                     
const root = await navigator.storage.getDirectory();                                                                                                     

// Create or access our index file                                                                                                                       
const fileHandle = await root.getFileHandle("vector-index.db", { create: true });                                                                        

// Create a high-speed write stream                                                                                                                      
const accessHandle = await fileHandle.createWritable();                                                                                                  
await accessHandle.write(new TextEncoder().encode(JSON.stringify(myVectorData)));                                                                        
await accessHandle.close();

Enter fullscreen mode Exit fullscreen mode

Step 2: Offloading Work to a Web Worker

We use Comlink by Google to easily communicate with a background Web Worker:

// In your main component
import * as Comlink from "comlink";

const worker = new Worker(
    new URL("./rag-indexer.worker.ts", import.meta.url),
    { type: "module" }
);
const localIndexer = Comlink.wrap(worker);

// Run indexer in the background
await localIndexer.processAndEmbedFile(myUploadedFile);

Enter fullscreen mode Exit fullscreen mode

Why Local RAG is a Game Changer

Building with zero backend constraints completely changes how you think about software:

• True Privacy: Privacy is not a text policy on a page. It is hardcoded into the architecture. Since there is no backend, we cannot see your files even if
we wanted to.
• Completely Free: You do not pay for API keys, vector databases, or server hosting. The user's computer does all the work.
• Instant Offline Access: Once the page loads, you can turn off your internet and it still works.

Try It Yourself

If you want to see this in action, come check it out on Utilora https://utilora.com (our free, open collection of local web utilities).

Drag in a PDF, let it index, and ask questions. Your data never leaves your screen.

Have you built anything using local browser models? Let's chat in the comments below!