Skip to content

All-in-one customizable AI-powered text browser extension

Notifications You must be signed in to change notification settings

samanhappy/selectly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Selectly

License: MIT Chrome Extension TypeScript React

πŸš€ Selectly is an AI-powered browser extension that enhances text selection with intelligent actions. Transform your browsing experience with context-aware text processing powered by Large Language Models (LLMs).

English | δΈ­ζ–‡ζ–‡ζ‘£


✨ Features

πŸ€– AI-Powered Actions

Harness the power of LLMs to process selected text instantly:

  • 🌐 Smart Translation: Automatically detect language and translate to your preferred language
  • ✨ Text Polishing: Improve expression, clarity, and fluency
  • πŸ’‘ Content Explanation: Get detailed explanations of concepts and context
  • βœ… Grammar Correction: Fix grammar and spelling errors
  • πŸ’¬ Interactive Chat: Have a conversation about selected text

πŸ› οΈ Utility Functions

Quick, practical actions at your fingertips:

  • πŸ” Quick Search: Search selected text in your preferred search engine
  • πŸ“‹ Copy: One-click copy to clipboard
  • πŸ”— Open URL: Open selected URLs directly
  • πŸ“š Collect: Save interesting text snippets to your personal collection
  • πŸ“€ Share: Generate beautiful text cards and share as images

πŸ’Ž Premium Features

  • πŸ‘‘ Subscription System: Unlock advanced features with flexible plans
  • ☁️ Cloud Sync: Sync your data across devices
  • πŸ” Secure Authentication: OAuth2-based authentication

πŸŽ›οΈ Highly Customizable

  • πŸ”§ Multi-Provider Support: Compatible with OpenAI, Anthropic, DeepSeek, OpenRouter, SiliconFlow, and more
  • βš™οΈ Function Toggle: Enable/disable features as needed
  • πŸ“ Custom Prompts: Personalize prompts for each function
  • βž• Add Your Own: Create custom AI-powered functions
  • 🌍 Multi-language: Supports English, Chinese, Japanese, Spanish, French, German, and Portuguese
  • 🎨 Flexible UI: Choose button position (above/below selection)

πŸš€ Quick Start

Installation from Chrome Web Store

  1. Open Chrome browser
  2. Go to the Selectly Chrome Web Store page
  3. Click "Add to Chrome"
  4. Confirm by clicking "Add Extension"

Installation from Source

1. Prerequisites

  • Node.js 16+ and pnpm
  • Chrome or Chromium-based browser

2. Clone Repository

git clone https://github.com/samanhappy/selectly.git
cd selectly

3. Install Dependencies

pnpm install

4. Development Mode

pnpm dev

This starts the development server with hot reload.

5. Load Extension

  1. Open Chrome browser
  2. Navigate to chrome://extensions/
  3. Enable "Developer mode" (top-right toggle)
  4. Click "Load unpacked"
  5. Select the build/chrome-mv3-dev directory

6. Configure LLM

  1. Click the extension icon in the toolbar
  2. Navigate to "LLM Config" tab
  3. Select a provider and enter your API key
  4. Click "Test Connection" to verify
  5. Select your preferred model

7. Start Using

Select any text on a webpage, and action buttons will appear automatically!


πŸ“‹ Configuration Guide

Custom Functions

You can create custom AI-powered functions:

Example: Code Review

Function Key: code_review
Prompt: Please review the following code and provide suggestions for improvements:\n\n{text}
Model: default (or specific model)
Auto Execute: false

Example: Simplify Text

Function Key: simplify
Prompt: Simplify the following text to make it easier to understand:\n\n{text}

Example: Generate Ideas

Function Key: brainstorm
Prompt: Generate 5 creative ideas related to:\n\n{text}

Domain-Specific Functions

You can configure functions to:

  • Auto-execute on specific domains: Automatically run when text is selected on certain websites
  • Display only on specific domains: Show function buttons only on certain websites
  • Auto-close buttons: Automatically hide buttons after execution

πŸ› οΈ Tech Stack

Technology Purpose Version
Plasmo Modern browser extension framework 0.90.5
TypeScript Type-safe development 5.3.3
React UI components 18.2.0
Tailwind CSS Styling framework 3.4.17
OpenAI SDK LLM integration 5.16.0
Dexie.js IndexedDB wrapper for collections 4.0.8

