A modern starter template for building cross-platform desktop applications using Electron and SvelteKit with TypeScript support.
tsconfig.json
)vite.config.ts
)preload.cjs
)main
and renderer
processesapp.css
scripts/
folder# Clone the repository
git clone https://github.com/chinni-03/electron-sveltekit-template.git
cd electron-sveltekit-template
npm install
npm run dev
electron-sveltekit-template/
āāā electron # Electron folder for main and preload files
| āāā main.js # Electron main process entry
| āāā preload.cjs # Preload script (CommonJS)
āāā src/
ā āāā lib/ # Shared libraries and utilities
ā āāā routes/ # SvelteKit routes and pages
ā āāā app.css # Global styles
ā āāā app.d.ts # TypeScript declarations
ā āāā app.html # Main HTML template
āāā scripts/
ā āāā dev-electron.js # Electron development script
āāā static/ # Static assets (images, fonts, etc.)
āāā .gitignore # Git ignore rules
āāā .npmrc # npm configuration
āāā package-lock.json # Exact dependency tree
āāā package.json # Project metadata and scripts
āāā README.md # This file
āāā svelte.config.js # SvelteKit configuration
āāā tsconfig.json # TypeScript configuration
āāā vite.config.ts # Vite configuration
Script | Description |
---|---|
dev |
Start development server with HMR |
build |
Build production-ready application |
preview |
Preview production build locally |
package |
Package application for current OS |
make |
Create distributables for all platforms |
Edit main.js
to configure:
Modify preload.cjs
to:
Adjust vite.config.ts
for:
static/
folder tsc --noEmit
to check types without compiling# Build the application
npm run build
Solution:
Delete node_modules
and package-lock.json
, then run:
npm install
Solution:
preload.cjs
main.js
is correct:// In main.js
webPreferences: {
preload: path.join(__dirname, 'preload.cjs')
}
We welcome contributions! Here's how to get started:
git checkout -b feature-branch
git commit -am 'Add new feature'
git push origin feature-branch
This project is licensed under the MIT License - see the LICENSE file for full details.
For support, please:
Built with ā¤ļø by chinni-03