A Chrome extension that tracks and saves X (Twitter) posts you view, with full-text search, masonry grid layout, and offline caching.
- Automatic Post Tracking: Automatically saves posts you view on X.com
- Smart Caching: Posts cached in IndexedDB for instant loading and offline access
- Full-Text Search: Search through saved posts by content, username, or keywords
- Dual View Modes:
- Masonry Grid View: Pinterest-style responsive grid layout
- List View: Compact single-column layout
- History Manager: Dedicated page for managing your entire post history
- Dark/Light Theme: Automatic theme detection with manual toggle
- Infinite Scroll: Smooth pagination (10 posts per page in history, 5 in popup)
- Import/Export: Backup and restore your post history as JSON
- TypeScript: Full type safety and better development experience
- Manifest V3: Future-proof with Chrome's latest extension architecture
- React 19 - Modern UI framework with hooks
- TypeScript - Type-safe development
- Vite 7 - Lightning-fast build tool and dev server
- @crxjs/vite-plugin - Chrome extension development with HMR
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Accessible React component library (Button, Card, Input, ScrollArea)
- Lucide React - Icon library
- Manifest V3 - Latest Chrome extension architecture
- IndexedDB - Local database for post caching with full-text search
- FxTwitter API - Enhanced post data with media, engagement stats, and metadata
- Download or clone this repository
- Install dependencies and build:
npm install npm run build
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer Mode (toggle in top right)
- Click "Load unpacked" and select the
distfolder - Pin the extension to your toolbar
Note: This extension is distributed as "load unpacked" for maximum privacy and control. Your data stays completely local.
# Clone the repository
git clone https://github.com/yourusername/x-history.git
cd x-history
# Install dependencies
npm install
# Development mode with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewDevelopment workflow:
npm run devstarts Vite dev server with HMR (Hot Module Replacement)- Changes to React components auto-reload
- Extension reloads automatically with @crxjs/vite-plugin
- Build output goes to
dist/folder
- Browse X.com - Navigate and view posts normally
- Automatic Tracking - Posts are automatically saved as you browse
- View History - Click the extension icon to see recent posts
- History Manager - Click π button for full history page
- Real-time search as you type
- Searches post content, usernames, and metadata
- Multi-word search (all terms must match)
- Clear button to reset search
- Grid View: Masonry layout with multiple columns
- List View: Single column with compact cards
- Toggle between views with the grid/list buttons
- View all saved posts in one place
- Advanced filtering and sorting
- Export your data as JSON
- Import previously exported data
- Bulk management options
- Automatic system theme detection
- Manual toggle with π/βοΈ button
- Persists across sessions
X_history/
βββ src/
β βββ popup/ # Popup React app (500x600px)
β β βββ index.html # Popup entry HTML
β β βββ index.tsx # React root
β β βββ Popup.tsx # Main popup component with infinite scroll
β βββ history/ # History page React app (full-page manager)
β β βββ index.html # History entry HTML
β β βββ index.tsx # React root
β β βββ History.tsx # Main history component with grid/list views
β βββ components/ # Shared React components
β β βββ TweetCard.tsx # Rich tweet display with media, engagement stats
β β βββ ui/ # shadcn/ui components (button, card, input, scroll-area)
β βββ hooks/ # React hooks
β β βββ useTweetData.ts # FxTwitter API hook with localStorage cache
β βββ utils/ # Utility functions
β β βββ enrichPosts.ts # Post enrichment utilities
β βββ background.ts # Service worker (Manifest V3) - tracks x.com/*/status/*
β βββ db.ts # IndexedDB operations with full-text search
β βββ sidebar.ts # Legacy popup script (not used in React version)
β βββ index.css # Global Tailwind styles
βββ dist/ # Vite build output (load this folder)
βββ images/ # Extension icons (16, 48, 128)
βββ manifest.json # Manifest V3 config
βββ vite.config.ts # Vite configuration with @crxjs/vite-plugin
βββ tailwind.config.js # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies
- React 19 - Component-based UI with latest features and hooks
- Vite 7 - Fast builds (~2s) and instant HMR
- @crxjs/vite-plugin - Chrome extension dev tools with hot reload
- Tailwind CSS - Utility-first styling with dark mode support
- shadcn/ui - Pre-built accessible components
- Chrome Storage API - Stores URLs array (
urlskey) - IndexedDB - Caches full post data with text/username indices for search
- FxTwitter API - Fetches enhanced post metadata (no auth required)
- Service Workers - Background URL tracking via
webNavigationAPI - localStorage - Caches tweet data by post ID to reduce API calls
- Background script monitors x.com navigation β saves URLs to chrome.storage
- Popup/History loads URLs β fetches from IndexedDB cache or FxTwitter API
- TweetCard displays rich content with useTweetData hook β caches in localStorage
- 100% Local Storage - All data stays in your browser (chrome.storage, IndexedDB, localStorage)
- No External Servers - Only connects to X.com (for tracking) and FxTwitter API (for enrichment)
- No Analytics/Tracking - No telemetry, no third-party trackers
- No Authentication - FxTwitter API requires no keys or login
- Easy Data Removal - Clear all data with one click (clears all storage layers)
- Export Your Data - Full control with JSON export/import
- Open Source - Inspect the code, modify as needed
- Solution: Ensure you're on
x.com(nottwitter.com) - Check extension permissions in
chrome://extensions/ - Look for navigation to URLs matching
x.com/{username}/status/{id} - Check background service worker logs in extension details
- Solution: FxTwitter API may be rate-limited or unavailable
- Posts will fallback to simple URL display
- Wait a few minutes and refresh
- Check browser console (F12) for API errors
- Solution: Search looks in IndexedDB cached posts only
- Posts must be viewed first (not just tracked) to be searchable
- Search is case-insensitive and matches text/username
- Try simpler search terms or reload posts
- Solution: Check system theme preference
- Use manual theme toggle (π/βοΈ button)
- Theme preference saved in localStorage
- Export creates JSON with all post URLs and metadata
- Import only accepts valid JSON arrays
- Large imports (>1000 posts) may take 10-30 seconds
- Extension may be unresponsive during import
- Solution: Pin the extension in Chrome toolbar
- Check if extension is enabled in
chrome://extensions/ - Reload the extension
- Dual Storage Systems: Both
urlsarray (chrome.storage) andtrackedPosts(chrome.storage) exist with migration logic - consider consolidating - Legacy Code: sidebar.ts contains old non-React popup implementation (kept for reference, not actively used)
- API Rate Limits: FxTwitter API has no documented rate limits but may throttle - implement exponential backoff if needed
- Media Display: Videos may not work for private/deleted posts
- Pagination: History page loads all posts at once - consider virtualizing for 10k+ posts
This extension is designed for load unpacked distribution rather than Chrome Web Store:
- β Privacy First - No review process, no external oversight
- β Full Control - Users can inspect and modify code
- β Instant Updates - Just rebuild and reload
- β No Restrictions - Avoid Web Store policies and review delays
- β Developer Friendly - Perfect for power users and developers
To share this extension:
-
Build the extension:
npm install npm run build
-
Package the dist folder:
# Create a zip of the dist folder cd dist zip -r ../x-history-extension.zip .
-
Share instructions with users:
- Extract the zip file
- Go to
chrome://extensions/ - Enable Developer Mode
- Click "Load unpacked"
- Select the extracted folder
If you want to publish to Chrome Web Store later:
- Update
manifest.jsonwith proper icons and descriptions - Create promotional images (1280x800, 640x400, etc.)
- Create a developer account ($5 one-time fee)
- Submit for review (1-2 weeks initial review)
For now, load unpacked is recommended for this privacy-focused tool.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
For issues or questions:
- Check the troubleshooting section above
- Open browser DevTools (F12) for error details
- Create an issue on GitHub
- Include console logs and steps to reproduce
Note: This extension requires Chrome/Edge with Manifest V3 support (Chrome 88+)