A complete public share route for research sessions at /researchSession/[shareId] with full social media preview support (Open Graph + Twitter Cards).
-
/api/researchSession/[shareId].js(270 lines)- Vercel serverless function for server-side rendering
- Fetches metadata from backend API
- Generates HTML with meta tags for social scrapers
- Redirects human users to React app
- Handles 404 and error cases
-
/vercel.json- Routes
/researchSession/:shareIdto the serverless function - Sets caching headers for optimal performance
- Routes
-
/docs/SHARED_RESEARCH_SESSIONS.md- Complete documentation of the feature
- Setup instructions, testing guide, troubleshooting
-
/src/services/researchSessionShareService.ts- Added
fetchSharedResearchSession()function - Fetches public shared sessions from backend
- Added
-
/src/components/SearchInterface.tsx- Added import for
fetchSharedResearchSession - Added useEffect to detect
?sharedSession=<shareId>parameter - Loads shared session data and displays in galaxy view
- Added import for
Add these to Vercel:
BACKEND_BASE_URL=https://your-backend-url
NEXT_PUBLIC_FRONTEND_URL=https://pullthatupjamie.aiUser shares link → /researchSession/abc123
↓
Vercel serverless function fetches metadata
↓
Returns HTML with Open Graph + Twitter meta tags
↓
Scraper displays rich preview with title, description, image
User clicks link → /researchSession/abc123
↓
HTML with meta tags loads (for scrapers)
↓
JavaScript redirect → /app?sharedSession=abc123
↓
React app loads shared session in galaxy view
↓
User can interact with full research session
- Title: From
data.title - Description: From
data.description - Image: From
data.previewImageUrl - URL:
https://pullthatupjamie.ai/researchSession/:shareId - Twitter Card:
summary_large_image
# Terminal 1: Start backend
cd backend && npm start # Port 4132
# Terminal 2: Start Vercel dev server
vercel dev # Port 3000Visit: http://localhost:3000/researchSession/test-id
- Twitter: https://cards-dev.twitter.com/validator
- Facebook: https://developers.facebook.com/tools/debug/
- LinkedIn: https://www.linkedin.com/post-inspector/
Your backend must implement:
GET /api/shared-research-sessions/:shareId
Response format:
{
"success": true,
"data": {
"title": "Session Title",
"description": "Session Description",
"previewImageUrl": "https://cdn.example.com/image.png",
"nodes": [
{
"pineconeId": "id",
"x": 0.5, "y": 0.3, "z": 0.1,
"color": "#ffffff",
"metadata": {
"quote": "...",
"summary": "...",
"episode": "...",
"creator": "...",
"hierarchyLevel": "paragraph"
}
}
]
}
}- ✅ Public route at
/researchSession/[shareId] - ✅ Server-rendered meta tags (not client-side)
- ✅ Open Graph tags for social media
- ✅ Twitter Card tags with
summary_large_image - ✅ Works with link preview scrapers (X, Slack, iMessage)
- ✅ Fetches from backend API
- ✅ 404 handling for missing sessions
- ✅ Interactive view for human users
- ✅ Minimal, production-safe code
- ✅ No changes to unrelated routing
-
Commit the changes:
git add . git commit -m "Add shared research sessions public route with SSR meta tags"
-
Set Vercel environment variables:
- Go to Vercel dashboard → Project → Settings → Environment Variables
- Add
BACKEND_BASE_URLwith your production backend URL - Add
NEXT_PUBLIC_FRONTEND_URLashttps://pullthatupjamie.ai
-
Deploy:
git push
Or deploy via Vercel dashboard
-
Test:
- Share a link:
https://pullthatupjamie.ai/researchSession/test-id - Verify meta tags: View Page Source
- Test social preview: Use validator tools above
- Share a link:
Meta tags not showing?
- View page source - meta tags should be in initial HTML
- Check serverless function logs in Vercel
- Verify backend API is accessible
404 errors?
- Ensure
vercel.jsonis committed - Check that
/apifolder exists in project root - Verify function file path matches route pattern
React app not loading session?
- Check browser console for errors
- Verify
?sharedSessionquery parameter - Check network tab for API requests
See /docs/SHARED_RESEARCH_SESSIONS.md for complete documentation.