A browser extension that provides deeper insights using Perplexity AI and creates personalized knowledge graphs from your browsing activity.
- Overview
- Features
- Installation
- Usage
- Knowledge Graph Sharing
- Troubleshooting
- Development
- Architecture
- Privacy & Security
- Technical Details
- Contributing
- License
Perplexity Lens transforms your browsing experience by providing AI-powered insights and building a personalized knowledge graph that visualizes connections between concepts you encounter online. The extension allows you to select text on any webpage to get explanations and automatically adds the concepts to your knowledge graph. You can also share your knowledge graph with others via public URLs.
- π Smart Text Selection: Get AI-powered explanations for selected text using Perplexity AI
- π Knowledge Graph Visualization: Explore connections between concepts with an interactive D3.js graph
- π Public Sharing: Generate shareable URLs for your knowledge graphs that anyone can access
- π User Authentication: Secure personal data with Firebase authentication
- πΎ Local & Cloud Storage: Store data locally with IndexedDB and in the cloud with Firebase
- π±οΈ Interactive Graphs: Zoom, pan, drag, and explore your knowledge connections
- π± Responsive Design: Works across devices with adaptive layouts
- π¨ Modern UI: Built with React, TypeScript, and TailwindCSS
- Node.js (v14 or later)
- npm (v6 or later)
- Google Chrome or compatible browser
- Firebase account (for sharing functionality)
- Firebase CLI (
npm install -g firebase-tools)
-
Clone the repository:
git clone https://github.com/username/perplexity-lens.git cd perplexity_lens -
Install dependencies:
npm install
-
Configure API Keys: Edit
src/config.tsand add your API keys:// Your Perplexity API key export const PERPLEXITY_API_KEY = 'your-perplexity-key'; // Your OpenAI API key (for embeddings) export const EMBEDDING_API_KEY = 'your-openai-key'; // Firebase configuration export const FIREBASE_HOSTING_URL = 'https://your-project-id.web.app';
-
Build the extension:
npm run build
-
Load in Chrome:
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top right)
- Click "Load unpacked" and select the
distdirectory
- Open Chrome and navigate to
- Sign In: Click the extension icon in your browser toolbar and sign in with your Firebase account
- Select Text: Highlight any text on a webpage to see AI-powered explanations
- View Graph: Click the "Graph" tab in the extension popup to see your knowledge graph
- Explore Connections: Interact with your graph - drag nodes, zoom in/out, and hover for details
- Share Graph: Click "Share Graph" to create a public URL that anyone can access
- Build Your Graph: Use the extension to select text and build your knowledge graph
- Open Graph View: Click on the extension icon and navigate to the Graph tab
- Click Share: Click the "Share Graph" button
- Access Public URL: A new tab will open with your public knowledge graph
- Copy and Share: Copy the URL from the address bar to share with others
When someone visits your shared knowledge graph, they'll see:
- Interactive Visualization: Full D3.js powered graph with zoom and drag capabilities
- Concept Details: Node sizes representing frequency and hover information
- Relationship Types: Color-coded edges showing different types of connections
- Graph Statistics: Total concepts and connections count
- Creation Date: When the graph was shared
- Download Option: Ability to download the graph data as JSON
- Copy Link: Button to easily copy the sharing URL
-
Firebase Setup:
# Login to Firebase firebase login # Initialize project (if not already done) firebase init # Select Firestore and Hosting options
-
Deploy to Firebase:
firebase deploy
-
Update Configuration:
- Your site will be available at
https://your-project-id.web.app - Update
FIREBASE_HOSTING_URLinsrc/config.tswith your actual domain - Rebuild and redeploy after updating the config
- Your site will be available at
- Check that the URL is complete and properly copied
- Ensure the graph was successfully shared (button clicked)
- Verify your internet connection
- Check Firebase deployment status
- Make sure you've selected text and built a knowledge graph first
- Try refreshing your graph before sharing
- Check that you're signed in when sharing
- Large graphs may take a moment to load
- Check your internet connection
- Try refreshing the page
- Ensure JavaScript is enabled in your browser
- Try a different browser (Chrome, Firefox, Safari, Edge)
- Check browser console for error messages
# Start development server with watch mode
npm run dev
# Build for production
npm run build
# Deploy to Firebase
firebase deployperplexity-lens/
βββ dist/ # Build output
βββ public/ # Static assets
β βββ icons/ # Extension icons
β βββ view.html # Public graph viewer
β βββ ...
βββ src/
β βββ background/ # Extension background scripts
β βββ components/ # React components
β βββ content/ # Content scripts
β βββ graph/ # Knowledge graph implementation
β βββ popup/ # Extension popup UI
β βββ services/ # API and data services
β βββ types/ # TypeScript type definitions
β βββ config.ts # Configuration file
β βββ firebase.ts # Firebase initialization
βββ scripts/ # Helper scripts
βββ firebase.json # Firebase configuration
βββ firestore.rules # Firestore security rules
βββ package.json # Project dependencies
βββ webpack.config.js # Build configuration
- Frontend: React + TypeScript + D3.js for visualization
- Backend: Firebase (Firestore + Hosting + Authentication)
- Storage:
- Local: IndexedDB for personal graph data
- Cloud: Firebase Firestore for shared graphs
- APIs:
- Perplexity AI for text explanations
- OpenAI for embeddings and semantic connections
- Build System: Webpack + PostCSS + TailwindCSS
- β Concept names and their relationships
- β Frequency of concept encounters
- β Semantic connections between concepts
- β Timestamps of when concepts were last selected
- β Your personal account information
- β The full text of your selections
- β The websites where you found the content
- β Your browsing history
- β Any private notes or comments
- Firebase Security Rules: Protect your data with custom access controls
- Public Read-Only Access: Shared graphs are read-only for viewers
- User Authentication: Secure account-based access
- HTTPS Encryption: All data transfer is encrypted
{
"nodes": [
{
"id": "concept_123",
"text": "machine learning",
"frequency": 5,
"lastSelected": "2024-01-15T10:30:00Z"
}
],
"edges": [
{
"id": "edge_456",
"source": "concept_123",
"target": "concept_789",
"weight": 0.8
}
]
}- Base URL:
https://your-domain.web.app/view.html - Graph ID parameter:
?id=firestore-document-id - Example:
https://perplexity-lens.web.app/view.html?id=abc123def456
The project includes Firestore rules that:
- Allow public read access to shared graphs (
/graphs/{id}) - Require authentication for user data
- Prevent unauthorized modifications
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test thoroughly
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Perplexity AI for their powerful AI API
- D3.js for the visualization library
- Firebase for authentication and storage
- React and TypeScript for the UI framework
- TailwindCSS for styling
Happy Learning & Sharing! π
Transform your browsing experience and build beautiful knowledge graphs with Perplexity Lens.