lobehub avatar

Desktop

This covers Electron desktop development for LobeHub's architecture, walking you through the main-renderer process pattern and IPC communication. Use it when you're adding desktop features, creating IPC handlers, or wiring up controllers between the main process and renderer. The guide gives you the full stack: controllers in the main process, type definitions in the shared package, renderer services, and store actions. What's helpful here is the concrete file structure and boilerplate patterns, so you're not guessing where things go. It assumes you know Electron basics but need the specific conventions for this codebase, including how to register controllers and expose APIs safely through preload scripts.

skills.sh installs
1.3K
GitHub stars
79.8K
last updated
Jul 14, 2026

Install

$ npx -y skills add lobehub/lobe-chat --skill desktop --agent claude-code

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/lobehub/lobe-chat
First seen
May 16, 2026

More from lobehub/lobe-chat

All 16

Recommended

1juliusbrussee avatarcavemanjuliusbrussee/cavemanUltra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman while keeping full technical accuracy. Supports intensity levels618.3Kskills.sh installs
2mattpocock avatargrill-memattpocock/skillsA relentless interview to sharpen a plan or design.1.5Mskills.sh installs
3shadcn avatarimproveshadcn/improveSurvey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on s40Kskills.sh installs
4obra avatarsystematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes326.7Kskills.sh installs
5forrestchang avatarkarpathy-guidelinesforrestchang/andrej-karpathy-skillsBehavioral guidelines to reduce common LLM coding mistakes through explicit assumptions, simplicity, and verifiable success criteria.17.9Kskills.sh installs
6vercel-labs avatarfind-skillsvercel-labs/skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express int4.3Mskills.sh installs