selectly

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:

πŸ› οΈ Utility Functions

Quick, practical actions at your fingertips:

πŸ’Ž Premium Features

πŸŽ›οΈ Highly Customizable


πŸš€ Quick Start

Installation from Source

1. Prerequisites

2. Clone Repository

git clone https://github.com/1850298154/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:


πŸ› οΈ 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:


πŸ”’ Privacy & Security


πŸ§ͺ 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


🀝 Contributing

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

Guidelines

Ideas for Contribution


πŸ“ Roadmap


πŸ™ 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