A modern Electron application boilerplate built with Vite, React, TypeScript, and DaisyUI. This template provides a complete development environment with hot reload, auto-updater functionality, and a beautiful UI framework.
I created this boilerplate because I couldn't find thorough documentation on electron-builder NSIS and electron-updater auto updates. Setting up these features can be quite a headache, so I built this template with everything properly configured to help others avoid the same struggles.
- β‘οΈ Vite - Lightning fast build tool and dev server
- βοΈ React 18 - Modern React with hooks
- π TypeScript - Type safety and better developer experience
- π¨ DaisyUI - Beautiful component library built on Tailwind CSS
- π Hot Reload - Instant updates during development
- π¦ Auto Updater - Built-in update mechanism using electron-updater
- π§ ESLint - Code linting and formatting
- π± Cross-platform - Build for Windows, macOS, and Linux
- Node.js 18+
- npm or yarn
- Git
git clone https://github.com/kethakav/electron-vite-react-boilerplate.git
cd electron-vite-react-boilerplate
npm install
npm run dev
This will start both the Vite dev server and Electron in development mode with hot reload.
βββ electron/ # Electron main process files
β βββ main.ts # Main process entry point
β βββ preload.ts # Preload script for IPC
β βββ update.ts # Auto-updater logic
β βββ electron-env.d.ts # TypeScript definitions
βββ src/ # React application source
β βββ App.tsx # Main React component
β βββ main.tsx # React entry point
β βββ App.css # Component styles
β βββ assets/ # Static assets
βββ public/ # Public assets
βββ dist/ # Built renderer files
βββ dist-electron/ # Built main process files
βββ release/ # Release builds
βββ electron-builder.json # Electron Builder configuration
βββ vite.config.ts # Vite configuration
βββ package.json # Project dependencies and scripts
Before using this boilerplate for your project, you need to update the following files:
{
"name": "your-app-name",
"version": "1.0.0",
"description": "Your app description"
}
{
"appId": "com.yourcompany.yourapp",
"productName": "Your App Name",
"publish": {
"provider": "github",
"owner": "yourusername",
"repo": "your-repo-name"
}
}
<title>Your App Name</title>
Update the app title and branding:
<h1 className="text-4xl font-bold text-center mb-8 text-primary">Your App Name</h1>
Update the window icon:
icon: path.join(process.env.VITE_PUBLIC, 'your-icon.png'),
Replace the icons in the public/
directory:
vite.svg
- Your app iconelectron-vite.svg
- Alternative icon
Modify electron/main.ts
to customize the window:
win = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 800,
minHeight: 600,
// ... other options
})
The auto-updater is configured in electron/update.ts
. You can customize:
- Update check frequency
- Download behavior
- Update notifications
npm run dev
- Start development server with hot reloadnpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLint
npm run build
The build process will create distributable packages in the release/
directory:
- Windows:
.exe
installer - macOS:
.dmg
disk image - Linux:
.AppImage
and.deb
packages
This boilerplate includes a complete auto-update system:
- Automatic update checking
- Progress tracking
- Error handling
- User notifications
- Set up a GitHub repository for releases
- Update
electron-builder.json
with your repository details - Configure GitHub Actions for automated releases
The update system is automatically integrated. Users can check for updates via the UI button.
This boilerplate includes automated release publishing via GitHub Actions. Here's how to release a new version:
- GitHub Token: Create a personal access token with
repo
permissions - Repository Secret: Add your token as
RELEASE_PUSH_TOKEN
in your repository settings - Release Repository: Set up a separate repository for releases (e.g.,
your-app-releases
)
-
Update Version
# Update version in package.json npm version patch # or minor, major
-
Create and Push Tag
# Create a new tag (GitHub Actions will trigger on v* tags) git tag v1.0.1 git push origin v1.0.1
-
Automated Build
- GitHub Actions will automatically:
- Build the application
- Create Windows installer
- Publish to your release repository
- Update the auto-updater
- GitHub Actions will automatically:
Update these files for your release setup:
{
"publish": {
"provider": "github",
"owner": "yourusername",
"repo": "your-app-releases"
}
}
- Go to Settings β Secrets and variables β Actions
- Add
RELEASE_PUSH_TOKEN
with your GitHub token - Ensure the token has
repo
permissions
The workflow triggers on tags matching v*
pattern and:
- Builds the application
- Creates Windows installer
- Publishes to your release repository
- Enables auto-updates for users
This boilerplate uses DaisyUI, a component library built on Tailwind CSS:
- Buttons, cards, modals
- Forms and inputs
- Navigation and layout
- Theming and customization
Modify src/App.css
or create new CSS files for custom styles.
- Main process changes require app restart
- Renderer process changes are hot-reloaded automatically
- Use Chrome DevTools for renderer process
- Use VS Code debugger for main process
The boilerplate includes pre-configured IPC handlers for:
- Update checking
- Download progress
- Error handling
- Electron Documentation
- Vite Documentation
- React Documentation
- DaisyUI Documentation
- Electron Builder Documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This boilerplate was inspired by and built upon the excellent work of:
- Electronβ‘οΈVite - The best practice integration solution between Electron and Vite, providing the foundation for modern Electron development
- electron-vite-react - The Electron + Vite + React boilerplate that served as the primary inspiration and reference for this project
- DaisyUI - For the beautiful component library built on Tailwind CSS
- Vite - For the lightning-fast build tool and development server
- React - For the amazing UI library