lobehub avatar

Desktop

Electron desktop development guide covering controllers, IPC types, renderer services, and window management.

skills.sh installs
4.2K
GitHub stars
86K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers main-renderer architecture: main process controllers, renderer code reused from src/, and preload scripts
  • Walks through adding a feature: controller, IPC types, renderer service, store action, and tests
  • Includes reference guides for feature implementation, local tools, menu configuration, and window management
  • Directs logs to <userData>/logs and reads them with pnpm --dir apps/desktop logs filters, not tail

Install

$ npx -y skills add lobehub/lobehub --skill desktop -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Desktop Development Guide

Architecture Overview

LobeHub desktop is built on Electron with main-renderer architecture:

  1. Main Process (apps/desktop/src/main): App lifecycle, system APIs, window management
  2. Renderer Process: Reuses web code from src/
  3. Preload Scripts (apps/desktop/src/preload): Securely expose main process to renderer

Both processes log to <userData>/logs/{main,renderer}.jsonl in dev and packaged builds (apps/desktop/src/main/utils/structuredLog/); read them with pnpm --dir apps/desktop logs list|query|follow (filters: --level, --since, --operation op_…, --topic tpc_…) instead of tailing files.

Adding New Desktop Features

1. Create Controller

Location: apps/desktop/src/main/controllers/

import { ControllerModule, IpcMethod } from '@/controllers';

export default class NewFeatureCtr extends ControllerModule {
  static override readonly groupName = 'newFeature';

  @IpcMethod()
  async doSomething(params: SomeParams): Promise<SomeResult> {
    // Implementation
    return { success: true };
  }
}

Register in apps/desktop/src/main/controllers/registry.ts.

2. Define IPC Types

Details

Repository
github.com/lobehub/lobehub
Categories
Frontend & UI Code, Code Review & Quality, CLI & Terminal
First seen
Apr 16, 2026

More from lobehub/lobehub

All 21

Similar to Desktop

More Frontend & UI Code