Hybrid Storage Quick Start
Testing Strategyโ
Test 1: localStorage Mode Worksโ
# Don't start MongoDB
cd ui && npm run dev
Expected:
- โ Amber "Local Storage Mode" banner in sidebar
- โ Can create new conversations
- โ Conversations persist in browser localStorage
- โ No errors in console
Test 2: MongoDB Mode Worksโ
# Start MongoDB first
docker run -d --name caipe-mongo -p 27017:27017 mongo:7.0
# Configure and start UI
cd ui && npm run dev
Expected:
- โ No storage mode banner
- โ Can create new conversations
- โ Conversations visible across browser sessions
- โ Console shows: "Synced X conversations from MongoDB"
Test 3: Automatic Fallbackโ
# Start with MongoDB
docker run -d --name caipe-mongo -p 27017:27017 mongo:7.0
cd ui && npm run dev
# Create some conversations
# Stop MongoDB mid-session
docker stop caipe-mongo
# Try to create new conversation
Expected:
- โ Banner appears after ~1 minute
- โ New conversations still work (localStorage)
- โ No app crashes or errors
- โ Console shows: "Falling back to localStorage"
Summaryโ
| Question | Answer |
|---|---|
| Do I need MongoDB? | No! App works great with localStorage only |
| Should I use MongoDB? | Yes, for production. Optional for dev. |
| What if MongoDB fails? | App automatically falls back to localStorage |
| Can I switch modes? | Yes, anytime. Data remains accessible. |
| Is it complicated? | No! Automatic detection, zero config needed. |
Recommendation:
- ๐งช Development: localStorage mode (fast setup)
- ๐ญ Demos: localStorage mode (no infrastructure)
- ๐ Production: MongoDB mode (persistent, scalable)
For more details, see the hybrid storage documentation in the UI source code.
Relatedโ
- Architecture: architecture.md