Reframe
AI-assisted habit recovery with guaranteed client-side privacy.
Overview & Impact
The Problem & The System Solution
The Problem
Habit recovery tools often rely on generic advice and require users to share sensitive personal data without meaningful privacy protections.
The System Solution
Built a personalized application with a multidimensional weighted assessment, Gemini-powered support, a real-time urge interruption feature, encrypted client-side data handling, anonymous authentication, offline-first PWA support, and progress visualization.
Habit recovery is deeply personal. Users share their triggers, patterns, and struggles with apps that store this data in plaintext on remote servers — often with minimal security guarantees. This is a privacy failure that undermines trust in the tools designed to help.
Reframe was built with a privacy-first guarantee: all personal journal entries and habit data are encrypted in the user's browser using the Web Crypto API before ever touching Firebase Firestore. The server receives only ciphertext it cannot read.
Beyond privacy, the app provides evidence-backed behavioral interventions — urge surfing, cognitive reframing, and progress visualization — powered by Gemini 2.0 Flash with carefully designed prompt boundaries that prevent the AI from overstepping into medical advice.
Architecture & System Flow
System Design Visualizer
Reframe Encryption & Boundary Guardrails
Step-by-Step System Execution Payload
Client Storage Security Layer
User Entry → Client-Side AES Encryption
Key Engineering Decisions
All sensitive assessment and journal data is encrypted on the client using AES-GCM before entering remote storage.
Gemini prompt boundaries explicitly restrict medical diagnosis while providing empathetic, evidence-backed behavioral interventions.
Offline-first indexedDB storage ensures immediate app responsiveness during high-stress urge interruption events.
Technology Stack
Production Technologies
Full-stack PWA framework with App Router and Server Components
Progress visualization: streaks, triggers, and recovery milestones
Responsive mobile-first UI styling
Browser-native AES-GCM encryption and PBKDF2 key derivation
Fast, safety-bounded AI for behavioral support and urge interventions
Remote encrypted storage with real-time sync capabilities
Edge deployment with global CDN for fast load times
Features & Capabilities
What It Does
Client-Side Encryption
AES-GCM 256-bit encryption in the browser. Server receives only ciphertext.
AI Support
Gemini 2.0 Flash provides personalized behavioral interventions within safety guardrails.
Urge Interruption
Real-time micro-interactions: breathing exercises, cognitive reframes, urge surfing.
Offline-First PWA
Works without internet. IndexedDB + Service Worker ensures always-available access.
Progress Tracking
Recharts visualizations of streak data, trigger patterns, and recovery milestones.
Anonymous Auth
Firebase anonymous authentication — no email or personal data required to start.
Workflow Pipeline
Step-by-Step System Flow
Weighted Assessment
User completes multidimensional onboarding assessment. Scores determine personalized plan.
PBKDF2 Key Derivation
User passphrase processed through PBKDF2 to derive AES-GCM encryption key. Never leaves device.
Client-Side Encryption
All journal entries and habit data encrypted in browser using Web Crypto API before write.
Firebase Storage
Only ciphertext reaches Firebase Firestore. Server has zero access to plaintext.
Urge Interruption
Real-time micro-interaction tools: breathing timer, cognitive reframes, urge surfing exercises.
AI Support
Gemini 2.0 Flash provides evidence-backed behavioral support within defined safety boundaries.
Offline Sync
IndexedDB stores data locally when offline. Service worker syncs to Firebase on reconnect.
Progress Visualization
Recharts renders streak data, trigger patterns, and recovery milestones from decrypted local data.
Interface & Dashboard
Reframe Interface
Analytics Dashboard
Conversation View
Engineering Challenges
Hard Problems Solved
The Problem
Web Crypto API operations are asynchronous. Encrypting every journal write and decrypting every read needed to be imperceptible to the user.
Engineering Solution
Implemented a crypto service layer that batches encryption operations and uses IndexedDB as a local cache of decrypted data, only hitting the crypto API on writes and first reads.
Results & Evaluation
What Was Achieved
Future Roadmap
What's Next
6 planned features · Active development
Source Code
GitHub Repository & Codebase
A full-stack AI-assisted behavioral support application designed around personalized assessment, real-time urge interruption, privacy-first storage, offline access, and visual progress tracking.