πŸ“ Project Structure

selectly/
β”œβ”€β”€ core/                          # Core business logic
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── llm-config.ts         # Configuration management
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ llm-service.ts        # LLM service (provider-agnostic)
β”‚   β”‚   β”œβ”€β”€ action-service.ts     # Action handling
β”‚   β”‚   β”œβ”€β”€ collect-service.ts    # Collection management
β”‚   β”‚   β”œβ”€β”€ collect-sync-service.ts # Cloud sync for collections
β”‚   β”‚   β”œβ”€β”€ collect-sync-api.ts   # Sync API client
β”‚   β”‚   β”œβ”€β”€ collect-sync-types.ts # Sync type definitions
β”‚   β”‚   β”œβ”€β”€ subscription-service-v2.ts # Subscription management
β”‚   β”‚   β”œβ”€β”€ cloud-sync-subscription-service.ts # Cloud subscription sync
β”‚   β”‚   β”œβ”€β”€ model-service.ts      # LLM model resolution
β”‚   β”‚   β”œβ”€β”€ image-generator-service.ts # Image generation for sharing
β”‚   β”‚   └── notification-service.ts # User notifications
β”‚   β”œβ”€β”€ storage/
β”‚   β”‚   β”œβ”€β”€ secure-storage.ts     # Encrypted storage wrapper
β”‚   β”‚   β”œβ”€β”€ collect-db.ts         # IndexedDB for collections
β”‚   β”‚   β”œβ”€β”€ dictionary-db.ts      # IndexedDB for dictionary
β”‚   β”‚   β”œβ”€β”€ sync-queue-db.ts      # Sync queue database
β”‚   β”‚   β”œβ”€β”€ crypto.ts             # Cryptography utilities
β”‚   β”‚   β”œβ”€β”€ migration.ts          # Storage migrations
β”‚   β”‚   └── security-test.ts      # Security testing
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ auth-service.ts       # OAuth2 authentication
β”‚   β”‚   └── auth-background-bridge.ts # Auth background bridge
β”‚   β”œβ”€β”€ i18n/                      # Internationalization
β”‚   β”‚   β”œβ”€β”€ index.ts              # i18n entry
β”‚   β”‚   β”œβ”€β”€ types.ts              # i18n type definitions
β”‚   β”‚   β”œβ”€β”€ hooks/                # i18n React hooks
β”‚   β”‚   └── locales/              # Translation files
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   └── useSubscription.ts    # Subscription React hook
β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”œβ”€β”€ Selectly.tsx          # Main content script UI
β”‚   β”‚   └── content-styles.ts     # Content script styles
β”‚   β”œβ”€β”€ oauth/                     # OAuth utilities
β”‚   β”œβ”€β”€ premium-api-v2.ts          # Premium API client
β”‚   └── user-info.tsx              # User info component
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”œβ”€β”€ ActionButtons.tsx     # Floating action buttons
β”‚   β”‚   β”œβ”€β”€ StreamingResult.tsx   # Streaming LLM response display
β”‚   β”‚   β”œβ”€β”€ ShareImageRenderer.tsx # Image generation for sharing
β”‚   β”‚   β”œβ”€β”€ SharePreview.tsx      # Share preview component
β”‚   β”‚   └── ErrorBoundary.tsx     # Error handling
β”‚   β”œβ”€β”€ options/
β”‚   β”‚   β”œβ”€β”€ GeneralPage.tsx       # General settings page
β”‚   β”‚   β”œβ”€β”€ LLMPage.tsx           # LLM configuration page
β”‚   β”‚   β”œβ”€β”€ FunctionsPage.tsx     # Functions configuration page
β”‚   β”‚   β”œβ”€β”€ FunctionCard.tsx      # Function configuration cards
β”‚   β”‚   β”œβ”€β”€ SubscriptionPage.tsx  # Subscription page
β”‚   β”‚   β”œβ”€β”€ SubscriptionManagerV3.tsx # Subscription manager UI
β”‚   β”‚   β”œβ”€β”€ SubscriptionStatus.tsx # Subscription status display
β”‚   β”‚   β”œβ”€β”€ CollectionsPage.tsx   # Collections management page
β”‚   β”‚   β”œβ”€β”€ DictionaryPage.tsx    # Dictionary page
β”‚   β”‚   β”œβ”€β”€ OptionsHeader.tsx     # Options page header
β”‚   β”‚   β”œβ”€β”€ PopupHeader.tsx       # Popup header
β”‚   β”‚   β”œβ”€β”€ Sidebar.tsx           # Options sidebar
β”‚   β”‚   β”œβ”€β”€ TabsBar.tsx           # Settings tabs
β”‚   β”‚   β”œβ”€β”€ Drawer.tsx            # Drawer component
β”‚   β”‚   β”œβ”€β”€ constants.ts          # UI constants
β”‚   β”‚   └── forms/                # Form components
β”‚   β”œβ”€β”€ shared/
β”‚   β”‚   └── PremiumCrown.tsx      # Premium indicator component
β”‚   └── ui/                        # Reusable UI components (shadcn/ui)
β”‚       β”œβ”€β”€ badge.tsx
β”‚       β”œβ”€β”€ button.tsx
β”‚       β”œβ”€β”€ input.tsx
β”‚       └── separator.tsx
β”œβ”€β”€ lib/
β”‚   └── utils.ts                   # Utility functions
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ icon-utils.ts              # Icon utilities
β”‚   └── url-utils.ts               # URL utilities
β”œβ”€β”€ locales/                       # Legacy locale files
β”œβ”€β”€ scripts/
β”‚   └── generate-keys.js           # Key generation utility
β”œβ”€β”€ background.ts                  # Service worker (event handler)
β”œβ”€β”€ content.tsx                    # Content script entry
β”œβ”€β”€ popup.tsx                      # Extension popup
β”œβ”€β”€ options.tsx                    # Options page
β”œβ”€β”€ style.css                      # Global styles
β”œβ”€β”€ tailwind.config.js             # Tailwind configuration
β”œβ”€β”€ postcss.config.js              # PostCSS configuration
β”œβ”€β”€ tsconfig.json                  # TypeScript configuration
└── package.json                   # Project dependencies

