-
-
Zero-Leak Access Gate: Authenticates sessions with SHA-256 timing-safe tokens and HttpOnly cookies before loading any vault records.
-
Structured Receipt Ledger: Automatically parses merchant names, minor-unit totals, tax, and recurring subscription flags.
-
Return & Warranty Deadline Alerts: Tracks active return windows and exports standards-compliant .ics reminders directly to your calendar.
-
Grounded AI Vault Chat: Ask natural-language questions about return windows and spending, powered by our 4-tier Gemini + Groq cascade.
-
Encrypted Personal Vault & Backup: Client-side passphrase protection and portable vault archives running identically on macOS and Cloudflare
-
KeepSafe Vault Dashboard: Overview of encrypted receipts, active return countdowns, and a drag-and-drop ingestion zone.
Inspiration
Every year, people lose hundreds of dollars to missed return windows, forgotten recurring subscriptions, and buried warranty proofs scattered across email inboxes, camera rolls, and paper drawers. Existing receipt scanners force you to surrender sensitive financial history to third-party cloud databases—or break completely when a single AI provider throttles or goes down.
We built KeepSafe to solve both problems at once: a zero-leak, encrypted personal vault that automatically extracts structured financial and deadline data, answers natural-language questions over your documents, and runs identically on your local Mac and at the global edge on Cloudflare Workers.
Judge Onboarding: Explore the Interactive Demo in 5 Steps
We deployed a dedicated Judge Sandbox on Cloudflare Workers pre-configured with Demo Mode, while keeping our personal production vault (https://papertrail.prathamup123.workers.dev) strictly locked behind a 401 cryptographic gate.
Step 1: Launch & Authenticate (1 Click)
- Open the Live Judge Sandbox:
https://keepsafe-demo.prathamup123.workers.dev/?token=keepsafe-judge-2b5ae5dde47fa27887df6069 - Mock Access Token (if prompted):
keepsafe-judge-2b5ae5dde47fa27887df6069 - What happens under the hood: KeepSafe validates the token using SHA-256 constant-time comparison, issues an
HttpOnly+Securesession cookie, and strips the token from the URL bar so it never leaks in browser history or referrers.
Step 2: Upload & Auto-Parse a Receipt
- Drag any PDF invoice or receipt image into the Add receipts dropzone (or click to select a file).
- What to look for: KeepSafe automatically extracts the merchant name, purchase date, currency, minor-unit totals, tax, line items, recurring billing flags, and exact return/warranty deadlines—and flags receipts that need manual review.
Step 3: Ask Natural-Language Questions in Vault Chat
- Open the Chat panel and try asking:
- "Which purchases still have active return windows right now?"
- "Summarize my spending by merchant and flag any warranties expiring soon."
- What to look for: Every answer is grounded strictly in your vault records with transparent citations, routed through our 4-tier cascading AI pipeline (
gemini-4-hydrogen→gemini-3.8-flash→groq/openai/gpt-oss-120b→groq/openai/gpt-oss-20b→ deterministic Offline Vault Mode).
Step 4: Export Return & Warranty Deadlines to Calendar (.ics)
- Click into any receipt card that has a return or warranty window and select Add to Calendar (or visit
/api/calendar.ics). - What to look for: Instant download of a standards-compliant
.icscalendar file so return deadlines never slip past unnoticed.
Step 5: Test Encrypted Backup, Vault Lock & Live Edge Security
- Encrypted Portability: Click Export / Backup to download an encrypted portable vault archive.
- Instant Session Lock: Click Lock Vault to invalidate your session cookie and immediately re-engage the access gate.
- Verify Live Production
401Gate: Runcurl -i https://papertrail.prathamup123.workers.dev/api/chatin your terminal to confirm that unauthenticated requests to the private production vault are blocked with401 Unauthorizedand strict CSP /X-Frame-Options: DENY/nosniffsecurity headers.
What it does
| Capability | How KeepSafe Works |
|---|---|
| Zero-Leak Encrypted Vault | Stores receipts, invoices, and warranty proofs with passphrase-protected encryption, SHA-256 timing-safe token verification, and encrypted portable backups. |
| Structured Receipt Extraction | Parses merchant, purchase date, currency, minor-unit totals, tax, tip, line items, recurring charges, return terms, and warranty terms from PDFs and images. |
| Grounded Vault AI Chat | Answers natural-language spending, item, and deadline queries strictly from indexed vault documents with transparent source citations. |
| 4-Tier AI Failover Chain | Cascades across Gemini and Groq LPU models down to a deterministic Offline Vault Mode so search never fails during API spikes or offline travel. |
| Dual-Runtime Sync | Runs identically as a background macOS LaunchAgent (with Finder Quick Actions + Watch Folder) and on Cloudflare Workers + D1 (15 ms startup). |
| Calendar & PWA Support | Generates .ics deadline feeds and installs as a mobile/desktop Progressive Web App with Web Share Target support. |
How we built it
Dual-Runtime Architecture
[Web / PWA Dropzone] ──┐
[macOS Watch Folder] ──┼──> [Timing-Safe Auth + Sliding-Window Rate Limiter]
[Finder / Email Share] ┘ │
├──> [macOS Node.js + SQLite Vault]
└──> [Cloudflare Workers + D1 Edge]
│
▼
[Structured Parser + 4-Tier AI Router]
4-Tier Cascading AI Pipeline
Every extraction and natural-language chat query runs through a strict timeout-bounded cascade:
Tier 1: gemini-4-hydrogen (x-goog-api-key header auth)
└─ on timeout / 429 / 5xx ──> Tier 2: gemini-3.8-flash (multimodal fallback)
└─ on error ──> Tier 3: groq/openai/gpt-oss-120b
└─ on error ──> Tier 4: groq/openai/gpt-oss-20b
└─ offline ──> Offline Vault Mode
- Frontend & PWA: Built with Next.js 15, React, and TypeScript, packaged as an installable PWA with responsive mobile/desktop layouts and Web Share Target support.
- Defense-in-Depth Security: Hardened with SHA-256 constant-time token verification,
HttpOnly/Securecookies, per-endpoint sliding-window rate limiting across 9 API routes, passphrase header guards, strict Content Security Policy (CSP), and edge_headers.
Challenges we ran into
- Dual-Runtime Parity (Node.js vs. Cloudflare Workers): Keeping identical cryptography, SQLite/D1 queries, file ingestion, and streaming responses working seamlessly across both a local macOS background daemon and Cloudflare's 128 MB memory-constrained Worker isolate required strict payload limits (
25 MBupload /40 KBchat) and clean runtime adapters. - Eliminating Secret Leaks & Rate-Limit Bypasses: During our security audit, we removed API keys from query strings, prevented
x-forwarded-forspoofing viacf-connecting-ipdetection, added shared passphrase header guards, and verified isolation across 1,364 automated tests. - Zero-Downtime AI Resilience: Ensuring upstream
429or503spikes never surface raw stack traces or blank screens to users required tuning per-tier timeouts and clean fallback status indicators in the UI.
Accomplishments that we're proud of
- 1,364 Passing Automated Tests covering cryptography, receipt extraction, D1/SQLite storage, rate limiting, and multi-tier AI failover.
- 15 ms Edge Startup & Sub-Second Failover: Achieved
15 msWorker startup times on Cloudflare and sub-second Groq fallback responses when primary models throttle. - Production-Grade Security Hygiene: Full CSP headers, edge
_headers, rate-limited endpoints, and zero-leak secret handling ready for daily personal use.
What we learned
Building a privacy-first AI product means treating reliability and security as core UX features, not afterthoughts. Combining deterministic local fallbacks with multi-provider LLM routing makes AI tools feel instantaneous and trustworthy—even offline or under heavy API load.
What's next for KeepSafe
- Encrypted Cross-Device Delta Sync: Seamless end-to-end encrypted synchronization between the macOS desktop daemon and Cloudflare D1.
- Automated Email & IMAP Receipt Ingestion: Direct forwarding rules that automatically parse digital order confirmations the moment they arrive.
- Proactive Return & Warranty Alerts: Smart push notifications 48 hours before a return window closes or a warranty expires.