A modern desktop application template combining the best of web technologies with native desktop capabilities. This template embeds a SvelteKit development server within a NeutralinoJS client window, providing hot-reload during development and native API access.
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Desktop Window ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā NeutralinoJS Container ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā SvelteKit Dev Server ā ā ā
ā ā ā (http://localhost:5173) ā ā ā
ā ā ā ā ā ā
ā ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā ā
ā ā ā ā Svelte Application ā ā ā ā
ā ā ā ā ⢠Hot Module Replacement (HMR) ā ā ā ā
ā ā ā ā ⢠Native API Integration ā ā ā ā
ā ā ā ā ⢠Tailwind Styling ā ā ā ā
ā ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
.
āāā deno.json # Deno task runner configuration
āāā scripts/
ā āāā setup.sh # Unix setup script
ā āāā setup.bat # Windows setup script
āāā src/
ā āāā client/ # NeutralinoJS client
ā ā āāā neutralino.config.json
ā ā āāā .gitignore
ā āāā server/ # SvelteKit application
ā āāā package.json
ā āāā svelte.config.js
ā āāā vite.config.ts
ā āāā tsconfig.json
ā āāā src/
ā āāā app.html
ā āāā app.d.ts
ā āāā lib/
ā ā āāā index.ts
ā ā āāā neutralino.ts # Neutralino integration
ā ā āāā assets/
ā āāā routes/
ā āāā +layout.svelte
ā āāā +page.svelte
ā āāā layout.css
npm install -g @neutralinojs/neu
Install npm dependencies:
deno task install
Generate SvelteKit types and sync configuration:
deno task prepare
Note: This generates the
.svelte-kit/tsconfig.jsonfile that the project extends. Run this whenever you add new dependencies or change SvelteKit configuration.
Download Neutralino binaries:
cd src/client && neu update
deno task dev:neutralino
This starts both the SvelteKit dev server and the Neutralino client simultaneously.
Terminal 1 - Start SvelteKit dev server:
deno task dev:server
Terminal 2 - Start Neutralino client:
deno task dev:client
deno task dev
Open http://localhost:5173 in your browser.
If you see errors like Cannot find type definition file for 'node' or Cannot find module '@sveltejs/kit':
deno task install to install npm dependenciesdeno task prepare to generate SvelteKit typesRun deno task prepare to generate the SvelteKit configuration files.
Make sure the SvelteKit dev server is running on port 5173 before starting the Neutralino client.
| Task | Description |
|---|---|
deno task install |
Install npm dependencies |
deno task dev |
Start SvelteKit dev server on port 5173 |
deno task dev:server |
Alias for dev with host binding |
deno task dev:client |
Start Neutralino client |
deno task dev:neutralino |
Run both dev server and client |
| Task | Description |
|---|---|
deno task build |
Build SvelteKit for production |
deno task build:server |
Build SvelteKit to client resources |
deno task build:client |
Build Neutralino binaries |
deno task build:neutralino |
Build complete application |
| Task | Description |
|---|---|
deno task check |
Run TypeScript type checking |
deno task lint |
Run ESLint and Prettier checks |
deno task format |
Format code with Prettier |
The template supports full hot module replacement (HMR):
Use the $lib/neutralino module to access native capabilities:
<script lang="ts">
import { isNeutralino, showNotification, selectFile, closeApp } from '$lib/neutralino';
async function handleNotify() {
await showNotification('Hello', 'From Svelte!');
}
async function handleOpenFile() {
const files = await selectFile({
filters: [{ name: 'Images', extensions: ['png', 'jpg', 'gif'] }]
});
console.log('Selected:', files);
}
</script>
<button onclick={handleNotify} disabled={!isNeutralino()}>
Show Notification
</button>
closeApp(), restartApp()showNotification(), showMessageBox(), selectFile(), saveFile()readTextFile(), writeTextFile(), createDirectory()setStorageItem(), getStorageItem()getSystemInfo()src/server/svelte.config.js)The template uses @sveltejs/adapter-static to build for Neutralino:
adapter: adapter({
pages: '../client/resources',
assets: '../client/resources',
fallback: 'index.html'
})
src/client/neutralino.config.json)Key settings for development:
{
"url": "/",
"enableNativeAPI": true,
"nativeAllowList": [
"app.*",
"os.*",
"filesystem.*",
"storage.*",
"computer.*"
]
}
src/server/vite.config.ts)Configured for cross-origin requests from Neutralino:
server: {
host: true,
cors: { origin: '*' }
}
To create a production release:
# Build everything
deno task build:neutralino
# Output location
src/client/dist/
The production build:
src/client/resources/src/client/dist/Use Neutralino's filesystem API for cross-platform path handling:
import { readTextFile, writeTextFile } from '$lib/neutralino';
// Works on all platforms
const content = await readTextFile('./data/config.json');
import { getSystemInfo } from '$lib/neutralino';
const info = await getSystemInfo();
console.log(info.os.name); // 'Windows', 'Darwin', 'Linux'
If you see Cannot find module errors:
deno task prepare # Generate SvelteKit types
deno task install # Reinstall dependencies
Ensure you're running the app through Neutralino:
# Don't just open in browser
deno task dev # Only starts SvelteKit
# Use instead:
deno task dev:neutralino # Starts both
host: true is set in vite.config.tsMIT - See LICENSE for details.
Contributions welcome! Please follow the existing code style and ensure: