Skip to main content

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โ€‹

QuestionAnswer
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.