packwise-skills 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursorrules +23 -23
- package/CLAUDE.md +25 -25
- package/LICENSE +21 -0
- package/README.md +404 -295
- package/audit.md +224 -224
- package/bin/packwise.js +322 -155
- package/install.sh +123 -0
- package/package.json +32 -31
- package/skill.md +944 -719
- package/sub-skills/ai/local-llm.md +183 -183
- package/sub-skills/ai/python-ml.md +164 -164
- package/sub-skills/backend/go-server.md +184 -184
- package/sub-skills/backend/java-spring.md +241 -241
- package/sub-skills/backend/node-server.md +164 -164
- package/sub-skills/backend/php-laravel.md +175 -175
- package/sub-skills/backend/python-server.md +164 -164
- package/sub-skills/backend/rust-backend.md +118 -118
- package/sub-skills/cli/python-cli.md +236 -236
- package/sub-skills/cli/sdk-library.md +497 -497
- package/sub-skills/cloud/ci-cd-pipelines.md +350 -350
- package/sub-skills/cloud/docker.md +191 -191
- package/sub-skills/cloud/kubernetes.md +277 -277
- package/sub-skills/cloud/payment-integration.md +307 -307
- package/sub-skills/cross-platform/multiplatform.md +252 -252
- package/sub-skills/desktop/electron.md +783 -783
- package/sub-skills/desktop/game-dev.md +443 -443
- package/sub-skills/desktop/native-app.md +123 -123
- package/sub-skills/desktop/scenarios.md +443 -443
- package/sub-skills/desktop/smart-platforms.md +324 -324
- package/sub-skills/desktop/tauri.md +428 -428
- package/sub-skills/desktop/vr-ar.md +252 -252
- package/sub-skills/desktop/web-to-desktop.md +153 -153
- package/sub-skills/embedded/car-infotainment.md +129 -129
- package/sub-skills/embedded/esp32.md +184 -184
- package/sub-skills/embedded/ros.md +150 -150
- package/sub-skills/embedded/stm32.md +160 -160
- package/sub-skills/mobile/android.md +322 -322
- package/sub-skills/mobile/capacitor.md +232 -232
- package/sub-skills/mobile/flutter-mobile.md +138 -138
- package/sub-skills/mobile/harmonyos.md +150 -150
- package/sub-skills/mobile/ios.md +245 -245
- package/sub-skills/mobile/react-native.md +443 -443
- package/sub-skills/mobile/wearables.md +230 -230
- package/sub-skills/plugins/browser-extension.md +308 -308
- package/sub-skills/plugins/jetbrains-plugin.md +226 -226
- package/sub-skills/plugins/vscode-extension.md +204 -204
- package/sub-skills/security/security-tools.md +174 -174
- package/sub-skills/web/monorepo.md +274 -274
- package/sub-skills/web/pwa.md +220 -220
- package/sub-skills/web/serverless-edge.md +295 -295
- package/sub-skills/web/spa.md +266 -266
- package/sub-skills/web/ssr.md +228 -228
- package/sub-skills/web/wasm.md +243 -243
|
@@ -1,443 +1,443 @@
|
|
|
1
|
-
# Desktop Application Scenarios Guide
|
|
2
|
-
|
|
3
|
-
Covers the most common desktop application types for indie developers and small teams. Each scenario provides specific technology recommendations and packaging considerations.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Scenario 1: AI Chatbot / Knowledge Base
|
|
8
|
-
|
|
9
|
-
**Reference Products**: Claude Desktop, ChatGPT Desktop, OpenCat
|
|
10
|
-
|
|
11
|
-
**Recommended Stack**: Electron + React + Express + SQLite
|
|
12
|
-
|
|
13
|
-
**Key Requirements**:
|
|
14
|
-
- LLM API calls (streaming response)
|
|
15
|
-
- Local conversation history persistence
|
|
16
|
-
- TTS voice synthesis (optional)
|
|
17
|
-
- Multi-model switching
|
|
18
|
-
|
|
19
|
-
**Packaging Considerations**:
|
|
20
|
-
- SSE streaming adaptation (ensure correct forwarding in Electron)
|
|
21
|
-
- Store conversation history in SQLite (more reliable than localStorage)
|
|
22
|
-
- Encrypt API keys (AES-256-CBC)
|
|
23
|
-
- TTS audio queue management (prevent concurrent playback)
|
|
24
|
-
|
|
25
|
-
**Typical Size**: 130–180MB
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Scenario 2: Cloud Architecture Monitor
|
|
30
|
-
|
|
31
|
-
**Reference Products**: Portainer Desktop, Lens, k9s GUI
|
|
32
|
-
|
|
33
|
-
**Recommended Stack**: Electron/Tauri + React + Go backend
|
|
34
|
-
|
|
35
|
-
**Key Requirements**:
|
|
36
|
-
- Connect to multiple cloud clusters (K8s, Docker)
|
|
37
|
-
- Real-time status refresh (WebSocket)
|
|
38
|
-
- Resource topology visualization
|
|
39
|
-
- Alert push notifications
|
|
40
|
-
|
|
41
|
-
**Packaging Considerations**:
|
|
42
|
-
- WebSocket connections need correct proxy in Electron
|
|
43
|
-
- kubeconfig file secure storage
|
|
44
|
-
- TLS certificate handling (self-signed certificates)
|
|
45
|
-
- System notification integration
|
|
46
|
-
|
|
47
|
-
**Typical Size**: 100–150MB
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Scenario 3: Local ERP / OA System
|
|
52
|
-
|
|
53
|
-
**Reference Products**: Kingdee Desktop, Yonyou U8 Client
|
|
54
|
-
|
|
55
|
-
**Recommended Stack**: Electron + Vue/React + Node/Java + MySQL/SQLite
|
|
56
|
-
|
|
57
|
-
**Key Requirements**:
|
|
58
|
-
- Complex forms and reports
|
|
59
|
-
- Print module (invoices, contracts)
|
|
60
|
-
- File export (Excel, PDF)
|
|
61
|
-
- Multi-role permissions
|
|
62
|
-
|
|
63
|
-
**Packaging Considerations**:
|
|
64
|
-
- Print: `window.print()` or system print API
|
|
65
|
-
- Excel export: `xlsx` library (note file save path in Electron)
|
|
66
|
-
- PDF generation: `pdfmake` or `puppeteer`
|
|
67
|
-
- Large data table virtual scrolling
|
|
68
|
-
- Offline-first architecture (local cache, sync on reconnect)
|
|
69
|
-
|
|
70
|
-
**Typical Size**: 150–200MB
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Scenario 4: Quantitative Trading Terminal
|
|
75
|
-
|
|
76
|
-
**Reference Products**: JoinQuant Terminal, QMT, TradingView Desktop
|
|
77
|
-
|
|
78
|
-
**Recommended Stack**: Electron + React + Python/C++ backend
|
|
79
|
-
|
|
80
|
-
**Key Requirements**:
|
|
81
|
-
- Real-time market data push (WebSocket/MQTT)
|
|
82
|
-
- K-line chart rendering (Canvas/WebGL)
|
|
83
|
-
- Backtesting engine
|
|
84
|
-
- Strategy editor
|
|
85
|
-
- Order execution
|
|
86
|
-
|
|
87
|
-
**Packaging Considerations**:
|
|
88
|
-
- High-frequency data: WebSocket connection pool management
|
|
89
|
-
- Chart performance: `lightweight-charts` or `echarts` + Canvas
|
|
90
|
-
- Python backend integration: subprocess or HTTP API with Python backtest engine
|
|
91
|
-
- Security: encrypt trading keys
|
|
92
|
-
- Offline cache: historical market data in SQLite
|
|
93
|
-
|
|
94
|
-
**Typical Size**: 100–200MB
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Scenario 5: IoT Control Panel
|
|
99
|
-
|
|
100
|
-
**Reference Products**: Tuya Smart Desktop, Home Assistant Desktop
|
|
101
|
-
|
|
102
|
-
**Recommended Stack**: Tauri/Electron + Vue + Go/MQTT
|
|
103
|
-
|
|
104
|
-
**Key Requirements**:
|
|
105
|
-
- MQTT device communication
|
|
106
|
-
- Device state real-time display
|
|
107
|
-
- Scene automation configuration
|
|
108
|
-
- Data history charts
|
|
109
|
-
|
|
110
|
-
**Packaging Considerations**:
|
|
111
|
-
- MQTT client: `mqtt.js` (Web) or native MQTT library
|
|
112
|
-
- Device discovery: UDP broadcast (requires native network permission)
|
|
113
|
-
- Low power: reduce refresh rate when backgrounded
|
|
114
|
-
- System tray: resident background, notification push
|
|
115
|
-
|
|
116
|
-
**Typical Size**: 50–100MB
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Scenario 6: IM Chat Client
|
|
121
|
-
|
|
122
|
-
**Reference Products**: Telegram Desktop, Feishu, WeCom
|
|
123
|
-
|
|
124
|
-
**Recommended Stack**: Electron/Tauri + React + Go/Rust
|
|
125
|
-
|
|
126
|
-
**Key Requirements**:
|
|
127
|
-
- Real-time messaging (WebSocket)
|
|
128
|
-
- File/image transfer
|
|
129
|
-
- Group/channel support
|
|
130
|
-
- Message search
|
|
131
|
-
- Local message cache
|
|
132
|
-
|
|
133
|
-
**Packaging Considerations**:
|
|
134
|
-
- Message encryption: E2E encryption (Signal Protocol or custom)
|
|
135
|
-
- File transfer: chunked upload/download, resume support
|
|
136
|
-
- Message storage: SQLite + FTS5 full-text search
|
|
137
|
-
- Notification: native system notifications + unread badge
|
|
138
|
-
- Custom protocol: `myapp://` protocol handler (for link jumps)
|
|
139
|
-
|
|
140
|
-
**Typical Size**: 100–200MB
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## Scenario 7: SaaS Desktop Client
|
|
145
|
-
|
|
146
|
-
**Reference Products**: Notion Desktop, Linear, Slack
|
|
147
|
-
|
|
148
|
-
**Recommended Stack**: Electron/Tauri + React/Vue
|
|
149
|
-
|
|
150
|
-
**Key Requirements**:
|
|
151
|
-
- Feature parity with web version
|
|
152
|
-
- Desktop notifications
|
|
153
|
-
- Offline support (optional)
|
|
154
|
-
- File drag-and-drop upload
|
|
155
|
-
- Deep links (`myapp://`)
|
|
156
|
-
|
|
157
|
-
**Packaging Considerations**:
|
|
158
|
-
- If essentially a web wrapper: Pake or Electron both work
|
|
159
|
-
- Offline support: Service Worker + IndexedDB
|
|
160
|
-
- Auto-update: `electron-updater` (Electron) or Tauri built-in updater
|
|
161
|
-
- Single instance lock: prevent duplicate windows
|
|
162
|
-
- Window state memory: remember size and position
|
|
163
|
-
|
|
164
|
-
**Typical Size**: 100–150MB
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Scenario 8: Database Management Tool
|
|
169
|
-
|
|
170
|
-
**Reference Products**: Navicat, DBeaver, pgAdmin Desktop
|
|
171
|
-
|
|
172
|
-
**Recommended Stack**: Electron + React + Go/Rust
|
|
173
|
-
|
|
174
|
-
**Key Requirements**:
|
|
175
|
-
- Multi-database connection (MySQL/PostgreSQL/SQLite/MongoDB)
|
|
176
|
-
- SQL editor (syntax highlighting, autocomplete)
|
|
177
|
-
- Table structure management
|
|
178
|
-
- Data import/export
|
|
179
|
-
- Query history
|
|
180
|
-
|
|
181
|
-
**Packaging Considerations**:
|
|
182
|
-
- Multi-database drivers: Go/Rust backend wraps native drivers, communicates via IPC
|
|
183
|
-
- SQL editor: Monaco Editor or CodeMirror
|
|
184
|
-
- Large dataset handling: virtual scrolling + pagination
|
|
185
|
-
- Connection config encrypted storage
|
|
186
|
-
|
|
187
|
-
**Typical Size**: 100–200MB
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Scenario 9: Indie Game
|
|
192
|
-
|
|
193
|
-
**Reference Products**: Stardew Valley, Hollow Knight, Hades
|
|
194
|
-
|
|
195
|
-
**Recommended Engine**:
|
|
196
|
-
- **Unity**: 2D/3D universal, C#, most mature cross-platform
|
|
197
|
-
- **Godot**: Free and open-source, GDScript/C#, lightweight
|
|
198
|
-
|
|
199
|
-
**Key Requirements**:
|
|
200
|
-
- Game loop and rendering
|
|
201
|
-
- Input handling (keyboard/mouse/gamepad)
|
|
202
|
-
- Audio engine
|
|
203
|
-
- Save system
|
|
204
|
-
- Steam/itch.io integration
|
|
205
|
-
|
|
206
|
-
**Packaging Considerations**:
|
|
207
|
-
- Unity: IL2CPP build + Asset Bundles
|
|
208
|
-
- Godot: export templates + resource packaging
|
|
209
|
-
- Steam integration: Steamworks SDK (achievements, leaderboard, cloud saves)
|
|
210
|
-
- Performance: shader compilation, texture compression, LOD system
|
|
211
|
-
|
|
212
|
-
**Typical Size**: 200–500MB
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## Scenario 10: Online Education Client
|
|
217
|
-
|
|
218
|
-
**Reference Products**: Youdao Dictionary, Tencent Classroom, Zoom
|
|
219
|
-
|
|
220
|
-
**Recommended Stack**: Electron + React + WebRTC
|
|
221
|
-
|
|
222
|
-
**Key Requirements**:
|
|
223
|
-
- Video live/recorded playback
|
|
224
|
-
- Screen sharing
|
|
225
|
-
- Whiteboard functionality
|
|
226
|
-
- Chat/danmaku
|
|
227
|
-
- Courseware display (PPT/PDF)
|
|
228
|
-
|
|
229
|
-
**Packaging Considerations**:
|
|
230
|
-
- WebRTC: `simple-peer` or `mediasoup-client`
|
|
231
|
-
- Screen sharing: Electron `desktopCapturer` API
|
|
232
|
-
- Video playback: HLS/DASH streaming (`hls.js`, `dash.js`)
|
|
233
|
-
- Whiteboard: Canvas drawing + real-time sync
|
|
234
|
-
- Audio: echo cancellation (AEC), noise suppression (ANS)
|
|
235
|
-
|
|
236
|
-
**Typical Size**: 150–250MB
|
|
237
|
-
|
|
238
|
-
---
|
|
239
|
-
|
|
240
|
-
## Scenario 11: Note-Taking / Knowledge Base
|
|
241
|
-
|
|
242
|
-
**Reference Products**: Obsidian, Logseq, Notion Desktop
|
|
243
|
-
|
|
244
|
-
**Recommended Stack**: Electron/Tauri + React + SQLite
|
|
245
|
-
|
|
246
|
-
**Key Requirements**:
|
|
247
|
-
- Markdown editor
|
|
248
|
-
- Bidirectional linking
|
|
249
|
-
- Full-text search
|
|
250
|
-
- Local file sync
|
|
251
|
-
- Plugin system (optional)
|
|
252
|
-
|
|
253
|
-
**Packaging Considerations**:
|
|
254
|
-
- Markdown editor: `@codemirror/view` or `tiptap`
|
|
255
|
-
- Full-text search: SQLite FTS5 or `minisearch`
|
|
256
|
-
- File watching: `chokidar` for local file changes
|
|
257
|
-
- Image paste: `clipboard.readImage()` + save locally
|
|
258
|
-
- Performance: virtual scrolling + lazy rendering for large note sets
|
|
259
|
-
|
|
260
|
-
**Typical Size**: 100–150MB
|
|
261
|
-
|
|
262
|
-
---
|
|
263
|
-
|
|
264
|
-
## Universal Packaging Checklist
|
|
265
|
-
|
|
266
|
-
Regardless of scenario, confirm before packaging:
|
|
267
|
-
|
|
268
|
-
1. Data persistence path correct (userData directory)
|
|
269
|
-
2. API keys encrypted storage
|
|
270
|
-
3. Static resource paths adapted (image embedding or public/)
|
|
271
|
-
4. Native modules correctly packaged (asarUnpack)
|
|
272
|
-
5. Package logo and copyright info correct
|
|
273
|
-
6. Intermediate artifacts cleaned
|
|
274
|
-
7. First install launches successfully
|
|
275
|
-
8. Data clear leaves no residue
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
## Scenario 12: SaaS Desktop Client with Payment System
|
|
280
|
-
|
|
281
|
-
**Reference Products**: Notion, Linear, Figma Desktop, Slack
|
|
282
|
-
|
|
283
|
-
**Recommended Stack**: Electron/Tauri + React/Vue + Stripe/Alipay
|
|
284
|
-
|
|
285
|
-
**Key Requirements**:
|
|
286
|
-
- Feature parity with web version
|
|
287
|
-
- Subscription management (monthly/yearly plans)
|
|
288
|
-
- Payment integration (Stripe for global, Alipay/WeChat Pay for China)
|
|
289
|
-
- License verification (prevent piracy)
|
|
290
|
-
- Trial period management
|
|
291
|
-
|
|
292
|
-
**Packaging Considerations**:
|
|
293
|
-
- Payment: Use Stripe Checkout (redirect to Stripe-hosted page, PCI-compliant)
|
|
294
|
-
- License verification: Server-side validation on startup; cache license locally with expiration
|
|
295
|
-
- Anti-piracy: Bind license to machine ID (`os.hostname()` + hardware fingerprint)
|
|
296
|
-
- Auto-update: electron-updater with differential updates (reduce bandwidth for paying users)
|
|
297
|
-
- Offline grace period: Allow 7-30 days offline before requiring re-validation
|
|
298
|
-
|
|
299
|
-
**Real Problem & Solution**:
|
|
300
|
-
- **Problem**: Users share license keys. Each key works on unlimited machines.
|
|
301
|
-
- **Solution**: Generate machine-specific activation tokens. Allow 3-5 activations per license. Server-side deactivation API.
|
|
302
|
-
|
|
303
|
-
**Typical Size**: 100–150MB
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
## Scenario 13: Offline-First Field Service Application
|
|
308
|
-
|
|
309
|
-
**Reference Products**: Fulcrum, ProntoForms, custom industrial inspection tools
|
|
310
|
-
|
|
311
|
-
**Recommended Stack**: Electron + React + SQLite + Sync Engine
|
|
312
|
-
|
|
313
|
-
**Key Requirements**:
|
|
314
|
-
- Must work completely offline (factory floor, remote areas)
|
|
315
|
-
- Data sync when connectivity returns (conflict resolution)
|
|
316
|
-
- Photo/video capture with annotation
|
|
317
|
-
- Form builder for custom inspection templates
|
|
318
|
-
- GPS/location tagging
|
|
319
|
-
|
|
320
|
-
**Packaging Considerations**:
|
|
321
|
-
- Database: SQLite with WAL mode (better concurrent read/write)
|
|
322
|
-
- Sync engine: CRDT (Conflict-free Replicated Data Types) or last-write-wins with conflict UI
|
|
323
|
-
- Media storage: Store photos/videos in userData directory; compress before sync
|
|
324
|
-
- Network detection: `navigator.onLine` + actual connectivity check (ping server)
|
|
325
|
-
- Large data: Paginated sync; don't try to sync 10GB of photos at once
|
|
326
|
-
|
|
327
|
-
**Real Problem & Solution**:
|
|
328
|
-
- **Problem**: User collects 500 inspection records offline. When reconnecting, sync takes 20 minutes and fails midway.
|
|
329
|
-
- **Solution**: Incremental sync with checkpoint. Each record synced individually. Resume from last successful record on failure. Show progress bar.
|
|
330
|
-
|
|
331
|
-
**Typical Size**: 150–250MB
|
|
332
|
-
|
|
333
|
-
---
|
|
334
|
-
|
|
335
|
-
## Scenario 14: AI-Powered Desktop Application with Local Model
|
|
336
|
-
|
|
337
|
-
**Reference Products**: Ollama Desktop, LM Studio, Cursor, Continue.dev
|
|
338
|
-
|
|
339
|
-
**Recommended Stack**: Electron + React + Ollama/llama.cpp + SQLite
|
|
340
|
-
|
|
341
|
-
**Key Requirements**:
|
|
342
|
-
- Local LLM inference (no cloud API dependency)
|
|
343
|
-
- Model management (download, switch, delete models)
|
|
344
|
-
- Chat interface with streaming response
|
|
345
|
-
- Document RAG (Retrieval-Augmented Generation)
|
|
346
|
-
- GPU detection and optimization
|
|
347
|
-
|
|
348
|
-
**Packaging Considerations**:
|
|
349
|
-
- Model storage: Large files (4-70GB); store outside app directory; allow user to choose location
|
|
350
|
-
- GPU detection: Check CUDA/Metal/Vulkan availability at startup; fallback to CPU
|
|
351
|
-
- Memory management: Monitor RAM/VRAM usage; warn before loading models that exceed available memory
|
|
352
|
-
- Streaming: Use Server-Sent Events (SSE) between main process and renderer
|
|
353
|
-
- Binary distribution: Ship llama.cpp binary as extraResource; detect platform at runtime
|
|
354
|
-
|
|
355
|
-
**Real Problem & Solution**:
|
|
356
|
-
- **Problem**: App ships with llama.cpp binary compiled for AVX2. User's CPU only supports AVX. App crashes silently.
|
|
357
|
-
- **Solution**: Detect CPU features at startup. Ship multiple binaries (AVX, AVX2, ARM NEON). Select the best one dynamically. Show clear error if none compatible.
|
|
358
|
-
|
|
359
|
-
**Typical Size**: 150–200MB (without models)
|
|
360
|
-
|
|
361
|
-
---
|
|
362
|
-
|
|
363
|
-
## Scenario 15: Hardware Integration Application (Serial Port / USB / BLE)
|
|
364
|
-
|
|
365
|
-
**Reference Products**: Arduino IDE, PlatformIO, PuTTY, serial terminal tools
|
|
366
|
-
|
|
367
|
-
**Recommended Stack**: Electron + React + serialport/noble/usb + native modules
|
|
368
|
-
|
|
369
|
-
**Key Requirements**:
|
|
370
|
-
- Serial port communication (RS-232, RS-485, USB-to-serial)
|
|
371
|
-
- USB device access (HID, custom protocols)
|
|
372
|
-
- Bluetooth Low Energy (BLE) communication
|
|
373
|
-
- Real-time data visualization (oscilloscope-style charts)
|
|
374
|
-
- Firmware flashing / OTA update for connected devices
|
|
375
|
-
|
|
376
|
-
**Packaging Considerations**:
|
|
377
|
-
- Native modules: `serialport`, `usb`, `@abandonware/noble` — ALL require `asarUnpack`
|
|
378
|
-
- Permissions: macOS requires entitlements for USB/BLE access; Windows may need driver installation
|
|
379
|
-
- Platform differences: Serial port paths differ (`/dev/ttyUSB0` vs `COM3`)
|
|
380
|
-
- Real-time data: Use `requestAnimationFrame` for chart rendering; don't block main process
|
|
381
|
-
- Firmware flashing: Binary protocol over serial; implement retry + verification
|
|
382
|
-
|
|
383
|
-
**Real Problem & Solution**:
|
|
384
|
-
- **Problem**: `serialport` module works in dev but fails in packaged app with "Cannot find module".
|
|
385
|
-
- **Solution**: `asarUnpack` + `electron-rebuild`. The `.node` binary must be rebuilt for Electron's ABI and placed in unpacked directory.
|
|
386
|
-
|
|
387
|
-
**Typical Size**: 130–180MB
|
|
388
|
-
|
|
389
|
-
---
|
|
390
|
-
|
|
391
|
-
## Scenario 16: Multi-Tenant Enterprise Application
|
|
392
|
-
|
|
393
|
-
**Reference Products**: Odoo Desktop, SAP Business One, custom ERP clients
|
|
394
|
-
|
|
395
|
-
**Recommended Stack**: Electron + React/Vue + Go/Rust backend + PostgreSQL
|
|
396
|
-
|
|
397
|
-
**Key Requirements**:
|
|
398
|
-
- Multi-tenant data isolation (separate databases or schemas per tenant)
|
|
399
|
-
- Role-based access control (RBAC)
|
|
400
|
-
- Audit logging (who did what when)
|
|
401
|
-
- Single Sign-On (SSO) via SAML/OIDC
|
|
402
|
-
- Data export (Excel, PDF, CSV)
|
|
403
|
-
|
|
404
|
-
**Packaging Considerations**:
|
|
405
|
-
- Database: Don't bundle PostgreSQL; connect to external server. SQLite only for local cache.
|
|
406
|
-
- SSO: Open external browser for OAuth flow; handle callback via custom protocol (`myapp://callback`)
|
|
407
|
-
- Audit log: Write to separate SQLite database; don't mix with business data
|
|
408
|
-
- Multi-tenant switching: Store tenant token in keychain (not localStorage)
|
|
409
|
-
- Large datasets: Virtual scrolling for tables with 10,000+ rows
|
|
410
|
-
|
|
411
|
-
**Real Problem & Solution**:
|
|
412
|
-
- **Problem**: User switches between 5 tenants. Each tenant has different permissions. App shows stale permissions from previous tenant.
|
|
413
|
-
- **Solution**: Clear all cached permissions on tenant switch. Re-fetch user role from server. Show loading state during transition.
|
|
414
|
-
|
|
415
|
-
**Typical Size**: 150–200MB
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
## Scenario 17: Real-Time Collaboration Application
|
|
420
|
-
|
|
421
|
-
**Reference Products**: Figma, Excalidraw, Miro, Notion (collaborative editing)
|
|
422
|
-
|
|
423
|
-
**Recommended Stack**: Electron/Tauri + React + Yjs/CRDT + WebSocket
|
|
424
|
-
|
|
425
|
-
**Key Requirements**:
|
|
426
|
-
- Real-time collaborative editing (multiple cursors, live changes)
|
|
427
|
-
- Conflict resolution (CRDT or OT)
|
|
428
|
-
- Presence awareness (who's online, where they're editing)
|
|
429
|
-
- Offline editing with sync on reconnect
|
|
430
|
-
- Large document handling
|
|
431
|
-
|
|
432
|
-
**Packaging Considerations**:
|
|
433
|
-
- CRDT library: Yjs (recommended) or Automerge for conflict-free merging
|
|
434
|
-
- WebSocket: Reconnect with exponential backoff; queue changes while offline
|
|
435
|
-
- Cursor sync: Throttle cursor position updates to 10/second max
|
|
436
|
-
- Performance: Use Web Workers for CRDT operations on large documents
|
|
437
|
-
- Memory: Yjs documents can grow large; implement garbage collection for old operations
|
|
438
|
-
|
|
439
|
-
**Real Problem & Solution**:
|
|
440
|
-
- **Problem**: 10 users editing a 500-page document simultaneously. Memory usage grows to 2GB+. App becomes unresponsive.
|
|
441
|
-
- **Solution**: Implement document chunking (load only visible pages). Use Yjs sub-documents for lazy loading. Compress old CRDT operations periodically.
|
|
442
|
-
|
|
443
|
-
**Typical Size**: 100–150MB
|
|
1
|
+
# Desktop Application Scenarios Guide
|
|
2
|
+
|
|
3
|
+
Covers the most common desktop application types for indie developers and small teams. Each scenario provides specific technology recommendations and packaging considerations.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Scenario 1: AI Chatbot / Knowledge Base
|
|
8
|
+
|
|
9
|
+
**Reference Products**: Claude Desktop, ChatGPT Desktop, OpenCat
|
|
10
|
+
|
|
11
|
+
**Recommended Stack**: Electron + React + Express + SQLite
|
|
12
|
+
|
|
13
|
+
**Key Requirements**:
|
|
14
|
+
- LLM API calls (streaming response)
|
|
15
|
+
- Local conversation history persistence
|
|
16
|
+
- TTS voice synthesis (optional)
|
|
17
|
+
- Multi-model switching
|
|
18
|
+
|
|
19
|
+
**Packaging Considerations**:
|
|
20
|
+
- SSE streaming adaptation (ensure correct forwarding in Electron)
|
|
21
|
+
- Store conversation history in SQLite (more reliable than localStorage)
|
|
22
|
+
- Encrypt API keys (AES-256-CBC)
|
|
23
|
+
- TTS audio queue management (prevent concurrent playback)
|
|
24
|
+
|
|
25
|
+
**Typical Size**: 130–180MB
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Scenario 2: Cloud Architecture Monitor
|
|
30
|
+
|
|
31
|
+
**Reference Products**: Portainer Desktop, Lens, k9s GUI
|
|
32
|
+
|
|
33
|
+
**Recommended Stack**: Electron/Tauri + React + Go backend
|
|
34
|
+
|
|
35
|
+
**Key Requirements**:
|
|
36
|
+
- Connect to multiple cloud clusters (K8s, Docker)
|
|
37
|
+
- Real-time status refresh (WebSocket)
|
|
38
|
+
- Resource topology visualization
|
|
39
|
+
- Alert push notifications
|
|
40
|
+
|
|
41
|
+
**Packaging Considerations**:
|
|
42
|
+
- WebSocket connections need correct proxy in Electron
|
|
43
|
+
- kubeconfig file secure storage
|
|
44
|
+
- TLS certificate handling (self-signed certificates)
|
|
45
|
+
- System notification integration
|
|
46
|
+
|
|
47
|
+
**Typical Size**: 100–150MB
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Scenario 3: Local ERP / OA System
|
|
52
|
+
|
|
53
|
+
**Reference Products**: Kingdee Desktop, Yonyou U8 Client
|
|
54
|
+
|
|
55
|
+
**Recommended Stack**: Electron + Vue/React + Node/Java + MySQL/SQLite
|
|
56
|
+
|
|
57
|
+
**Key Requirements**:
|
|
58
|
+
- Complex forms and reports
|
|
59
|
+
- Print module (invoices, contracts)
|
|
60
|
+
- File export (Excel, PDF)
|
|
61
|
+
- Multi-role permissions
|
|
62
|
+
|
|
63
|
+
**Packaging Considerations**:
|
|
64
|
+
- Print: `window.print()` or system print API
|
|
65
|
+
- Excel export: `xlsx` library (note file save path in Electron)
|
|
66
|
+
- PDF generation: `pdfmake` or `puppeteer`
|
|
67
|
+
- Large data table virtual scrolling
|
|
68
|
+
- Offline-first architecture (local cache, sync on reconnect)
|
|
69
|
+
|
|
70
|
+
**Typical Size**: 150–200MB
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Scenario 4: Quantitative Trading Terminal
|
|
75
|
+
|
|
76
|
+
**Reference Products**: JoinQuant Terminal, QMT, TradingView Desktop
|
|
77
|
+
|
|
78
|
+
**Recommended Stack**: Electron + React + Python/C++ backend
|
|
79
|
+
|
|
80
|
+
**Key Requirements**:
|
|
81
|
+
- Real-time market data push (WebSocket/MQTT)
|
|
82
|
+
- K-line chart rendering (Canvas/WebGL)
|
|
83
|
+
- Backtesting engine
|
|
84
|
+
- Strategy editor
|
|
85
|
+
- Order execution
|
|
86
|
+
|
|
87
|
+
**Packaging Considerations**:
|
|
88
|
+
- High-frequency data: WebSocket connection pool management
|
|
89
|
+
- Chart performance: `lightweight-charts` or `echarts` + Canvas
|
|
90
|
+
- Python backend integration: subprocess or HTTP API with Python backtest engine
|
|
91
|
+
- Security: encrypt trading keys
|
|
92
|
+
- Offline cache: historical market data in SQLite
|
|
93
|
+
|
|
94
|
+
**Typical Size**: 100–200MB
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Scenario 5: IoT Control Panel
|
|
99
|
+
|
|
100
|
+
**Reference Products**: Tuya Smart Desktop, Home Assistant Desktop
|
|
101
|
+
|
|
102
|
+
**Recommended Stack**: Tauri/Electron + Vue + Go/MQTT
|
|
103
|
+
|
|
104
|
+
**Key Requirements**:
|
|
105
|
+
- MQTT device communication
|
|
106
|
+
- Device state real-time display
|
|
107
|
+
- Scene automation configuration
|
|
108
|
+
- Data history charts
|
|
109
|
+
|
|
110
|
+
**Packaging Considerations**:
|
|
111
|
+
- MQTT client: `mqtt.js` (Web) or native MQTT library
|
|
112
|
+
- Device discovery: UDP broadcast (requires native network permission)
|
|
113
|
+
- Low power: reduce refresh rate when backgrounded
|
|
114
|
+
- System tray: resident background, notification push
|
|
115
|
+
|
|
116
|
+
**Typical Size**: 50–100MB
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Scenario 6: IM Chat Client
|
|
121
|
+
|
|
122
|
+
**Reference Products**: Telegram Desktop, Feishu, WeCom
|
|
123
|
+
|
|
124
|
+
**Recommended Stack**: Electron/Tauri + React + Go/Rust
|
|
125
|
+
|
|
126
|
+
**Key Requirements**:
|
|
127
|
+
- Real-time messaging (WebSocket)
|
|
128
|
+
- File/image transfer
|
|
129
|
+
- Group/channel support
|
|
130
|
+
- Message search
|
|
131
|
+
- Local message cache
|
|
132
|
+
|
|
133
|
+
**Packaging Considerations**:
|
|
134
|
+
- Message encryption: E2E encryption (Signal Protocol or custom)
|
|
135
|
+
- File transfer: chunked upload/download, resume support
|
|
136
|
+
- Message storage: SQLite + FTS5 full-text search
|
|
137
|
+
- Notification: native system notifications + unread badge
|
|
138
|
+
- Custom protocol: `myapp://` protocol handler (for link jumps)
|
|
139
|
+
|
|
140
|
+
**Typical Size**: 100–200MB
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Scenario 7: SaaS Desktop Client
|
|
145
|
+
|
|
146
|
+
**Reference Products**: Notion Desktop, Linear, Slack
|
|
147
|
+
|
|
148
|
+
**Recommended Stack**: Electron/Tauri + React/Vue
|
|
149
|
+
|
|
150
|
+
**Key Requirements**:
|
|
151
|
+
- Feature parity with web version
|
|
152
|
+
- Desktop notifications
|
|
153
|
+
- Offline support (optional)
|
|
154
|
+
- File drag-and-drop upload
|
|
155
|
+
- Deep links (`myapp://`)
|
|
156
|
+
|
|
157
|
+
**Packaging Considerations**:
|
|
158
|
+
- If essentially a web wrapper: Pake or Electron both work
|
|
159
|
+
- Offline support: Service Worker + IndexedDB
|
|
160
|
+
- Auto-update: `electron-updater` (Electron) or Tauri built-in updater
|
|
161
|
+
- Single instance lock: prevent duplicate windows
|
|
162
|
+
- Window state memory: remember size and position
|
|
163
|
+
|
|
164
|
+
**Typical Size**: 100–150MB
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Scenario 8: Database Management Tool
|
|
169
|
+
|
|
170
|
+
**Reference Products**: Navicat, DBeaver, pgAdmin Desktop
|
|
171
|
+
|
|
172
|
+
**Recommended Stack**: Electron + React + Go/Rust
|
|
173
|
+
|
|
174
|
+
**Key Requirements**:
|
|
175
|
+
- Multi-database connection (MySQL/PostgreSQL/SQLite/MongoDB)
|
|
176
|
+
- SQL editor (syntax highlighting, autocomplete)
|
|
177
|
+
- Table structure management
|
|
178
|
+
- Data import/export
|
|
179
|
+
- Query history
|
|
180
|
+
|
|
181
|
+
**Packaging Considerations**:
|
|
182
|
+
- Multi-database drivers: Go/Rust backend wraps native drivers, communicates via IPC
|
|
183
|
+
- SQL editor: Monaco Editor or CodeMirror
|
|
184
|
+
- Large dataset handling: virtual scrolling + pagination
|
|
185
|
+
- Connection config encrypted storage
|
|
186
|
+
|
|
187
|
+
**Typical Size**: 100–200MB
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Scenario 9: Indie Game
|
|
192
|
+
|
|
193
|
+
**Reference Products**: Stardew Valley, Hollow Knight, Hades
|
|
194
|
+
|
|
195
|
+
**Recommended Engine**:
|
|
196
|
+
- **Unity**: 2D/3D universal, C#, most mature cross-platform
|
|
197
|
+
- **Godot**: Free and open-source, GDScript/C#, lightweight
|
|
198
|
+
|
|
199
|
+
**Key Requirements**:
|
|
200
|
+
- Game loop and rendering
|
|
201
|
+
- Input handling (keyboard/mouse/gamepad)
|
|
202
|
+
- Audio engine
|
|
203
|
+
- Save system
|
|
204
|
+
- Steam/itch.io integration
|
|
205
|
+
|
|
206
|
+
**Packaging Considerations**:
|
|
207
|
+
- Unity: IL2CPP build + Asset Bundles
|
|
208
|
+
- Godot: export templates + resource packaging
|
|
209
|
+
- Steam integration: Steamworks SDK (achievements, leaderboard, cloud saves)
|
|
210
|
+
- Performance: shader compilation, texture compression, LOD system
|
|
211
|
+
|
|
212
|
+
**Typical Size**: 200–500MB
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Scenario 10: Online Education Client
|
|
217
|
+
|
|
218
|
+
**Reference Products**: Youdao Dictionary, Tencent Classroom, Zoom
|
|
219
|
+
|
|
220
|
+
**Recommended Stack**: Electron + React + WebRTC
|
|
221
|
+
|
|
222
|
+
**Key Requirements**:
|
|
223
|
+
- Video live/recorded playback
|
|
224
|
+
- Screen sharing
|
|
225
|
+
- Whiteboard functionality
|
|
226
|
+
- Chat/danmaku
|
|
227
|
+
- Courseware display (PPT/PDF)
|
|
228
|
+
|
|
229
|
+
**Packaging Considerations**:
|
|
230
|
+
- WebRTC: `simple-peer` or `mediasoup-client`
|
|
231
|
+
- Screen sharing: Electron `desktopCapturer` API
|
|
232
|
+
- Video playback: HLS/DASH streaming (`hls.js`, `dash.js`)
|
|
233
|
+
- Whiteboard: Canvas drawing + real-time sync
|
|
234
|
+
- Audio: echo cancellation (AEC), noise suppression (ANS)
|
|
235
|
+
|
|
236
|
+
**Typical Size**: 150–250MB
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Scenario 11: Note-Taking / Knowledge Base
|
|
241
|
+
|
|
242
|
+
**Reference Products**: Obsidian, Logseq, Notion Desktop
|
|
243
|
+
|
|
244
|
+
**Recommended Stack**: Electron/Tauri + React + SQLite
|
|
245
|
+
|
|
246
|
+
**Key Requirements**:
|
|
247
|
+
- Markdown editor
|
|
248
|
+
- Bidirectional linking
|
|
249
|
+
- Full-text search
|
|
250
|
+
- Local file sync
|
|
251
|
+
- Plugin system (optional)
|
|
252
|
+
|
|
253
|
+
**Packaging Considerations**:
|
|
254
|
+
- Markdown editor: `@codemirror/view` or `tiptap`
|
|
255
|
+
- Full-text search: SQLite FTS5 or `minisearch`
|
|
256
|
+
- File watching: `chokidar` for local file changes
|
|
257
|
+
- Image paste: `clipboard.readImage()` + save locally
|
|
258
|
+
- Performance: virtual scrolling + lazy rendering for large note sets
|
|
259
|
+
|
|
260
|
+
**Typical Size**: 100–150MB
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Universal Packaging Checklist
|
|
265
|
+
|
|
266
|
+
Regardless of scenario, confirm before packaging:
|
|
267
|
+
|
|
268
|
+
1. Data persistence path correct (userData directory)
|
|
269
|
+
2. API keys encrypted storage
|
|
270
|
+
3. Static resource paths adapted (image embedding or public/)
|
|
271
|
+
4. Native modules correctly packaged (asarUnpack)
|
|
272
|
+
5. Package logo and copyright info correct
|
|
273
|
+
6. Intermediate artifacts cleaned
|
|
274
|
+
7. First install launches successfully
|
|
275
|
+
8. Data clear leaves no residue
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Scenario 12: SaaS Desktop Client with Payment System
|
|
280
|
+
|
|
281
|
+
**Reference Products**: Notion, Linear, Figma Desktop, Slack
|
|
282
|
+
|
|
283
|
+
**Recommended Stack**: Electron/Tauri + React/Vue + Stripe/Alipay
|
|
284
|
+
|
|
285
|
+
**Key Requirements**:
|
|
286
|
+
- Feature parity with web version
|
|
287
|
+
- Subscription management (monthly/yearly plans)
|
|
288
|
+
- Payment integration (Stripe for global, Alipay/WeChat Pay for China)
|
|
289
|
+
- License verification (prevent piracy)
|
|
290
|
+
- Trial period management
|
|
291
|
+
|
|
292
|
+
**Packaging Considerations**:
|
|
293
|
+
- Payment: Use Stripe Checkout (redirect to Stripe-hosted page, PCI-compliant)
|
|
294
|
+
- License verification: Server-side validation on startup; cache license locally with expiration
|
|
295
|
+
- Anti-piracy: Bind license to machine ID (`os.hostname()` + hardware fingerprint)
|
|
296
|
+
- Auto-update: electron-updater with differential updates (reduce bandwidth for paying users)
|
|
297
|
+
- Offline grace period: Allow 7-30 days offline before requiring re-validation
|
|
298
|
+
|
|
299
|
+
**Real Problem & Solution**:
|
|
300
|
+
- **Problem**: Users share license keys. Each key works on unlimited machines.
|
|
301
|
+
- **Solution**: Generate machine-specific activation tokens. Allow 3-5 activations per license. Server-side deactivation API.
|
|
302
|
+
|
|
303
|
+
**Typical Size**: 100–150MB
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Scenario 13: Offline-First Field Service Application
|
|
308
|
+
|
|
309
|
+
**Reference Products**: Fulcrum, ProntoForms, custom industrial inspection tools
|
|
310
|
+
|
|
311
|
+
**Recommended Stack**: Electron + React + SQLite + Sync Engine
|
|
312
|
+
|
|
313
|
+
**Key Requirements**:
|
|
314
|
+
- Must work completely offline (factory floor, remote areas)
|
|
315
|
+
- Data sync when connectivity returns (conflict resolution)
|
|
316
|
+
- Photo/video capture with annotation
|
|
317
|
+
- Form builder for custom inspection templates
|
|
318
|
+
- GPS/location tagging
|
|
319
|
+
|
|
320
|
+
**Packaging Considerations**:
|
|
321
|
+
- Database: SQLite with WAL mode (better concurrent read/write)
|
|
322
|
+
- Sync engine: CRDT (Conflict-free Replicated Data Types) or last-write-wins with conflict UI
|
|
323
|
+
- Media storage: Store photos/videos in userData directory; compress before sync
|
|
324
|
+
- Network detection: `navigator.onLine` + actual connectivity check (ping server)
|
|
325
|
+
- Large data: Paginated sync; don't try to sync 10GB of photos at once
|
|
326
|
+
|
|
327
|
+
**Real Problem & Solution**:
|
|
328
|
+
- **Problem**: User collects 500 inspection records offline. When reconnecting, sync takes 20 minutes and fails midway.
|
|
329
|
+
- **Solution**: Incremental sync with checkpoint. Each record synced individually. Resume from last successful record on failure. Show progress bar.
|
|
330
|
+
|
|
331
|
+
**Typical Size**: 150–250MB
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Scenario 14: AI-Powered Desktop Application with Local Model
|
|
336
|
+
|
|
337
|
+
**Reference Products**: Ollama Desktop, LM Studio, Cursor, Continue.dev
|
|
338
|
+
|
|
339
|
+
**Recommended Stack**: Electron + React + Ollama/llama.cpp + SQLite
|
|
340
|
+
|
|
341
|
+
**Key Requirements**:
|
|
342
|
+
- Local LLM inference (no cloud API dependency)
|
|
343
|
+
- Model management (download, switch, delete models)
|
|
344
|
+
- Chat interface with streaming response
|
|
345
|
+
- Document RAG (Retrieval-Augmented Generation)
|
|
346
|
+
- GPU detection and optimization
|
|
347
|
+
|
|
348
|
+
**Packaging Considerations**:
|
|
349
|
+
- Model storage: Large files (4-70GB); store outside app directory; allow user to choose location
|
|
350
|
+
- GPU detection: Check CUDA/Metal/Vulkan availability at startup; fallback to CPU
|
|
351
|
+
- Memory management: Monitor RAM/VRAM usage; warn before loading models that exceed available memory
|
|
352
|
+
- Streaming: Use Server-Sent Events (SSE) between main process and renderer
|
|
353
|
+
- Binary distribution: Ship llama.cpp binary as extraResource; detect platform at runtime
|
|
354
|
+
|
|
355
|
+
**Real Problem & Solution**:
|
|
356
|
+
- **Problem**: App ships with llama.cpp binary compiled for AVX2. User's CPU only supports AVX. App crashes silently.
|
|
357
|
+
- **Solution**: Detect CPU features at startup. Ship multiple binaries (AVX, AVX2, ARM NEON). Select the best one dynamically. Show clear error if none compatible.
|
|
358
|
+
|
|
359
|
+
**Typical Size**: 150–200MB (without models)
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Scenario 15: Hardware Integration Application (Serial Port / USB / BLE)
|
|
364
|
+
|
|
365
|
+
**Reference Products**: Arduino IDE, PlatformIO, PuTTY, serial terminal tools
|
|
366
|
+
|
|
367
|
+
**Recommended Stack**: Electron + React + serialport/noble/usb + native modules
|
|
368
|
+
|
|
369
|
+
**Key Requirements**:
|
|
370
|
+
- Serial port communication (RS-232, RS-485, USB-to-serial)
|
|
371
|
+
- USB device access (HID, custom protocols)
|
|
372
|
+
- Bluetooth Low Energy (BLE) communication
|
|
373
|
+
- Real-time data visualization (oscilloscope-style charts)
|
|
374
|
+
- Firmware flashing / OTA update for connected devices
|
|
375
|
+
|
|
376
|
+
**Packaging Considerations**:
|
|
377
|
+
- Native modules: `serialport`, `usb`, `@abandonware/noble` — ALL require `asarUnpack`
|
|
378
|
+
- Permissions: macOS requires entitlements for USB/BLE access; Windows may need driver installation
|
|
379
|
+
- Platform differences: Serial port paths differ (`/dev/ttyUSB0` vs `COM3`)
|
|
380
|
+
- Real-time data: Use `requestAnimationFrame` for chart rendering; don't block main process
|
|
381
|
+
- Firmware flashing: Binary protocol over serial; implement retry + verification
|
|
382
|
+
|
|
383
|
+
**Real Problem & Solution**:
|
|
384
|
+
- **Problem**: `serialport` module works in dev but fails in packaged app with "Cannot find module".
|
|
385
|
+
- **Solution**: `asarUnpack` + `electron-rebuild`. The `.node` binary must be rebuilt for Electron's ABI and placed in unpacked directory.
|
|
386
|
+
|
|
387
|
+
**Typical Size**: 130–180MB
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Scenario 16: Multi-Tenant Enterprise Application
|
|
392
|
+
|
|
393
|
+
**Reference Products**: Odoo Desktop, SAP Business One, custom ERP clients
|
|
394
|
+
|
|
395
|
+
**Recommended Stack**: Electron + React/Vue + Go/Rust backend + PostgreSQL
|
|
396
|
+
|
|
397
|
+
**Key Requirements**:
|
|
398
|
+
- Multi-tenant data isolation (separate databases or schemas per tenant)
|
|
399
|
+
- Role-based access control (RBAC)
|
|
400
|
+
- Audit logging (who did what when)
|
|
401
|
+
- Single Sign-On (SSO) via SAML/OIDC
|
|
402
|
+
- Data export (Excel, PDF, CSV)
|
|
403
|
+
|
|
404
|
+
**Packaging Considerations**:
|
|
405
|
+
- Database: Don't bundle PostgreSQL; connect to external server. SQLite only for local cache.
|
|
406
|
+
- SSO: Open external browser for OAuth flow; handle callback via custom protocol (`myapp://callback`)
|
|
407
|
+
- Audit log: Write to separate SQLite database; don't mix with business data
|
|
408
|
+
- Multi-tenant switching: Store tenant token in keychain (not localStorage)
|
|
409
|
+
- Large datasets: Virtual scrolling for tables with 10,000+ rows
|
|
410
|
+
|
|
411
|
+
**Real Problem & Solution**:
|
|
412
|
+
- **Problem**: User switches between 5 tenants. Each tenant has different permissions. App shows stale permissions from previous tenant.
|
|
413
|
+
- **Solution**: Clear all cached permissions on tenant switch. Re-fetch user role from server. Show loading state during transition.
|
|
414
|
+
|
|
415
|
+
**Typical Size**: 150–200MB
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Scenario 17: Real-Time Collaboration Application
|
|
420
|
+
|
|
421
|
+
**Reference Products**: Figma, Excalidraw, Miro, Notion (collaborative editing)
|
|
422
|
+
|
|
423
|
+
**Recommended Stack**: Electron/Tauri + React + Yjs/CRDT + WebSocket
|
|
424
|
+
|
|
425
|
+
**Key Requirements**:
|
|
426
|
+
- Real-time collaborative editing (multiple cursors, live changes)
|
|
427
|
+
- Conflict resolution (CRDT or OT)
|
|
428
|
+
- Presence awareness (who's online, where they're editing)
|
|
429
|
+
- Offline editing with sync on reconnect
|
|
430
|
+
- Large document handling
|
|
431
|
+
|
|
432
|
+
**Packaging Considerations**:
|
|
433
|
+
- CRDT library: Yjs (recommended) or Automerge for conflict-free merging
|
|
434
|
+
- WebSocket: Reconnect with exponential backoff; queue changes while offline
|
|
435
|
+
- Cursor sync: Throttle cursor position updates to 10/second max
|
|
436
|
+
- Performance: Use Web Workers for CRDT operations on large documents
|
|
437
|
+
- Memory: Yjs documents can grow large; implement garbage collection for old operations
|
|
438
|
+
|
|
439
|
+
**Real Problem & Solution**:
|
|
440
|
+
- **Problem**: 10 users editing a 500-page document simultaneously. Memory usage grows to 2GB+. App becomes unresponsive.
|
|
441
|
+
- **Solution**: Implement document chunking (load only visible pages). Use Yjs sub-documents for lazy loading. Compress old CRDT operations periodically.
|
|
442
|
+
|
|
443
|
+
**Typical Size**: 100–150MB
|