A modern, production-ready template for building cross-platform desktop applications with Next.js and Electron.
- π Next.js 15 - Latest App Router with React 19
- β‘ Electron 37 - Cross-platform desktop app framework
- π¨ Mantine 8 - Modern React components library with dark mode support
- π Emotion - CSS-in-JS styling with excellent performance
- π§ Tailwind CSS 4 - Utility-first CSS framework
- π¦ Sass - Enhanced CSS with variables and mixins
- π― TypeScript - Full type safety throughout the stack
- π₯ Hot Reload - Fast development with instant updates
- π± Responsive Design - Mobile-first approach with adaptive layouts
- π Dark Mode - Built-in dark/light theme switching
- π SVG Support - Automatic SVG to React component conversion
- π¦ Auto Updates - Ready for electron-updater integration
- π Security - Context isolation and secure preload scripts
Category | Technology | Purpose |
---|---|---|
Frontend | Next.js 15 + React 19 | Modern web application framework |
Desktop | Electron 37 | Cross-platform desktop runtime |
UI Library | Mantine 8 | Component library with theming |
Styling | Emotion + Tailwind CSS + Sass | Multi-layered styling solution |
Language | TypeScript | Type-safe development |
Package Manager | pnpm | Fast, efficient package management |
Build Tool | tsup | TypeScript bundler for Electron |
Code Quality | ESLint + dprint | Linting and formatting |
- Node.js 18+
- pnpm 8+
# Clone the repository
git clone https://github.com/AIEPhoenix/aie-nextjs-electron-template.git
cd aie-nextjs-electron-template
# Install dependencies
pnpm install
# Start development server
pnpm dev
The application will launch with:
- Next.js dev server at
http://localhost:3000
- Electron app window with hot reload enabled
pnpm dev # Start both Next.js and Electron in development
pnpm next:dev # Start Next.js development server only
pnpm electron:dev # Start Electron with hot reload only
pnpm build # Build for production
pnpm next:build # Build Next.js only
pnpm electron:build # Build Electron main process only
pnpm dist # Create distribution package
pnpm dist:nsis # Create Windows installer (NSIS)
pnpm dist:deb # Create Linux package (DEB)
pnpm next:lint # Run ESLint
pnpm format # Format code with dprint
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ layout.tsx # Root layout with providers
β β βββ page.tsx # Home page
β βββ components/ # React components
β β βββ basic/ # Core registry components
β βββ styles/ # Global styles and Sass files
β βββ types/ # TypeScript type definitions
β βββ assets/ # Static assets
βββ electron/
β βββ main.ts # Electron main process
β βββ preload.ts # Preload script for IPC
βββ public/ # Static files
βββ build/ # Compiled Electron files
βββ .next/ # Next.js build output
- Main Process: Manages app lifecycle and creates renderer processes
- Renderer Process: Runs the Next.js application
- Preload Script: Provides secure bridge between main and renderer
- Mantine: Primary UI components with built-in theming
- Emotion: Component-specific styling with CSS-in-JS
- Tailwind CSS: Utility classes for rapid development
- Sass: Global styles and Mantine customization
- Standalone Output: Next.js builds optimized for Electron packaging
- Code Splitting: Automatic bundle optimization
- Tree Shaking: Removes unused code for smaller builds
Create a .env.local
file for local development:
# Add your environment variables here
NEXT_PUBLIC_APP_NAME=Your App Name
Edit electron/main.ts
to customize window behavior:
const mainWindow = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 800,
minHeight: 600,
// Add more window options
})
- Mantine Theme: Modify
src/components/basic/MantineRegistry.tsx
- Tailwind Config: Edit
tailwind.config.js
- Global Styles: Update
src/styles/globals.css
# Build for current platform
pnpm dist
# Build for specific platforms
pnpm dist:nsis # Windows
pnpm dist:deb # Linux
Edit package.json
build configuration:
{
"build": {
"appId": "com.yourcompany.yourapp",
"productName": "Your App Name",
"directories": {
"output": "dist"
}
}
}
- 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.
- Next.js - The React Framework for Production
- Electron - Build cross-platform desktop apps
- Mantine - Modern React components library
- Tailwind CSS - Utility-first CSS framework
- Emotion - CSS-in-JS library
- π Documentation
- π Report Issues
- π¬ Discussions
Made with β€οΈ by AIEPhoenix
β Star this repository if it helped you!