Architecture Principles

Following single responsibility and modular design:

  • Services: Each service handles one concern (LLM, actions, storage, etc.)
  • Separation of Concerns: UI components only handle presentation; business logic lives in services
  • Provider-Agnostic: LLM service supports multiple providers through adapters
  • Secure by Default: Sensitive data encrypted at rest
  • Testable: Small, pure functions with clear interfaces

πŸ”’ Privacy & Security

  • βœ… Local-First: All configuration stored locally in browser storage
  • βœ… No Data Collection: Zero tracking or analytics
  • βœ… API Keys Stay Private: Keys never leave your browser
  • βœ… Direct LLM Communication: Text sent only to your configured LLM provider
  • βœ… Encrypted Storage: Sensitive data encrypted using Chrome's secure storage
  • βœ… Open Source: Full transparency - audit the code yourself

πŸ§ͺ Development

Available Commands

# Development with hot reload
pnpm dev

# Production build
pnpm build

# Package extension (creates zip)
pnpm package

# Generate OAuth keys
pnpm generate-keys

# Format all files
pnpm format

# Check formatting status
pnpm format:check

Code Quality

  • TypeScript: Strict type checking
  • Modular: Single responsibility principle
  • Composable: Small, reusable functions
  • No Global State: Services use dependency injection where possible

🀝 Contributing

Contributions are welcome! Here's how you can help:

Guidelines

  • Follow the existing code style (TypeScript + React)
  • Keep services focused (single responsibility)
  • Add comments for complex logic
  • Test in multiple scenarios
  • Update documentation if needed

Ideas for Contribution

  • 🌍 Add new language translations
  • πŸ”Œ Add support for new LLM providers
  • ✨ Create new built-in functions
  • πŸ› Fix bugs and improve error handling
  • πŸ“– Improve documentation
  • 🎨 Enhance UI/UX

πŸ“ Roadmap

  • Firefox and Edge support
  • More built-in AI functions
  • Advanced prompt templates
  • Export/import configurations
  • Function marketplace (share custom functions)

πŸ™ Acknowledgments

Built with amazing open-source projects:


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ’¬ Support

If you encounter issues or have questions:

  1. Check existing Issues
  2. Search Discussions
  3. Open a new issue with detailed information

⭐ Star History

If this project helps you, please consider giving it a ⭐ star!


Made with ❀️ for the open source community

About

All-in-one customizable AI-powered text browser extension

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published