A powerful command-line tool to generate a modern React + Vite Chrome Extension boilerplate, supporting both JavaScript and TypeScript, with optional TailwindCSS integration and built-in live reload for development.
- Interactive CLI prompts for template, styling, and project info
- Supports JS and TS boilerplates
- Optional TailwindCSS setup
- Automatically updates
manifest.jsonwith project details - Live reload for background, content, and popup scripts
- Vite-powered development and builds
- Includes custom reload server and plugins
- Graceful Ctrl+C exit with confirmation
- Built using modern ES Modules
Global installation:
npm install -g create-react-browser-extOr run directly without installation:
npx create-react-browser-extFor local development:
git clone https://github.com/divu050704/create-react-browser-ext
cd create-react-browser-ext
npm install
npm linkRun the CLI anywhere in your terminal:
create-react-browser-extYou’ll be guided through setup prompts:
Welcome to Chrome Extension Setup
? Choose a template: (Use arrow keys)
> JS (JavaScript)
TS (TypeScript)
? Choose a styling setup:
> Normal CSS
TailwindCSS
? Project name: my-chrome-extension
? Project Description: My Chrome Extension
Once completed, you’ll see:
Downloading template: chrome-react-ts-tailwind
manifest.json updated successfully
Project setup complete!
Next steps:
cd my-chrome-extension
npm install
npm run dev
After running the CLI, your generated project will look like this:
my-chrome-extension/
│ .gitignore
│ eslint.config.js
│ index.html
│ package-lock.json
│ package.json
│ README.md
│ reload-server.js
│ tsconfig.app.json
│ tsconfig.json
│ tsconfig.node.json
│ vite.config.ts
│
├───extension
│ icon.png
│ manifest.json
│
├───plugins
│ cleanMainFile.js
│ reloadExtensionPlugin.js
│ updatePopupPlugin.js
│
├───public
│ vite.svg
│
└───src
│ App.css
│ App.tsx
│ chrome.d.ts
│ index.css
│ main.tsx
│ reload.js
│
├───assets
│ react.svg
│
├───background
│ background.js
│ handleReload.js
│
└───content
content.js
handleReload.js
| Folder/File | Description |
|---|---|
| extension/ | Contains the Chrome extension’s manifest.json and icons. |
| src/ | Contains the main React source files and extension scripts. |
| src/background/ | Background service scripts (reload logic, events). |
| src/content/ | Content scripts injected into webpages. |
| plugins/ | Custom Vite plugins for extension reload and build cleanup. |
| reload-server.js | Node server for handling live-reload WebSocket events. |
| vite.config.ts | Main Vite configuration file for building and bundling the extension. |
| tsconfig.json* | TypeScript configuration files. |
| public/ | Static assets copied directly to the build folder. |
To start the development server with live reload:
npm run devThen, open Chrome and go to:
chrome://extensions/
Click “Load unpacked” and select your project’s /dev or /build directory (depending on your setup).
The extension reloads automatically when you modify:
- Files inside
extension/ - Background scripts
- Content scripts
- React popup or UI code (
src/)
When you’re ready to publish your extension:
npm run buildThen, load the /build folder as an unpacked extension in Chrome:
chrome://extensions/
- Interactive CLI Prompts via Inquirer.js
- Template Download using degit
- Manifest Update — replaces placeholders in
manifest.json - Live Reload System — integrates
reload-server.jsand Vite plugins - Clean Plugin System — ensures efficient hot reload and clean builds
Templates are hosted at: create-react-browser-ext-templates
Available branches:
chrome-react-js-normalchrome-react-js-tailwindchrome-react-ts-normalchrome-react-ts-tailwind
Runtime:
inquirer– Interactive CLI promptschalk– Colored terminal outputfs-extra– File system utilitiesdegit– Fast template downloaderupdate-notifier– Version update alerts
Dev:
vitetypescripteslint
- Firefox extension manifest support
- Custom template registry
- Support for Vue / Svelte
- One-command publishing
- Pre-configured CI/CD setups
- Fork the repo
- Create a new branch
- Make your changes
- Submit a PR