Skip to content

mubaidr/vite-vue3-browser-extension-v3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Vite Vue 3 Browser Extension (Manifest V3)

Build Status

A modern, opinionated starter template for building browser extensions using Vite, Vue 3, and Manifest V3. Supports Chrome, Firefox, and more. Includes pre-configured routing, state management, composables, and a rich set of UI components from Nuxt/UI v3. Now with shadcn-vue support for additional component options!


πŸš€ Features

  • Multi-Context Ready: Boilerplate for background, popup, options, content script, devtools, side panel, and offscreen pages.
  • File-Based Routing: Add a file in src/pages or relevant UI directoryβ€”auto-registered as a route.
  • Composable Architecture: Prebuilt composables for i18n, theme, notifications, browser storage, and more.
  • State Management: Type-safe Pinia stores (persistent & non-persistent).
  • UI Components: Header, Footer, Locale & Theme Switch, Loading Spinner, Error Boundary, Empty State, Notifications, plus shadcn-vue components.
  • Modern Tooling: Nuxt/UI 3, Tailwind CSS 4, ESLint, Prettier, auto-imports, and more.
  • WebExtension Utilities: webext-bridge for context communication, webextension-polyfill for browser API compatibility.

Screenshots

Screenshot 3 Screenshot 3 Screenshot 3


πŸ› οΈ Development

Quick Start

npx degit mubaidr/vite-vue3-browser-extension-v3 my-webext
cd my-webext
npm install
npm run dev
  • Build: npm run build
  • Lint: npm run lint
  • Dev (Chrome/Firefox): npm run dev:chrome / npm run dev:firefox
  • Build (Chrome/Firefox): npm run build:chrome / npm run build:firefox

Load the extension from the dist/chrome or dist/firefox folder in your browser.

Adding shadcn-vue Components

To add shadcn-vue components to your extension:

npx shadcn-vue@latest init
npx shadcn-vue@latest add button
npx shadcn-vue@latest add input
npx shadcn-vue@latest add card

The components will be automatically configured and ready to use in your Vue files.


🧩 Example: useBrowserStorage

const { data: syncSettings, promise } = useBrowserSyncStorage('settings', {
  theme: 'dark',
  notifications: true,
  preferences: { language: 'en', fontSize: 14 }
})

const { data: userProfile } = useBrowserLocalStorage('profile', {
  name: 'John Doe',
  lastLogin: null,
  favorites: ['item1', 'item2']
})

console.log(syncSettings.value.theme) // 'dark'
console.log(userProfile.value.name)   // 'John Doe'

🎨 shadcn-vue Integration

This template includes shadcn-vue for additional high-quality, accessible components. The project is pre-configured with:

  • Component Installation: Use npx shadcn-vue@latest add <component> to add components
  • Automatic Integration: Components work seamlessly with existing Tailwind CSS setup
  • TypeScript Support: Full type safety for all shadcn-vue components
  • Customizable: Easy theming and customization through CSS variables

Example: Adding a Button Component

npx shadcn-vue@latest add button
<template>
  <Button variant="default" size="sm" @click="handleClick">
    Click me
  </Button>
</template>

<script setup lang="ts">
import { Button } from '@/components/ui/button'

function handleClick() {
  console.log('Button clicked!')
}
</script>

πŸ”Œ Plugins & Libraries

  • Vite Plugins: unplugin-vue-router, unplugin-auto-import, unplugin-vue-components, unplugin-icons, unplugin-turbo-console, @intlify/unplugin-vue-i18n
  • Vue Plugins: Pinia, VueUse, Notivue, Vue-i18n
  • UI: Nuxt/UI, shadcn-vue, Tailwind CSS 4
  • WebExtension: webext-bridge, webextension-polyfill
  • Utilities: Marked (for markdown rendering)
  • Coding Style: TypeScript, ESLint, Prettier

πŸ“ Directory Structure

.
β”œβ”€β”€ dist/                # Built extension files (chrome/firefox)
β”œβ”€β”€ public/              # Static assets (icons, etc.)
β”œβ”€β”€ scripts/             # Build/dev scripts
β”œβ”€β”€ src/                 # Source code
β”‚   β”œβ”€β”€ assets/          # Global assets
β”‚   β”œβ”€β”€ background/      # Background scripts
β”‚   β”œβ”€β”€ components/      # Shared Vue components
β”‚   β”œβ”€β”€ composables/     # Vue composables (hooks)
β”‚   β”œβ”€β”€ content-script/  # Content scripts
β”‚   β”œβ”€β”€ devtools/        # Devtools panel
β”‚   β”œβ”€β”€ locales/         # i18n files
β”‚   β”œβ”€β”€ offscreen/       # Offscreen pages
β”‚   β”œβ”€β”€ stores/          # Pinia stores
β”‚   β”œβ”€β”€ types/           # TypeScript definitions
β”‚   β”œβ”€β”€ ui/              # UI pages (popup, options, etc.)
β”‚   └── utils/           # Shared utilities
β”œβ”€β”€ manifest.config.ts   # Base manifest config
β”œβ”€β”€ vite.config.ts       # Base Vite config
β”œβ”€β”€ tailwind.config.cjs  # Tailwind CSS config
└── package.json         # Dependencies & scripts

πŸ’‘ Coding Style

  • TypeScript with strict types
  • ESLint & Prettier enforced
  • Vue 3 Composition API (<script setup>)
  • File-based routing and auto-imports

🀝 Contributing

Contributions are welcome! Please open issues or submit pull requests for improvements or new features.


πŸ™ Support

If you find this project useful, please consider supporting the author and starring ⭐ the repository.


πŸ‘₯ Contributors

mubaidr
Muhammad Ubaid Raza
Dreamlinerm
Dreamliner
baramofme
Jihoon Yi
poncianodiego
Diego Ponciano
IgorFZ
igorfz
hi2code
hi2code
justorez
Null

About

Another vite powered web extension (chrome, firefox, etc.) starter template.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published