A modern, lightweight desktop application template combining the power of Neutralino.js with SvelteKit, TypeScript, and Vite for fast development and optimal performance.
- π₯ Lightweight: Neutralino.js provides a smaller footprint alternative to Electron
- β‘ Fast Development: SvelteKit with Vite for instant HMR and blazing-fast builds
- π― Type Safety: Full TypeScript support throughout the project
- π± Cross-Platform: Build for Windows, macOS, and Linux from a single codebase (Neutralino.js supports Windows, macOS, Linux, and FreeBSD)
- π¨ Modern UI: Clean, responsive design with dark/light mode support
- π§ Developer Experience: Pre-configured with optimal settings and tooling
Traditional desktop app frameworks like Electron can be resource-heavy. This template provides:
- Smaller bundle sizes compared to Electron
- Lower memory usage for better performance
- Modern web technologies with desktop capabilities
- Fast development cycle with hot module replacement
- Easy deployment as static files
Before getting started, ensure you have the following installed:
- Bun (recommended) or Node.js (v18 or higher)
- Neutralino CLI (
npm install -g @neutralinojs/neu)
-
Clone the repository
git clone <your-repo-url> cd neutralino-sveltekit-template
-
Install dependencies
bun install # or npm install -
Initialize Neutralino
neu update
Start the development server with hot module replacement:
bun run dev
# or
npm run devThis will:
- Start the Vite development server
- Launch the Neutralino desktop application
- Enable live reloading for both frontend and desktop app changes
- Provide developer tools access in the desktop app
Create a production build:
bun run build
# or
npm run buildThe build process will:
- Build the SvelteKit application optimized for production
- Generate the Neutralino desktop application binaries
- Output the final application in the
dist/directory
neutralino-sveltekit-template/
βββ src/
β βββ lib/ # Reusable Svelte components
β β βββ App.svelte # Main application component
β β βββ Counter.svelte # Example counter component
β β βββ NeutralinoCheck.svelte # Neutralino API demo
β βββ routes/ # SvelteKit routes
β β βββ +layout.svelte # Root layout
β β βββ +layout.ts # Layout configuration
β β βββ +page.svelte # Home page
β βββ app.css # Global styles
β βββ app.html # HTML template
β βββ vite-env.d.ts # Vite type definitions
βββ static/ # Static assets
βββ public/ # Public assets (icon, etc.)
βββ neutralino.config.json # Neutralino configuration
βββ svelte.config.js # SvelteKit configuration
βββ vite.config.ts # Vite configuration with Neutralino plugin
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
The neutralino.config.json file contains the desktop application settings:
- Window properties: Size, title, icon, resizability
- Native API permissions: Control which Neutralino APIs are accessible
- Build settings: Binary name, output paths, and versions
The svelte.config.js configures:
- Adapter: Uses
@sveltejs/adapter-staticfor SPA generation - Aliases: Convenient import paths for common directories
- Build optimization: Configured for Neutralino's static file requirements
The vite.config.ts includes a custom Neutralino plugin that:
- Automatically starts the Neutralino app during development
- Copies assets and builds the desktop app in production
- Configures the development server for optimal integration
This template demonstrates integration with Neutralino's native APIs:
- OS Operations: Access file system, execute commands, get system info
- Computer Info: Retrieve hardware and operating system details
- App Control: Manage application lifecycle and window properties
Example usage in src/lib/NeutralinoCheck.svelte:
import { computer } from '@neutralinojs/lib'
let osInfo = computer.getOSInfo()| Command | Description |
|---|---|
bun run dev |
Start development server with Neutralino app |
bun run build |
Build for production |
bun run preview |
Preview production build |
bun run check |
Run Svelte type checking |
bun run check:watch |
Run type checking in watch mode |
The template includes:
- Modern CSS: CSS variables for theming and responsive design
- Dark/Light Mode: Automatic system preference detection
- Component Scoping: Svelte's scoped styling capabilities
- Responsive Layout: Mobile-first approach with desktop optimizations
- Update
package.json: Modify name, description, and author - Update
neutralino.config.json: Change applicationId, title, and window properties - Replace icons: Update files in
public/andstatic/directories - Modify metadata: Update title and meta tags in
src/app.html
- Create components: Add new
.sveltefiles insrc/lib/ - Add routes: Create new pages in
src/routes/ - Integrate APIs: Use Neutralino APIs for native functionality
- Style components: Use scoped CSS or global styles in
src/app.css
After building, you'll find platform-specific binaries in the dist/ directory:
- Windows:
.exeexecutable - macOS:
.appbundle - Linux: Binary executable
For production distribution, consider code signing your applications:
- Windows: Use
signtoolwith a code signing certificate - macOS: Use Xcode command line tools with Apple Developer certificate
- Linux: Use
gpgfor package signing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the ISC License - see the LICENSE file for details.
- Neutralino.js - Lightweight cross-platform desktop app framework
- SvelteKit - Full-stack web framework
- Vite - Next generation frontend tooling
- TypeScript - Typed JavaScript at scale
Happy coding! π If you find this template helpful, please consider giving it a β on GitHub.