A

Advanced Deslop Platform

Comprehensive skill designed for remove, generated, code, slop. Includes structured workflows, validation checks, and reusable patterns for sentry.

SkillClipticssentryv1.0.0MIT
0 views0 copies

Advanced Deslop Platform

A desktop application development skill for building cross-platform desktop apps using frameworks like Electron, Tauri, and native platform APIs, covering packaging, auto-updates, and system integration.

When to Use

Choose Advanced Deslop Platform when:

  • Building cross-platform desktop applications with web technologies
  • Packaging web apps as native desktop applications with system tray and notifications
  • Implementing auto-update mechanisms, native file system access, and OS integration
  • Choosing between Electron, Tauri, or native frameworks for a desktop project

Consider alternatives when:

  • Building a purely web-based application — deploy as a PWA instead
  • Targeting only one platform — use native SDKs for best performance
  • Building a simple utility — a CLI tool may be more appropriate

Quick Start

# Create a new Tauri app (Rust + web frontend) npm create tauri-app@latest my-desktop-app -- --template react-ts # Create a new Electron app npm init electron-app@latest my-electron-app -- --template=webpack-typescript
// Tauri application setup with system tray import { invoke } from '@tauri-apps/api/core'; import { TrayIcon } from '@tauri-apps/api/tray'; import { Menu, MenuItem } from '@tauri-apps/api/menu'; async function setupApp() { // Invoke Rust backend function const result = await invoke<string>('greet', { name: 'User' }); console.log(result); // Create system tray const menu = await Menu.new({ items: [ await MenuItem.new({ text: 'Show Window', action: () => { const { getCurrentWindow } = window.__TAURI__.window; getCurrentWindow().show(); } }), await MenuItem.new({ text: 'Quit', action: () => { const { exit } = window.__TAURI__.process; exit(0); } }) ] }); await TrayIcon.new({ icon: 'icons/icon.png', menu, tooltip: 'My Desktop App' }); } // Rust backend (src-tauri/src/main.rs) /* #[tauri::command] fn greet(name: &str) -> String { format!("Hello, {}! You've been greeted from Rust!", name) } fn main() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![greet]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } */

Core Concepts

Framework Comparison

FeatureElectronTauriFlutterQt
LanguageJS/TSRust + JS/TSDartC++
Bundle Size~150 MB~5-10 MB~20 MB~30 MB
Memory UsageHighLowMediumLow
Native APIsVia Node.jsVia Rust pluginsVia platform channelsDirect
Auto Updateelectron-updaterTauri updaterManualQt Installer
Cross PlatformWin/Mac/LinuxWin/Mac/LinuxWin/Mac/Linux/MobileWin/Mac/Linux

Native System Integration

// Electron: File system and dialog integration import { app, BrowserWindow, dialog, ipcMain, Notification } from 'electron'; import * as fs from 'fs'; import * as path from 'path'; class DesktopApp { private mainWindow: BrowserWindow | null = null; createWindow() { this.mainWindow = new BrowserWindow({ width: 1200, height: 800, webPreferences: { preload: path.join(__dirname, 'preload.js'), contextIsolation: true, nodeIntegration: false }, titleBarStyle: 'hiddenInset' }); } setupIPC() { ipcMain.handle('open-file', async () => { const result = await dialog.showOpenDialog(this.mainWindow!, { properties: ['openFile'], filters: [ { name: 'Documents', extensions: ['txt', 'md', 'json'] }, { name: 'All Files', extensions: ['*'] } ] }); if (!result.canceled && result.filePaths.length > 0) { return fs.readFileSync(result.filePaths[0], 'utf-8'); } return null; }); ipcMain.handle('save-file', async (_event, content: string) => { const result = await dialog.showSaveDialog(this.mainWindow!, { filters: [{ name: 'Text Files', extensions: ['txt'] }] }); if (!result.canceled && result.filePath) { fs.writeFileSync(result.filePath, content); new Notification({ title: 'File Saved', body: `Saved to ${result.filePath}` }).show(); return true; } return false; }); } }

Configuration

OptionDescriptionDefault
frameworkDesktop framework: electron, tauri, flutter"tauri"
window_widthDefault window width in pixels1200
window_heightDefault window height in pixels800
system_trayEnable system tray iconfalse
auto_updateEnable auto-update mechanismtrue
single_instancePrevent multiple app instancestrue
deep_linkingRegister custom URL protocolfalse
native_menusUse native menu bartrue

Best Practices

  1. Use Tauri for new projects unless you specifically need Node.js APIs in the main process — Tauri produces dramatically smaller bundles (5-10 MB vs 150 MB), uses less memory, and has better security defaults with its Rust backend
  2. Always enable context isolation in Electron and use a preload script to expose only necessary APIs to the renderer process — direct nodeIntegration is a critical security risk that exposes the full Node.js API to web content
  3. Implement graceful update flows that download updates in the background and prompt users to restart rather than forcing immediate updates that interrupt their work
  4. Handle offline scenarios since desktop apps are expected to work without internet — cache resources locally, queue operations for when connectivity returns, and show clear offline status indicators
  5. Test on all target platforms in CI/CD because each OS has different window management, file system conventions, and permission models that can cause platform-specific bugs

Common Issues

Large Electron bundle sizes: Electron ships a full Chromium browser, resulting in 150+ MB downloads. Use tools like electron-builder with compression, enable ASAR archives, exclude unnecessary files from the bundle, and consider Tauri as an alternative for significantly smaller distributable sizes.

Code signing and notarization failures: macOS requires apps to be signed and notarized for distribution. Set up Apple Developer certificates in CI, configure electron-builder or tauri-action with proper signing credentials, and allow time for Apple's notarization service to process the build before distributing.

Auto-update mechanism breaking: Updates can fail silently or corrupt installations if the update server is misconfigured. Test the complete update flow end-to-end (download, verify signature, install, restart) in a staging environment, implement rollback mechanisms, and log update events to diagnose failures remotely.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates