๐ A modern Electron app boilerplate with React v19, TypeScript v5, TailwindCSS v3, Ant Design v5, SQLite3 database, and automated GitHub releases.
๐ฅ Fast and Ready-to-go with a well-thought-out structure
๐ Hot reload for main process and Fast Refresh for renderer
๐ React Router DOM for seamless navigation
๐ Preload (context bridge) already configured
๐ฎ Automated GitHub releases for Windows, Mac and Linux
๐๏ธ SQLite3 database with TypeORM integration
๐ Internationalization (i18n) with react-i18next
๐จ Modern UI with Ant Design components
๐ Electron v36.3.2
โ๏ธ React v19.1.0
๐ React Router DOM v7.6.1
๐ TypeScript v5.8.3
๐ฆ Electron Forge v7.8.1
โจ TailwindCSS v3.4.17
๐จ Ant Design v5.25.4
๐๏ธ better-sqlite3 v11.10.0 + TypeORM v0.3.24
๐ i18next v25.2.1 + react-i18next v15.5.2
๐ซ ESLint + Prettier with TailwindCSS plugin
๐ฎ GitHub Actions for automated releases
This project follows a well-structured layered architecture pattern:
This template provides a type-safe, structured approach for Renderer-Main process communication. Here's how it works:
Here's the IPC communication flow visualized with UML:
sequenceDiagram
participant Renderer as Renderer Process
participant Preload as Preload Script
participant Main as Main Process
participant Handler as IPC Handler
participant Service as Welcome Service
Renderer->>Preload: 1. Call window.electron.welcome.getWelcome()
Preload->>Main: 2. Send IPC message
Main->>Handler: 3. Route to welcome.ipc.ts
Handler->>Service: 4. Execute welcomeService.getWelcome()
Service-->>Handler:
Handler-->>Main:
Main-->>Preload: 5. Return response
Preload-->>Renderer:
- Declare interfaces in
src/types/electron.d.ts:
declare global {
interface Window {
electron: {
welcome: {
getWelcome: () => Promise<Welcome>;
};
};
}
}- Configure IPC channels in
src/shared/config.ts:
export const config = {
welcome: {
getWelcome: createIpcChannel<void, Welcome>('welcome/getWelcome'),
},
};- Implement handler in
src/main/ipc/:
// welcome.ipc.ts
config.welcome.getWelcome.handle(async () => {
return welcomeService.getWelcome();
});- Call from Renderer:
const welcome = await window.electron.welcome.getWelcome();- Type Safety: Full TypeScript support end-to-end
- Separation of Concerns: Handlers stay in main process
- Discoverability: All IPC endpoints in shared config
- Testability: Handlers are pure functions
- Group related methods under namespaces
- Keep handlers thin - delegate to services
- Use JSDoc for complex parameter types
- Add error handling in services
Windows Layer โ IPC Layer โ IPC Layout โ Service Layout โ Repository Layout
src/
โโโ main/
โ โโโ database/ # Database configuration and entities
โ โโโ ipc/ # Inter-Process Communication handlers
โ โโโ main.ts # Main process entry point
โ โโโ services/ # Business logic and service layer
โ โโโ utils/ # Utility functions and helpers
โ โโโ windows/ # Window management and creation
โโโ preload/
โ โโโ preload.ts # Preload scripts for secure context bridge
โโโ renderer/
โ โโโ App.tsx # Main React application component
โ โโโ assets/ # Static assets (images, icons, etc.)
โ โโโ config/ # Frontend configuration
โ โโโ i18n/ # Internationalization files
โ โโโ layout/ # UI layout components
โ โโโ pages/ # Application pages/screens
โ โโโ renderer.css # Global styles
โ โโโ renderer.html # HTML template
โ โโโ renderer.ts # Renderer process entry point
โ โโโ styles/ # CSS/SCSS style files
โโโ shared/
โ โโโ config-utils.ts # Shared configuration utilities
โ โโโ config.ts # Application configuration
โ โโโ ipc-channel.ts # IPC channel definitions
โ โโโ ipc-subscription.ts # IPC event subscriptions
โโโ types/
โโโ custom.d.ts # Custom type definitions
โโโ electron.d.ts # Electron-specific types- ๐ช Windows Layer: Manages application windows and their lifecycle
- ๐ก IPC Layer: Handles communication between main and renderer processes
- ๐จ IPC Layout: Organizes IPC communication patterns and data flow
- โ๏ธ Service Layer: Contains business logic and application services
- ๐๏ธ Repository Layer: Manages data access and database operations
- Node.js 20+
- npm 10+
# Create a new project
npx @wuchuheng/electron my-app
cd my-app
# Install dependencies
npm install
# Start development
npm run startNote: After creating your project, update the
package.jsonfile with your project details (name, description, author, etc.).
# Start development server
npm run start
# Format code
npm run format
# Lint code
npm run lint
# Generate app icons
npm run gen:logoNote: Check Electron Forge docs for more information
npm run make# Windows
npm run make --platform=win32
# macOS
npm run make --platform=darwin
# Linux
npm run make --platform=linuxnpm run packageThe built applications will be available in the out folder.
Note: contributions are always welcome, but always ask first, โ please โ before work on a PR.
That said, there's a bunch of ways you can contribute to this project, like by:
๐ชฒ Reporting a bug
๐ Improving this documentation
๐จ Sharing this project and recommending it to your friends
๐ต Supporting this project on GitHub Sponsors
๐ Giving a star on this repository
MIT ยฉ Wuchuheng
Wuchuheng
- Website: https://wuchuheng.com
- Github: @wuchuheng
Give a โญ๏ธ if this project helped you!
