This template provides a quick start for developing desktop applications using React, Tailwind CSS, Shadcn UI, Vite, and Electron. It includes a pre-configured setup with TypeScript support and essential development tools.
git clone <repository-url>
cd <project-name>
pnpm install
# or
npm install
pnpm run dev
# or
npm run dev
This will start both the Vite + React development server and Electron application.
├── src/
│ ├── electron/ # Electron main process files
│ │ ├── main.ts # Main process entry point
│ │ ├── preload.cts # Preload script for secure IPC
│ │ └── tsconfig.json # TypeScript config for Electron
│ └── renderer/ # React application files
├── package.json # Project configuration
└── vite.config.ts # Vite configuration
pnpm run dev
: Start development server (both React and Electron)pnpm run dev:react
: Start only React development serverpnpm run dev:electron
: Start only Electron in development modepnpm run build:react
: Build React applicationpnpm run transpile:electron
: Transpile Electron main process filespnpm run dist:win
: Build Windows executablepnpm run dist:mac
: Build macOS executablepnpm run dist:linux
: Build Linux executablepnpm run lint
: Run ESLintThe template includes a pre-configured IPC (Inter-Process Communication) setup between the main process and renderer process. Here's how to use it:
// In your React component
const handleSendMessage = async () => {
const response = await window.electron.sendMessage("Hello!");
console.log(response);
};
const handleDivide = async () => {
const result = await window.electron.divideOperation({
number1: 10,
number2: 2,
});
console.log(result);
};
const handleFileSelect = async () => {
const filePath = await window.electron.selectFile();
console.log(filePath);
};
To build the application for production:
pnpm run build:react
# For Windows
pnpm run dist:win
# For macOS
pnpm run dist:mac
# For Linux
pnpm run dist:linux
The built applications will be available in the dist
directory.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.