- Add comprehensive PRD documenting album system redesign - Update README with new features and setup instructions - Update package dependencies for new functionality - Add required packages for geolocation and enhanced editing - Document new album content structure and API changes - Include migration guide for existing data Documents the major architectural changes in this release. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
7.2 KiB
7.2 KiB
Product Requirements Document: Album System Redesign
Summary of Changes
This PRD outlines a comprehensive redesign of the album system to transform albums from simple photo containers into rich photographic stories with enhanced content capabilities. The key changes include:
- Many-to-Many Photo-Album Relationships: Enable a single photo to belong to multiple albums, providing greater flexibility in content organization
- Enhanced Photo Permalinks: Display all associated albums on individual photo pages for better context
- Refined Collection Views: Remove albums from public collection views while maintaining permalink access
- Rich Album Composer: Implement an essay-style composer for albums allowing mixed text and photo content
- Geo-Location Features: Add embedded map cards with point-of-interest markers for location-based storytelling
Task List by Phase
Additional Completed Tasks
- Add geolocation capability to Edra editor (allows adding maps to any rich text content)
Phase 1: Data Model Migration
- Create database migration to remove direct photo-album relationship
- Update schema to ensure AlbumMedia join table supports many-to-many relationships
- Add album content field to store rich text/media composition
- Create geo-location schema for map embedding (lat/lng, POI data)
- Write data migration script to preserve existing album-photo relationships
- Update all API endpoints to use new data model
Phase 2: Photo Management Updates
- Update photo permalink page to display associated albums
- Create UI component for album badges/links on photo pages
- Update photo API to fetch album associations
- Modify admin photo editor to manage album associations
- Create album selector component for photo editing
Phase 3: Album Composer Development
- Create new AlbumComposer component based on UniverseComposer
- Implement rich text editor with photo insertion capabilities
- Add photo browser/selector for inserting album photos
- Create preview mode for composed album content
- Implement auto-save functionality
- Add version history/drafts support
Phase 4: Geo-Location Features
- Design geo-card component with map embed
- Integrate mapping library (e.g., Mapbox, Leaflet)
- Create POI marker system with customizable popovers
- Add geo-location picker in composer
- Implement responsive map sizing
- Add fallback for non-JS environments
Phase 5: Frontend Updates
- Update album permalink pages to render composed content
- Remove albums from public collection views
- Update navigation/menus to reflect new album structure
- Implement new album listing page design
- Add SEO metadata for composed albums
- Update Universe feed album cards
Phase 6: Admin Interface Updates
- Replace current AlbumForm with new composer interface
- Update album list view in admin
- Add bulk operations for album-photo associations
- Create album analytics dashboard
- Implement permission controls for album editing
Implementation Plan
Technical Architecture
-
Database Structure:
model Album { id String @id slug String @unique title String content Json? // Rich content blocks geoLocations GeoLocation[] media AlbumMedia[] // ... existing fields } model Media { id String @id albums AlbumMedia[] // ... existing fields } model AlbumMedia { albumId String mediaId String displayOrder Int album Album @relation(...) media Media @relation(...) @@id([albumId, mediaId]) } model GeoLocation { id String @id albumId String latitude Float longitude Float title String description String? album Album @relation(...) } -
Content Block Structure:
type ContentBlock = | { type: 'text'; content: string } | { type: 'photo'; mediaId: string; caption?: string } | { type: 'photoGrid'; mediaIds: string[]; layout: 'masonry' | 'grid' } | { type: 'geoCard'; locationId: string } -
API Updates:
GET /api/media/[id]/albums- Get all albums for a photoPUT /api/albums/[id]/content- Update album composed contentPOST /api/albums/[id]/locations- Add geo-locationPUT /api/media/[id]/albums- Update photo's album associations
Migration Strategy
- Phase 1: Deploy database changes with backward compatibility
- Phase 2: Update APIs to support both old and new patterns
- Phase 3: Migrate frontend components incrementally
- Phase 4: Run data migration to new structure
- Phase 5: Remove deprecated code and fields
Possible Challenges
Technical Challenges
-
Data Migration Complexity:
- Risk of data loss during migration from direct relationships to join table
- Need to handle orphaned photos and maintain referential integrity
- Performance impact during migration on large datasets
-
Performance Considerations:
- Many-to-many queries could impact page load times
- Rich content rendering may require optimization
- Map embeds could slow down initial page loads
-
Content Editor Complexity:
- Building a robust WYSIWYG editor with photo insertion
- Handling drag-and-drop reordering of content blocks
- Ensuring responsive preview matches final output
-
Geo-Location Integration:
- Map API rate limits and costs
- Offline/fallback handling for maps
- Privacy concerns with location data
User Experience Challenges
-
Migration Path for Existing Users:
- Users may be confused by the new album structure
- Need clear communication about changes
- Potential breaking of bookmarked album URLs
-
Content Creation Learning Curve:
- More complex interface compared to simple photo upload
- Need intuitive UI for mixed content creation
- Balancing power vs simplicity
-
Navigation Changes:
- Albums no longer in collection views may confuse users
- Need alternative discovery methods for albums
- Maintaining SEO value of existing album pages
Operational Challenges
-
Storage and Bandwidth:
- Rich content will increase storage needs
- Map tiles and assets increase bandwidth usage
- Need efficient caching strategy
-
Content Moderation:
- More complex content requires better moderation tools
- Geo-location data needs privacy controls
- Version control for composed content
-
Backward Compatibility:
- API versioning to support existing integrations
- Gradual deprecation of old endpoints
- Supporting old album URLs with redirects
Mitigation Strategies
- Phased Rollout: Deploy features incrementally with feature flags
- Comprehensive Testing: Unit, integration, and end-to-end tests for all changes
- Performance Monitoring: Track query performance and optimize hot paths
- User Documentation: Create guides and tutorials for new features
- Rollback Plan: Maintain ability to revert to previous system if needed