I built a local-first AI prompt manager — here is why offline-first was worth the extra complexity
Source: Dev.to
The Problem
Every developer who uses AI tools daily faces the same issue:
- You write a prompt that works perfectly.
- You get exactly the output you need from Claude, Cursor, or ChatGPT.
- You close the tab.
A week later the same problem resurfaces, and you spend 20 minutes trying to reconstruct that prompt from memory.
Introducing PromptVault
I built PromptVault, a local‑first prompt manager that works offline, includes a browser extension for any AI tool, and offers AI‑assisted features to help you write better prompts.
Why Not a Traditional Backend?
The obvious approach would be to create a database, a backend, user accounts, and store everything server‑side. I chose not to for two reasons:
- Privacy – Developers don’t trust tools that store their prompts in someone else’s database. Prompts contain your entire thinking process, preferred approaches, and project context, which are sensitive.
- Performance – A local‑first app is faster. There’s no round‑trip to a server, search is instant, the vault opens immediately, and it works on a plane.
Trade‑offs and Sync Architecture
Complexity
Offline‑first means handling sync conflicts, queued operations, and cases where the same data is modified on two devices.
Write Operations Queue
Every write operation (create, update, delete) is added to a local sync queue stored in IndexedDB. Each entry records:
- Operation type
- Entity ID
- Full payload
When the app goes online, it flushes the queue to Supabase in order. If a sync operation fails, it retries up to three times with exponential backoff. After three failures, the entry is removed and the error is logged.
Conflict Resolution
Conflicts are resolved with Last‑Write‑Wins based on the updatedAt timestamp. This simple strategy works for our use case—editing the same prompt on two devices at the exact same moment is extremely rare.
Browser Extension (Chrome MV3)
The extension injects a small ⚡ button into text fields on sites such as claude.ai, chatgpt.com, and any page with a “ or contenteditable element.
- Click the button → a mini search popup reads from PromptVault’s local IndexedDB.
- Select a prompt → it pastes directly into the active field, eliminating the need to switch windows.
AI‑Powered Features (BYOK)
PromptVault uses BYOK – Bring Your Own Key. You configure your provider (Claude, GPT‑5, Gemini, Groq, or any OpenAI‑compatible endpoint) in Settings. The app calls your provider directly, so no data passes through PromptVault’s infrastructure.
Main AI Features
- Vibe Mode – transforms a rough idea into a structured prompt.
- Prompt Improver – four modes to refine prompts.
- Variant Generator – creates concise, detailed, or reframed versions.
- Debugger – runs five checks on any prompt.
Pricing
- Free tier – 100 prompts with all features; no account required to start.
- Pro – $9 /month for unlimited prompts and cross‑device sync.
Contact
Happy to answer questions about the architecture in the comments.