← back to Dear Bubbe Nextjs
USER_PROFILES_SETUP.md
139 lines
# User Profiles & Personalization - Complete Setup
## ✅ Implementation Complete!
Bubbe now gets to know each user personally through a mandatory onboarding flow after Google sign-in. This makes her responses MUCH more personalized and invasive!
## Features Added
### 1. **Mandatory Google Sign-In**
- Users MUST sign in with Google to use Bubbe
- Provides authenticated user identity
- Enables personalized experience
### 2. **6-Step Onboarding Flow**
After first sign-in, users answer:
1. **Preferred Name** - What Bubbe should call them
2. **Gender** - Male/Female/Other/Prefer not to say
3. **Relationship Status** - Single/Dating/Engaged/Married/Divorced/etc
4. **Age/Birth Year** - For age-specific guilt trips
5. **Religious Level** - Very/Somewhat/Not Very/Secular/Atheist
6. **Children** - Yes/No and how many
### 3. **Personalized Responses**
Bubbe now uses this information to:
- Call users by their preferred name
- Guilt single users about not being married
- Guilt married users about not having kids
- Guilt secular users about abandoning tradition
- Compare them to their "cousins" based on their age
- Make specific invasive questions based on their status
### 4. **Profile Storage**
- Profiles saved to `/data/profiles/` directory
- File-based storage (can upgrade to database later)
- Persistent across sessions
## How It Works
### User Flow:
1. User visits https://www.bubbe.ai
2. Clicks "Sign in with Google"
3. Authorizes with Google account
4. **NEW**: Onboarding modal appears (first time only)
5. User completes 6-step questionnaire
6. Profile saved, personalized Bubbe experience begins
### Technical Implementation:
#### Components Created:
- `/components/UserOnboarding.tsx` - 6-step onboarding UI
- `/lib/types/user.ts` - User profile TypeScript types
- `/app/api/user-profile/route.ts` - Profile save/load API
#### Modified Files:
- `/app/page.tsx` - Added profile check and onboarding display
- `/app/api/chat/route.ts` - Enhanced with profile personalization
## Example Personalized Responses
### For Single User (Age 32):
**Before**: "So when are you getting married already?"
**After**: "David, you're 32 and STILL single?! Your cousin got married at 25! What's wrong with you?"
### For Married Without Kids:
**Before**: "Why no kids yet?"
**After**: "Sarah, you've been married 3 years and NO KIDS?! What are you waiting for, the Messiah?!"
### For Non-Religious User:
**Before**: "You should go to temple more!"
**After**: "Michael, an atheist?! OY GEVALT! Your grandmother is spinning in her grave!"
## Profile Data Structure
```typescript
{
id: string // Google user ID
email: string // From Google
name: string // From Google
preferredName: string // What they want to be called
gender: string // Their gender
relationshipStatus: string // Single/married/etc
birthYear: number // For calculating age
age: number // Calculated from birth year
religiousLevel: string // How religious they are
hasKids: string // yes/no
numberOfKids: number // If they have kids
onboardingCompleted: boolean
createdAt: Date
updatedAt: Date
}
```
## Testing Instructions
1. Sign out if currently signed in
2. Sign in with Google
3. Complete the 6-step onboarding
4. Chat with Bubbe - she'll now use your name and personal info
5. Sign out and sign in again - profile persists
## Privacy & Security
- Profiles stored locally on server
- No data shared with third parties
- Google OAuth for secure authentication
- Users can skip onboarding (but Bubbe will guilt them!)
## Future Enhancements
1. **Edit Profile** - Let users update their info
2. **Profile Dashboard** - Show user stats
3. **Conversation History** - Save chats per user
4. **Preferences** - Voice speed, Yiddish level, etc
5. **Database Storage** - PostgreSQL/MongoDB for scale
6. **Export/Delete** - GDPR compliance
## Files Created/Modified
### New Files:
- `/components/UserOnboarding.tsx`
- `/lib/types/user.ts`
- `/app/api/user-profile/route.ts`
- `/data/profiles/` (directory for profiles)
### Modified Files:
- `/app/page.tsx` (added onboarding flow)
- `/app/api/chat/route.ts` (personalization logic)
## Live at https://www.bubbe.ai
Users must now:
1. Sign in with Google
2. Complete onboarding
3. Get roasted by name!
---
**Status**: ✅ COMPLETE & DEPLOYED
**Date**: November 19, 2024