Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 28, 2026·3 min de lecture

Lorca — Build HTML5 Desktop Apps in Go Using Chrome

A tiny Go library that creates lightweight desktop applications by using an installed Chrome or Chromium browser as the UI layer, enabling Go backends with web-based frontends in under 1 MB of library code.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Lorca
Commande d'installation directe
npx -y tokrepo@latest install 48826a08-8a61-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Lorca is a minimalist Go library that turns any HTML5 page into a desktop application by launching Chrome or Chromium in app mode and communicating with it via the Chrome DevTools Protocol. It requires no bundled browser engine, keeping your application tiny while still delivering a modern web UI.

What Lorca Does

  • Opens a Chrome window in app mode without the address bar, tabs, or browser UI
  • Communicates between Go and the browser through the Chrome DevTools Protocol
  • Lets Go code call JavaScript functions and receive return values
  • Lets JavaScript call Go functions that have been explicitly bound
  • Supports loading local HTML files or remote URLs as the application interface

Architecture Overview

Lorca starts Chrome as a subprocess with the --app flag and connects to its remote debugging port via WebSocket. All communication flows through the Chrome DevTools Protocol: Go sends JavaScript evaluation commands, and Chrome returns results as JSON. There is no embedded browser — Lorca relies on an already-installed Chrome or Chromium binary, which keeps the library dependency to a few hundred lines of Go code.

Self-Hosting & Configuration

  • Add Lorca to your Go project with go get github.com/zserge/lorca
  • Chrome or Chromium must be installed on the target machine
  • Set window dimensions and position via the New() constructor parameters
  • Bundle HTML, CSS, and JS assets into the Go binary using embed or a packing tool
  • Cross-compile the Go binary for Windows, macOS, and Linux as usual

Key Features

  • Entire library is under 1000 lines of Go with zero CGo dependencies
  • Bidirectional Go-to-JavaScript function binding for seamless interop
  • Window management including resize, fullscreen, and close detection
  • Evaluate arbitrary JavaScript expressions and retrieve typed results
  • No external build tools or bundlers required beyond the Go toolchain

Comparison with Similar Tools

  • Electron bundles its own Chromium and Node.js, resulting in 150 MB+ apps; Lorca reuses the system Chrome
  • Tauri pairs Rust with the system webview; Lorca pairs Go with the system Chrome
  • Wails is a more full-featured Go desktop framework with build tooling and native bindings
  • go-app compiles Go to WebAssembly for progressive web apps; Lorca runs native Go on the backend
  • Carlo by Google followed a similar Chrome DevTools Protocol approach in Node.js but is now archived

FAQ

Q: What happens if Chrome is not installed? A: Lorca will return an error at startup. You can detect this and prompt the user to install Chrome or Chromium.

Q: Can I distribute the app without requiring Chrome? A: You would need to bundle a Chromium binary alongside your executable, which increases the distribution size significantly.

Q: Is Lorca suitable for production applications? A: Lorca works well for internal tools, utilities, and lightweight desktop apps. For complex production apps, consider Wails or Tauri which offer more features.

Q: Does Lorca support multiple windows? A: Each lorca.New() call creates an independent window. You can manage multiple windows from a single Go process.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires