Read this in other languages: ζ₯ζ¬θͺ
A lightweight and accessible template for easily developing modern Chrome extensions
- Features
- File Structure
- Installation
- Usage
- Customization Guide
- Development Tips
- How to Contribute
- Technical Specifications
- Todo
| π β· βοΈ Theme Support |
π Auto-Save |
π‘οΈ Minimal Permissions |
| π¦ Data Management |
βΏ Accessible UI |
π Manifest V3 |
- Manifest V3 Compatible: Uses an event-driven extension service worker
- Minimal Permissions: Requests only
storageand no default site access - Modular Design: Separates shared settings, popup, options, background, and optional examples
- Theme Support: Supports system, light, and dark themes
- Data Management: Imports and exports validated settings backups
- Auto-Save Functionality: Saves and synchronizes settings in real time
- Accessible UI: Includes semantic controls, visible focus, and 44px interaction targets
- Zero Dependencies: Uses browser and Node.js built-in APIs only
Chrome-Extension-Template/
β
βββ manifest.json # Extension configuration
β
βββ shared/
β βββ settings.js # Settings schema and storage helpers
β βββ ui.js # Theme and localization helpers
β βββ ui.css # Shared accessible UI styles
β
βββ scripts/
β βββ background.js # Extension service worker
β βββ validate.mjs # Source and configuration checks
β βββ build.mjs # Runtime-only build script
β
βββ popup/ # Toolbar popup
βββ options/ # Extension options page
βββ _locales/ # English and Japanese messages
βββ examples/content-script/ # Optional page-access example
βββ tests/ # Node.js built-in tests
β
βββ assets/
βββ icons/ # 16, 48, and 128px icon files
| Component | Role | Features |
|---|---|---|
| π Service Worker | Event Processing | Installation, startup, and badge updates |
| π₯οΈ Popup UI | Quick Settings | Enable/disable control and status display |
| βοΈ Options UI | Detailed Settings | Theme, badge, backup, and reset controls |
| πΎ Chrome Storage | Data Storage | Synchronized settings persistence |
Popup UI β· Shared Settings β· Chrome Storageβ¬οΈ β¬οΈ
Options UI β· Shared Settingsβ¬οΈ β¬οΈ
Service Worker β· Chrome Action
The base template does not inject code into web pages. A narrowly scoped content-script example is available in examples/content-script/ when page access is required.
- Google Chrome 102 or later
- Developer mode enabled
- Node.js 20 or later only when running tests or builds
-
Clone the repository:
git clone https://github.com/E20C1/Chrome-Extension-Template.git cd Chrome-Extension-Template -
Load the extension in Chrome:
- Open
chrome://extensionsin Chrome - Turn on Developer mode
- Click Load unpacked
- Select the cloned directory
- Open
| π | Access chrome://extensions |
| π§ | Turn on "Developer mode" in the top right |
| π¦ | Click "Load unpacked" and select the repository |
| β | Verify the extension has loaded successfully |
- Enable/Disable Extension: Toggle the extension state from the popup
- Theme Switching: Select system, light, or dark mode on the options page
- Status Badge: Show or hide the
ON/OFFtoolbar badge - Automatic Saving: Apply and synchronize every settings change immediately
- Export Settings: Download the current settings as a versioned JSON backup
- Import Settings: Restore a validated JSON backup up to 256KB
- Reset Settings: Restore safe defaults after confirmation
Update these messages in both _locales/en/messages.json and _locales/ja/messages.json:
{
"extensionName": { "message": "Your Extension Name" },
"extensionDescription": { "message": "Your extension description" },
"actionTitle": { "message": "Open Your Extension" }
}Add only permissions required by a current feature to respect user privacy:
"permissions": [
"storage"
]For page access, start with examples/content-script/README.md and use the narrowest possible match pattern. Do not add <all_urls> for future or hypothetical features.
- Add a default value and normalization rule to
shared/settings.js - Add localized labels to both locale files
- Add a semantic control to the popup or options page
- Add or update a test in
tests/
Add icons of the following sizes to the assets/icons/ directory:
icon16.png(16x16 px)icon48.png(48x48 px)icon128.png(128x128 px)
- Simple Design: Easy-to-understand structure for beginners
- Minimal Permissions: No host or tab access in the base template
- Modern UI: Responsive popup and single-column options layout
- Fast Performance: No frameworks, remote assets, or runtime dependencies
- Accessible Foundation: Keyboard focus, reduced motion, forced colors, and localized labels
- Run Checks: Use
npm testto validate settings, Manifest, i18n, HTML, CSS, and icons - Create a Build: Use
npm run buildto copy runtime files intodist/ - Reload Changes: Use the refresh button on
chrome://extensions - Debug the Worker: Open the service worker inspector from the extension details page
- Inspect Storage: Settings are stored in
chrome.storage.sync
npm test
npm run buildGitHub Actions runs the same checks for every push and pull request.
- Fork the repository π΄
- Add a focused feature or improvement β¨
- Run the tests and build locally β
- Submit a pull request π
Contribution Guidelines:
- Follow the existing code style π
- Request only permissions required by the feature π‘οΈ
- Write clear commit messages π
- Explain the reason and impact of each change π
- Manifest Version: Manifest V3
- Minimum Chrome Version: Chrome 102
- JavaScript: Standard ES modules and modern browser APIs
- Service Worker: Event-driven background processing
- Storage API:
chrome.storage.syncrestricted to trusted extension contexts - Internationalization: Chrome i18n with English and Japanese locales
- Dependencies: No runtime or npm package dependencies
- Build Output: Runtime-only files in
dist/
- Add icon files
- Add unit tests and source validation
- Set up build automation and GitHub Actions
- Add an optional onboarding-page example
- Add cross-browser packaging examples
- Add automated end-to-end extension tests
Β© 2026 Chrome Extension Template
Made with β€οΈ by E20C1