A modern, type-safe browser extension starter template that helps you build extensions faster. This template combines the power of Plasmo, tRPC, and React Query to provide a robust foundation for your browser extension projects.
English | ็ฎไฝไธญๆ
- Type Safety: Built-in end-to-end type safety with tRPC
- Modern Development: Hot reload, automatic reloading, and modern development experience
- Battle-tested Stack: Carefully selected technology stack for optimal development
- Ready to Use: Pre-configured with essential tools and best practices
- Beautiful UI: Integrated with shadcn/ui for stunning user interfaces
- Core:
- Plasmo - Modern framework for building browser extensions
- React - UI library for building user interfaces
- TailwindCSS - Utility-first CSS framework
- shadcn/ui - High-quality, customizable React components
- Type Safety & Data Management:
- tRPC - End-to-end typesafe APIs
- TanStack Query - Powerful data fetching and async state management
- trpc-browser - Type-safe messaging interface for browser extensions
src/
โโโ background/ # Background service workers
โโโ components/ # Reusable UI components
โโโ contents/ # Content scripts
โโโ hooks/ # Custom React hooks
โโโ lib/ # Utility functions and configurations
โโโ tabs/ # Extension tabs
โโโ popup.tsx # Extension popup
โโโ options.tsx # Extension options page
โโโ style.css # Global styles
- Node.js 16.14.x or later
- macOS, Windows, or Linux
- pnpm (Strongly Recommended)
- Clone this repository or use it as a template
- Install dependencies:
pnpm install
- Start development:
pnpm dev
- Load the extension:
- Chrome: Open
chrome://extensions/
- Enable "Developer mode"
- Click "Load unpacked" and select the
build/chrome-mv3-dev
directory
- Chrome: Open
# Start development server with hot reload
pnpm dev
# Build for production
pnpm build
# Package the extension
pnpm package
Add new shadcn/ui components using the CLI:
pnpm dlx shadcn@latest add <component-name>
# Example: pnpm dlx shadcn@latest add button
Edit the manifest
section in package.json
to modify permissions:
"manifest": {
"host_permissions": ["https://*/*"],
"permissions": []
}
- Build the extension:
pnpm build
- Find your production-ready extension in the
build
directory - Package for store submission:
pnpm package
Officially supported browsers:
- โ Chrome/Chromium (Manifest V3) - Default target
- โ Firefox (Manifest V2)
- โ Firefox (Manifest V3) - Experimental
- โ Edge (Manifest V3)
- โ Brave (Manifest V3)
- โ Opera (Manifest V3)
โ ๏ธ Safari (Manifest V3) - Requires safari-web-extension-converter
All Chromium-based browsers are supported through their respective MV3 targets:
pnpm build --target=edge-mv3
pnpm build --target=brave-mv3
pnpm build --target=opera-mv3
For Safari development, build with --target=safari-mv3
and use the Safari Web Extension converter tool.
This template is open to improvements. Feel free to:
- Submit bug reports
- Propose new features
- Create pull requests
MIT License - Feel free to use this template for your projects!