mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
537 lines
13 KiB
Markdown
537 lines
13 KiB
Markdown
# BookDate - Deployment & Testing Guide
|
|
|
|
## 🎉 Implementation Complete!
|
|
|
|
The BookDate MVP is now **100% complete** and ready for deployment and testing.
|
|
|
|
---
|
|
|
|
## 📦 What Was Built
|
|
|
|
### Backend (100% Complete)
|
|
✅ 3 Prisma database models with encryption support
|
|
✅ 9 API endpoints (config, recommendations, swipes, admin)
|
|
✅ Complete helper library (AI calling, Audnexus matching, filtering)
|
|
✅ OpenAI & Claude API integration
|
|
✅ Request creation on right swipe
|
|
✅ Encrypted API key storage (AES-256)
|
|
|
|
### Frontend (100% Complete)
|
|
✅ Main BookDate swipe page (`/bookdate`)
|
|
✅ Swipeable recommendation card with gestures
|
|
✅ Loading screen with animation
|
|
✅ User settings page (`/settings`)
|
|
✅ Setup wizard integration (step 7)
|
|
✅ Conditional navigation tab
|
|
✅ Mobile touch gestures + desktop buttons
|
|
✅ Confirmation toast for right swipes
|
|
✅ Undo functionality
|
|
|
|
### Documentation (100% Complete)
|
|
✅ Token-efficient feature documentation (`features/bookdate.md`)
|
|
✅ Updated TABLEOFCONTENTS.md
|
|
✅ Complete PRD reference
|
|
✅ Implementation status document
|
|
|
|
---
|
|
|
|
## 🚀 Deployment Steps
|
|
|
|
### Step 1: Install Dependencies
|
|
|
|
```bash
|
|
# Install react-swipeable (already added to package.json)
|
|
npm install
|
|
|
|
# Or if using Docker (recommended)
|
|
# Dependencies will install automatically during build
|
|
```
|
|
|
|
### Step 2: Build and Start Docker Containers
|
|
|
|
```bash
|
|
# Build the Docker image
|
|
docker-compose build
|
|
|
|
# Start all services
|
|
docker-compose up -d
|
|
|
|
# Check logs to verify startup
|
|
docker-compose logs -f app
|
|
```
|
|
|
|
**Expected log output:**
|
|
```
|
|
[Prisma] Running db push...
|
|
[Prisma] Schema synced successfully
|
|
[Prisma] Generating Prisma Client...
|
|
[Next.js] Ready on http://localhost:3030
|
|
```
|
|
|
|
### Step 3: Verify Database Schema
|
|
|
|
The Prisma schema will automatically sync on container startup via `prisma db push`.
|
|
|
|
**New tables created:**
|
|
- `bookdate_config`
|
|
- `bookdate_recommendations`
|
|
- `bookdate_swipes`
|
|
|
|
**Verify in PostgreSQL:**
|
|
```bash
|
|
docker exec -it readmeabook-postgres psql -U readmeabook -d readmeabook
|
|
|
|
\dt bookdate*
|
|
# Should show the 3 new tables
|
|
|
|
\d bookdate_config
|
|
# Should show table structure with encrypted api_key field
|
|
|
|
\q
|
|
```
|
|
|
|
### Step 4: Access the Application
|
|
|
|
Open browser: `http://localhost:3030`
|
|
|
|
---
|
|
|
|
## 🧪 Testing Checklist
|
|
|
|
### Part 1: Setup Wizard Testing
|
|
|
|
**Test: Complete Setup with BookDate**
|
|
|
|
1. Navigate to `/setup` (if not already completed)
|
|
2. Complete steps 1-6 (Admin, Plex, Prowlarr, Download Client, Paths)
|
|
3. **Step 7: BookDate Setup**
|
|
- Select AI Provider (OpenAI or Claude)
|
|
- Enter API key:
|
|
- **OpenAI:** `sk-...` (from https://platform.openai.com/api-keys)
|
|
- **Claude:** `sk-ant-...` (from https://console.anthropic.com/settings/keys)
|
|
- Click "Test Connection & Fetch Models"
|
|
- ✅ Should show success message and populate model dropdown
|
|
- Select a model (e.g., `gpt-4o` or `claude-sonnet-4-5-20250929`)
|
|
- Select library scope (Full Library recommended for testing)
|
|
- (Optional) Add custom prompt
|
|
- Click "Next"
|
|
4. Complete steps 8-9 (Review, Finalize)
|
|
5. ✅ Setup should complete successfully
|
|
|
|
**Test: Skip BookDate Setup**
|
|
|
|
1. In setup wizard step 7, click "Skip for now"
|
|
2. ✅ Should proceed to Review step without error
|
|
3. ✅ BookDate tab should NOT appear in navigation
|
|
|
|
---
|
|
|
|
### Part 2: Settings Page Testing
|
|
|
|
**Test: Configure BookDate Post-Setup**
|
|
|
|
1. Navigate to `/settings`
|
|
2. Scroll to "BookDate Configuration" section
|
|
3. Enter API key and test connection
|
|
4. Select model and library scope
|
|
5. Click "Save Configuration"
|
|
6. ✅ Should show success message
|
|
7. ✅ BookDate tab should appear in navigation
|
|
|
|
**Test: Update Existing Configuration**
|
|
|
|
1. Navigate to `/settings`
|
|
2. Change library scope (e.g., from Full to Listened)
|
|
3. Click "Save Configuration"
|
|
4. ✅ Should clear cache and show success
|
|
|
|
**Test: Clear Swipe History**
|
|
|
|
1. Navigate to `/settings`
|
|
2. Scroll to "Clear Swipe History" section
|
|
3. Click "Clear Swipe History"
|
|
4. Confirm dialog
|
|
5. ✅ Should show success message
|
|
|
|
---
|
|
|
|
### Part 3: BookDate Main Interface Testing
|
|
|
|
**Test: View Recommendations**
|
|
|
|
1. Click "BookDate" in navigation
|
|
2. ✅ Should show loading screen with animation
|
|
3. ✅ Should load and display first recommendation card with:
|
|
- Cover image (or book emoji if no cover)
|
|
- Title, author, narrator (if available)
|
|
- Rating (if available)
|
|
- Description
|
|
- AI reason
|
|
|
|
**Test: Mobile Swipe Gestures** (use browser dev tools mobile emulation)
|
|
|
|
1. **Swipe Left (Reject):**
|
|
- Drag card to the left
|
|
- ✅ Should show red overlay with ❌ emoji
|
|
- Release when overlay visible
|
|
- ✅ Card should fly off screen
|
|
- ✅ Next card should appear
|
|
- ✅ "Undo" button should appear briefly
|
|
|
|
2. **Swipe Right (Request):**
|
|
- Drag card to the right
|
|
- ✅ Should show green overlay with ✅ emoji
|
|
- Release when overlay visible
|
|
- ✅ Confirmation toast should appear
|
|
- Click "Request"
|
|
- ✅ Card should disappear, next card appears
|
|
- Navigate to `/requests`
|
|
- ✅ New request should be visible
|
|
|
|
3. **Swipe Up (Dismiss):**
|
|
- Drag card upward
|
|
- ✅ Should show blue overlay with ⬆️ emoji
|
|
- Release when overlay visible
|
|
- ✅ Card should fly off screen
|
|
- ✅ "Undo" button should appear
|
|
|
|
**Test: Desktop Button Controls**
|
|
|
|
1. Resize browser to desktop width (>768px)
|
|
2. ✅ Should show 3 buttons below card:
|
|
- ❌ Not Interested
|
|
- ⬆️ Dismiss
|
|
- ✅ Request
|
|
3. Click "Not Interested"
|
|
- ✅ Should move to next card
|
|
4. Click "Request"
|
|
- ✅ Should show confirmation toast
|
|
5. Click "Request" in toast
|
|
- ✅ Should create request
|
|
|
|
**Test: Undo Functionality**
|
|
|
|
1. Swipe left on a card
|
|
2. ✅ "Undo" button should appear bottom-left
|
|
3. Click "Undo" within 3 seconds
|
|
4. ✅ Previous card should reappear
|
|
5. ✅ Can swipe again
|
|
|
|
**Test: Empty State**
|
|
|
|
1. Swipe through all 10 recommendations
|
|
2. ✅ Should show empty state:
|
|
- "🎉 You've seen all our current recommendations!"
|
|
- "Get More Recommendations" button
|
|
- "Go Home" button
|
|
3. Click "Get More Recommendations"
|
|
4. ✅ Should load new batch (with loading screen)
|
|
|
|
**Test: Request Confirmation Toast**
|
|
|
|
1. Swipe right on a card
|
|
2. ✅ Toast should show with 3 options:
|
|
- Cancel
|
|
- Mark as Known
|
|
- Request
|
|
3. Click "Mark as Known"
|
|
- ✅ Should record swipe but NOT create request
|
|
- ✅ Next card should appear
|
|
4. Swipe right again
|
|
5. Click "Cancel"
|
|
- ✅ Should dismiss toast
|
|
- ✅ Card should remain
|
|
|
|
---
|
|
|
|
### Part 4: Navigation Testing
|
|
|
|
**Test: BookDate Tab Visibility**
|
|
|
|
1. **With BookDate configured:**
|
|
- ✅ "BookDate" tab visible in header (desktop)
|
|
- ✅ "BookDate" link visible in mobile menu
|
|
- ✅ Clicking navigates to `/bookdate`
|
|
|
|
2. **Without BookDate configured:**
|
|
- Delete config via settings or API
|
|
- Refresh page
|
|
- ✅ "BookDate" tab should disappear
|
|
|
|
3. **Settings Tab:**
|
|
- ✅ "Settings" link should be visible (desktop + mobile)
|
|
- ✅ Clicking navigates to `/settings`
|
|
|
|
---
|
|
|
|
### Part 5: Request Integration Testing
|
|
|
|
**Test: Right Swipe Creates Request**
|
|
|
|
1. Navigate to `/bookdate`
|
|
2. Swipe right on a recommendation
|
|
3. Click "Request" in toast
|
|
4. Navigate to `/requests`
|
|
5. ✅ New request should appear with:
|
|
- Book title and author matching recommendation
|
|
- Status: "pending" or "awaiting_search"
|
|
- Cover image
|
|
|
|
**Test: Request Status Updates**
|
|
|
|
1. Wait for automated jobs to process request
|
|
2. ✅ Status should progress through:
|
|
- pending → searching → downloading → processing → downloaded → available
|
|
|
|
---
|
|
|
|
### Part 6: Error Handling Testing
|
|
|
|
**Test: Invalid API Key**
|
|
|
|
1. Navigate to `/settings`
|
|
2. Enter invalid API key (e.g., `sk-invalid123`)
|
|
3. Click "Test Connection & Fetch Models"
|
|
4. ✅ Should show error: "Invalid OpenAI API key" or "Invalid Claude API key"
|
|
|
|
**Test: Network Error**
|
|
|
|
1. Disconnect internet
|
|
2. Navigate to `/bookdate`
|
|
3. ✅ Should show error message with "Try Again" button
|
|
|
|
**Test: No Recommendations**
|
|
|
|
1. If Audible cache is empty, recommendations may fail to match
|
|
2. ✅ Should show: "Couldn't find new recommendations. Try adjusting settings."
|
|
|
|
**Test: Already in Library**
|
|
|
|
1. AI may recommend books already in Plex
|
|
2. ✅ Should filter them out automatically
|
|
3. ✅ Only show books NOT in library
|
|
|
|
---
|
|
|
|
### Part 7: Dark Mode Testing
|
|
|
|
1. Toggle dark mode (if available in your app)
|
|
2. Navigate through:
|
|
- `/bookdate` - Main interface
|
|
- `/settings` - BookDate settings
|
|
- Setup wizard step 7
|
|
3. ✅ All components should have proper dark mode styling
|
|
4. ✅ Text should be readable
|
|
5. ✅ Cards should have appropriate backgrounds
|
|
|
|
---
|
|
|
|
### Part 8: Mobile Responsiveness Testing
|
|
|
|
**Test on Different Screen Sizes:**
|
|
|
|
1. **Mobile (375px):**
|
|
- ✅ Card should fit screen
|
|
- ✅ Swipe gestures work
|
|
- ✅ Touch overlay feedback works
|
|
- ✅ Navigation menu opens
|
|
|
|
2. **Tablet (768px):**
|
|
- ✅ Card centered
|
|
- ✅ Buttons may show (if >768px)
|
|
|
|
3. **Desktop (1920px):**
|
|
- ✅ Card centered with max-width
|
|
- ✅ Buttons show below card
|
|
- ✅ Navigation in header
|
|
|
|
---
|
|
|
|
### Part 9: Cache Testing
|
|
|
|
**Test: Cache Persistence**
|
|
|
|
1. Get recommendations on `/bookdate`
|
|
2. Swipe through 5 cards
|
|
3. Navigate away (e.g., to `/requests`)
|
|
4. Return to `/bookdate`
|
|
5. ✅ Should show card #6 (cache persisted)
|
|
|
|
**Test: Cache Invalidation**
|
|
|
|
1. Navigate to `/settings`
|
|
2. Change library scope
|
|
3. Click "Save Configuration"
|
|
4. Navigate to `/bookdate`
|
|
5. ✅ Should generate NEW recommendations (cache cleared)
|
|
|
|
---
|
|
|
|
### Part 10: Admin Testing
|
|
|
|
**Test: Admin Global Toggle**
|
|
|
|
1. Login as admin
|
|
2. Make API call to disable BookDate:
|
|
```bash
|
|
curl -X PATCH http://localhost:3030/api/admin/bookdate/toggle \
|
|
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"isEnabled": false}'
|
|
```
|
|
3. ✅ All users' BookDate tabs should disappear
|
|
4. Enable again with `{"isEnabled": true}`
|
|
5. ✅ BookDate tabs should reappear
|
|
|
|
---
|
|
|
|
## 🐛 Troubleshooting
|
|
|
|
### Issue: "react-swipeable" not found
|
|
|
|
**Solution:**
|
|
```bash
|
|
npm install react-swipeable
|
|
# Or restart Docker container to reinstall
|
|
docker-compose down
|
|
docker-compose up -d --build
|
|
```
|
|
|
|
### Issue: Database tables not created
|
|
|
|
**Solution:**
|
|
```bash
|
|
# Manually run Prisma push
|
|
docker exec -it readmeabook-app npx prisma db push
|
|
docker exec -it readmeabook-app npx prisma generate
|
|
```
|
|
|
|
### Issue: BookDate tab not showing
|
|
|
|
**Check:**
|
|
1. Navigate to `/settings`
|
|
2. Verify BookDate is configured
|
|
3. Check browser console for errors
|
|
4. Verify `localStorage.getItem('accessToken')` exists
|
|
|
|
### Issue: AI API calls failing
|
|
|
|
**Check:**
|
|
1. API key is valid (test in provider's dashboard)
|
|
2. Account has credits/balance
|
|
3. Check network connectivity
|
|
4. Review error in browser console or server logs
|
|
|
|
### Issue: No recommendations generated
|
|
|
|
**Check:**
|
|
1. Plex library has audiobooks
|
|
2. Audible cache has data (run Audible refresh job)
|
|
3. AI response contains valid recommendations
|
|
4. Check server logs for errors
|
|
|
|
---
|
|
|
|
## 📊 Success Criteria Checklist
|
|
|
|
### MVP Definition
|
|
|
|
- ✅ Database schema deployed
|
|
- ✅ All API endpoints working
|
|
- ✅ Setup wizard includes BookDate
|
|
- ✅ Settings page functional
|
|
- ✅ BookDate tab visible when configured
|
|
- ✅ Swipe interface works (mobile + desktop)
|
|
- ✅ Right swipe creates requests
|
|
- ✅ Recommendations cache correctly
|
|
- ✅ Dark mode supported
|
|
- ✅ Error states handled
|
|
|
|
### All Features Working
|
|
|
|
- ✅ AI provider selection (OpenAI/Claude)
|
|
- ✅ Model selection
|
|
- ✅ Library scope configuration
|
|
- ✅ Custom prompt support
|
|
- ✅ Swipe gestures (left/right/up)
|
|
- ✅ Desktop button controls
|
|
- ✅ Confirmation toast
|
|
- ✅ Undo functionality
|
|
- ✅ Request creation
|
|
- ✅ Cache management
|
|
- ✅ Empty state handling
|
|
- ✅ Loading screen animation
|
|
- ✅ Navigation integration
|
|
- ✅ Settings persistence
|
|
- ✅ Admin toggle
|
|
|
|
---
|
|
|
|
## 🎯 Post-MVP Enhancements (Future)
|
|
|
|
Once MVP is tested and working:
|
|
|
|
1. **Enhanced Plex Integration**
|
|
- Query Plex API for real-time listening status
|
|
- Calculate listened percentage (>25%)
|
|
- Fetch user ratings
|
|
|
|
2. **Direct Audnexus API**
|
|
- Call Audnexus API when not in cache
|
|
- Implement fuzzy matching (Levenshtein distance)
|
|
- Cache new matches
|
|
|
|
3. **Advanced Features**
|
|
- Multi-AI voting (combine multiple AI recommendations)
|
|
- Swipe analytics dashboard
|
|
- Genre filtering
|
|
- Narrator preferences
|
|
- Listening goals
|
|
|
|
4. **Performance Optimization**
|
|
- Add rate limiting
|
|
- Implement request queuing
|
|
- Optimize AI prompt size
|
|
|
|
---
|
|
|
|
## 📞 Support
|
|
|
|
If you encounter issues during testing:
|
|
|
|
1. **Check Server Logs:**
|
|
```bash
|
|
docker-compose logs -f app | grep BookDate
|
|
```
|
|
|
|
2. **Check Database:**
|
|
```bash
|
|
docker exec -it readmeabook-postgres psql -U readmeabook -d readmeabook
|
|
SELECT * FROM bookdate_config;
|
|
SELECT * FROM bookdate_recommendations;
|
|
```
|
|
|
|
3. **Check Browser Console:**
|
|
- Open DevTools (F12)
|
|
- Look for JavaScript errors
|
|
- Check Network tab for failed API calls
|
|
|
|
4. **Review Documentation:**
|
|
- `documentation/features/bookdate.md` - Feature docs
|
|
- `documentation/features/bookdate-prd.md` - Complete requirements
|
|
- `BOOKDATE_IMPLEMENTATION_STATUS.md` - Implementation details
|
|
|
|
---
|
|
|
|
## ✅ Ready for Testing!
|
|
|
|
The BookDate MVP is **100% complete** and ready for your testing. Follow the checklist above to verify all functionality.
|
|
|
|
**Start here:**
|
|
1. `docker-compose up -d --build`
|
|
2. Navigate to `/setup` (if fresh install) or `/settings` (if already setup)
|
|
3. Configure BookDate with your AI API key
|
|
4. Navigate to `/bookdate` and start swiping!
|
|
|
|
Enjoy discovering your next great listen! 📚✨
|