- Implement PostgreSQL database schema with users and bookmarks tables - Add database connection pooling with retry logic and error handling - Create migration system with automatic schema initialization - Add database CLI tools for management (init, status, validate, etc.) - Include comprehensive error handling and diagnostics - Add development seed data and testing utilities - Implement health monitoring and connection pool statistics - Create detailed documentation and troubleshooting guide Database features: - Users table with authentication fields and email verification - Bookmarks table with user association and metadata - Proper indexes for performance optimization - Automatic timestamp triggers - Transaction support with rollback handling - Connection pooling (20 max connections, 30s idle timeout) - Graceful shutdown handling CLI commands available: - npm run db:init - Initialize database - npm run db:status - Check database status - npm run db:validate - Validate schema - npm run db:test - Run database tests - npm run db:diagnostics - Full diagnostics
10 KiB
Bookmark Manager - Requirements Document
Introduction
The Bookmark Manager is a web-based application designed to help users organize, manage, and maintain their browser bookmarks. The application provides comprehensive bookmark management capabilities including import/export functionality, link validation, duplicate detection, and an intuitive folder-based organization system.
Requirements
Requirement 1: Bookmark Import and Export
User Story: As a user, I want to import and export my bookmarks in standard formats, so that I can migrate bookmarks between browsers and backup my bookmark collection.
Acceptance Criteria
- WHEN a user clicks the "Import Bookmarks" button THEN the system SHALL display a file selection modal
- WHEN a user selects a Netscape bookmark HTML file THEN the system SHALL parse and import all bookmarks with their folder structure
- WHEN importing bookmarks THEN the system SHALL preserve bookmark metadata including titles, URLs, folders, creation dates, and favicons
- WHEN importing bookmarks THEN the system SHALL filter out "Bookmarks Toolbar" and "Bookmarks Bar" from folder paths to create cleaner organization
- WHEN importing bookmarks THEN the system SHALL offer the user a choice to replace existing bookmarks or merge with current collection
- WHEN a user clicks "Export Bookmarks" THEN the system SHALL generate a Netscape-compatible HTML file for download
- WHEN exporting bookmarks THEN the system SHALL organize bookmarks by folders and preserve all metadata
- WHEN exporting bookmarks THEN the system SHALL use the current date in the filename format "bookmarks_YYYY-MM-DD.html"
Requirement 2: Bookmark Organization and Management
User Story: As a user, I want to organize my bookmarks into folders and manage individual bookmarks, so that I can maintain a structured and accessible bookmark collection.
Acceptance Criteria
- WHEN bookmarks are displayed THEN the system SHALL group them by folder in card-based layout
- WHEN a folder contains bookmarks THEN the system SHALL display the folder name, bookmark count, and status statistics
- WHEN a user adds a new bookmark THEN the system SHALL require title and URL fields and allow optional folder assignment
- WHEN the folder field is focused THEN the system SHALL provide a dropdown list of all existing folders for selection
- WHEN selecting from folder dropdown THEN the system SHALL allow users to choose an existing folder or type a new folder name
- WHEN a user edits a bookmark THEN the system SHALL allow modification of title, URL, and folder assignment with the same folder selection capabilities
- WHEN a user deletes a bookmark THEN the system SHALL request confirmation before permanent removal
- WHEN bookmarks are displayed THEN the system SHALL show bookmark titles, URLs (on hover), and status indicators
- WHEN a user hovers over a bookmark THEN the system SHALL expand to show the full URL and title
- WHEN bookmarks exceed the card height limit THEN the system SHALL provide vertical scrolling within the card
Requirement 3: Link Validation and Testing
User Story: As a user, I want to test my bookmarks to identify broken links, so that I can maintain a collection of working bookmarks.
Acceptance Criteria
- WHEN a user clicks "Test All Links" THEN the system SHALL test every bookmark URL for accessibility
- WHEN testing links THEN the system SHALL display a progress bar showing current progress and bookmark being tested
- WHEN testing a link THEN the system SHALL use HTTP HEAD requests with 10-second timeout to minimize bandwidth
- WHEN a link test completes THEN the system SHALL mark bookmarks as "valid", "invalid", or "unknown" status
- WHEN a user clicks "Test Invalid Links" THEN the system SHALL retest only bookmarks previously marked as invalid
- WHEN link testing encounters CORS restrictions THEN the system SHALL handle opaque responses appropriately
- WHEN testing completes THEN the system SHALL update bookmark status indicators and statistics
- WHEN a user clicks on a bookmark status indicator THEN the system SHALL show a context menu with testing options
Requirement 4: Search and Filtering
User Story: As a user, I want to search and filter my bookmarks, so that I can quickly find specific bookmarks in large collections.
Acceptance Criteria
- WHEN a user types in the search box THEN the system SHALL filter bookmarks in real-time based on title, URL, and folder name
- WHEN search results are displayed THEN the system SHALL maintain the current filter state (all/valid/invalid/duplicates)
- WHEN a user clicks filter buttons THEN the system SHALL show only bookmarks matching the selected status
- WHEN "All" filter is active THEN the system SHALL display all bookmarks regardless of status
- WHEN "Valid" filter is active THEN the system SHALL display only bookmarks with valid status
- WHEN "Invalid" filter is active THEN the system SHALL display only bookmarks with invalid status
- WHEN "Duplicates" filter is active THEN the system SHALL display only bookmarks marked as duplicates
- WHEN filters are applied THEN the system SHALL update the statistics display to reflect filtered counts
Requirement 5: Duplicate Detection and Management
User Story: As a user, I want to identify duplicate bookmarks in my collection, so that I can clean up redundant entries and maintain an organized bookmark library.
Acceptance Criteria
- WHEN a user clicks "Find Duplicates" THEN the system SHALL analyze all bookmarks for duplicate URLs
- WHEN detecting duplicates THEN the system SHALL normalize URLs by removing trailing slashes and www prefixes
- WHEN duplicates are found THEN the system SHALL mark all instances in duplicate groups with "duplicate" status
- WHEN duplicate detection completes THEN the system SHALL display an alert showing the number of duplicates found
- WHEN no duplicates exist THEN the system SHALL inform the user that no duplicates were found
- WHEN duplicates are marked THEN the system SHALL update the statistics display to show duplicate count
- WHEN duplicate detection runs THEN the system SHALL reset any previously marked duplicates before new analysis
Requirement 6: Data Persistence and Storage
User Story: As a user, I want my bookmarks to be saved automatically, so that my work is preserved between browser sessions.
Acceptance Criteria
- WHEN bookmarks are imported, added, edited, or deleted THEN the system SHALL automatically save to browser localStorage
- WHEN the application loads THEN the system SHALL restore bookmarks from localStorage if available
- WHEN bookmark status is updated THEN the system SHALL persist the new status information
- WHEN a user clears all bookmarks THEN the system SHALL remove all data from localStorage after confirmation
- WHEN localStorage is unavailable THEN the system SHALL handle gracefully without crashing
Requirement 7: User Interface and Experience
User Story: As a user, I want an intuitive and responsive interface, so that I can efficiently manage my bookmarks across different devices.
Acceptance Criteria
- WHEN the application loads THEN the system SHALL display a clean, modern interface with clear navigation
- WHEN bookmarks are displayed THEN the system SHALL use a responsive grid layout that adapts to screen size
- WHEN on mobile devices THEN the system SHALL stack interface elements vertically for better usability
- WHEN performing long operations THEN the system SHALL show progress indicators and status messages
- WHEN hovering over interactive elements THEN the system SHALL provide visual feedback with hover effects
- WHEN displaying status information THEN the system SHALL use color-coded indicators (green=valid, red=invalid, blue=duplicate, gray=unknown)
- WHEN modals are displayed THEN the system SHALL allow closing by clicking outside the modal or using close buttons
- WHEN errors occur THEN the system SHALL display user-friendly error messages
Requirement 8: Context Menu and Bookmark Actions
User Story: As a user, I want quick access to bookmark actions, so that I can efficiently manage individual bookmarks.
Acceptance Criteria
- WHEN a user clicks on a bookmark THEN the system SHALL display a context menu with available actions
- WHEN "Visit" is selected THEN the system SHALL open the bookmark URL in a new browser tab
- WHEN "Test Link" is selected THEN the system SHALL test the individual bookmark and update its status
- WHEN "Edit" is selected THEN the system SHALL open the bookmark editing modal with current values
- WHEN "Delete" is selected THEN the system SHALL request confirmation and remove the bookmark if confirmed
- WHEN context menu actions complete THEN the system SHALL close the context menu automatically
Requirement 9: Statistics and Monitoring
User Story: As a user, I want to see statistics about my bookmark collection, so that I can understand the health and size of my bookmark library.
Acceptance Criteria
- WHEN bookmarks are loaded or updated THEN the system SHALL calculate and display total bookmark count
- WHEN link testing occurs THEN the system SHALL update counts for valid and invalid bookmarks
- WHEN duplicate detection runs THEN the system SHALL update the duplicate bookmark count
- WHEN statistics are displayed THEN the system SHALL show counts as clickable filter buttons
- WHEN folder cards are displayed THEN the system SHALL show individual folder statistics including valid/invalid counts
- WHEN statistics change THEN the system SHALL update the display in real-time
Requirement 10: Performance and Scalability
User Story: As a user, I want the application to perform well with large bookmark collections, so that I can manage thousands of bookmarks efficiently.
Acceptance Criteria
- WHEN importing large bookmark files THEN the system SHALL parse and display bookmarks without blocking the UI
- WHEN testing many links THEN the system SHALL process them sequentially to avoid overwhelming servers
- WHEN displaying many bookmarks THEN the system SHALL use efficient rendering to maintain responsive performance
- WHEN searching large collections THEN the system SHALL provide fast, real-time filtering results
- WHEN bookmark cards contain many items THEN the system SHALL limit display height and provide scrolling