A modern, type-safe desktop application boilerplate combining the power of Electron with Vue 3, TypeScript, tRPC, and Tailwind CSS.
- ⚡ Electron - Build cross-platform desktop apps with web technologies
- 🖖 Vue 3 - Progressive JavaScript framework with Composition API
- 📘 TypeScript - Type-safe development experience
- 🔄 tRPC - End-to-end typesafe APIs with real-time subscriptions
- 🎨 Tailwind CSS - Utility-first CSS framework
- ⚛️ TSX Support - Write Vue components with JSX syntax
- 🔧 Vite - Fast build tool and development server
- 📦 Electron Builder - Package and distribute your app
- 🧹 ESLint - Code linting and formatting
- Node.js: >= 20.0.0
- Yarn: >= 1.22.22
- Clone the repository:
git clone https://github.com/dortanes/electron-vue3-tsx-trpc-tailwind-boilerplate.git
cd electron-vue3-tsx-trpc-tailwind-boilerplate
- Install dependencies:
yarn install
Start the development server:
yarn dev
This will:
- Start the Vite development server
- Launch the Electron app with hot reload
- Open DevTools automatically
Build the application for production:
yarn build
This will:
- Run ESLint checks
- Build the renderer process with Vite
- Build the main process
- Package the app with Electron Builder
├── electron/ # Electron main process
│ ├── main/
│ │ ├── api/ # tRPC API routes
│ │ │ └── index.ts # API router definition
│ │ └── index.ts # Main process entry
│ └── preload/
│ └── index.ts # Preload script
├── src/ # Vue renderer process
│ ├── assets/ # Static assets
│ ├── App.tsx # Root Vue component
│ ├── api.ts # tRPC client setup
│ ├── main.ts # Vue app entry
│ └── vite-env.d.ts # Vite type definitions
├── build/ # Build resources
├── public/ # Public assets
├── package.json # Dependencies and scripts
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript configuration
└── electron-builder.json5 # Electron Builder config
This boilerplate includes a fully configured tRPC setup:
- Located in
electron/main/api/index.ts
- Includes example query and subscription procedures
- Uses Zod for input validation
- Supports real-time communication via EventEmitter
- Located in
src/api.ts
- Configured with
ipcLink
for IPC communication - Fully type-safe API calls
// In your Vue component
import { api } from './api'
// Query example
const greeting = await api.greeting.query({ name: 'World' })
console.log(greeting.text) // "Hello World"
// Subscription example
api.sub.subscribe(undefined, {
onData: (data) => {
console.log('Received:', data.text)
}
})
Tailwind CSS is pre-configured and ready to use:
// Example component with Tailwind classes
export default defineComponent({
render() {
return (
<div class="flex items-center justify-center h-screen bg-gray-100">
<h1 class="text-4xl font-bold text-blue-600">
Hello Electron + Vue 3!
</h1>
</div>
)
}
})
yarn dev
- Start development serveryarn build
- Build for productionyarn preview
- Preview production buildyarn lint
- Run ESLintyarn lint:fix
- Fix ESLint issues
- Windows (win32)
- macOS (darwin)
- Linux
Supports both x64 and arm64 architectures.
electron-trpc
- tRPC integration for Electron@trpc/client
&@trpc/server
- tRPC coretailwindcss
&@tailwindcss/vite
- Stylingzod
- Schema validationvue
- Vue 3 framework
electron
- Electron frameworkelectron-builder
- App packagingvite
- Build tooltypescript
- TypeScript compilereslint
- Code linting- Various Vite plugins for Vue and Electron integration
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
dortanes
- GitHub: @dortanes
⭐ If you find this boilerplate helpful, please consider giving it a star!