Energy is a framework developed by Go language based on CEF (Chromium Embedded Framework) for developing cross-platform desktop applications for Windows, Mac OS X, and Linux
3.0
A Go framework for building cross-platform desktop applications based on LCL & CEF & Webview (Webview2, Webkit2)
中文 | English
Introduction
Energy is a framework developed in Go using:
LCL,
CEF,
Webview2,
Webkit2Gtk,
WKWebView> >> LCL — Native UI component library >> >> CEF — Browser component, CEF3 via CEF4Delphi >> >> Webview2 — Browser component, Webview2 via WebView4Delphi; uses the system runtime >> >> Webkit2 (Webkit2Gtk / WKWebView) — Browser component, Webkit2; uses the system runtime
Features
- Three rendering engines: LCL native controls (lightweight, system look), Webview system runtime (WebView2 / WebKit2, no extra dependencies), CEF full Chromium (complete browser capabilities). Use them together or independently
- Visual designer: Energy Designer supports drag-and-drop components, property/event configuration, and one-click run preview, generating maintainable Go source code
- 100+ native controls: Based on LCL, providing 100+ system-native GUI components including buttons, grids, tree views, list views, dialogs, code editors, and more
- Go + Web hybrid architecture: Go backend handles window management, system calls, file I/O, encryption, etc.; Web frontend (HTML + CSS + JavaScript) handles UI rendering. Supports Vue, React, Angular, and other mainstream frontend frameworks
- Bidirectional IPC: High-performance event-driven IPC enabling Go and Web to call each other and exchange data, with callback support and automatic type conversion
- Local resource loading: Custom protocol scheme to load local files or Go embedded resources directly, without an HTTP server; HTTP server loading is also supported
- Cross-platform: Windows (7+), macOS (Intel / Apple Silicon), Linux (x86 / ARM)
- NO CGO: Optionally develop in pure Go — no CGO compilation required, lowering the environment setup barrier
Development Environment
- Golang >= 1.20
- Energy development environment ([CEF or System Runtime], libenergy runtime)
- Install Golang
- Create a project from Energy Designer Releases
Quick Start
LCL Native Mode
package main
import ( "github.com/energye/lcl/api" "github.com/energye/lcl/lcl" )
type TMainForm struct { lcl.TEngForm }
var MainForm TMainForm
func main() { lcl.Init() lcl.RunApp(&MainForm) }
func (m *TMainForm) FormCreate(sender lcl.IObject) { m.SetCaption("Hello Energy") m.SetWidth(400) m.SetHeight(300) m.WorkAreaCenter()
btn := lcl.NewButton(m) btn.SetParent(m) btn.SetCaption("Click Me") btn.SetLeft(50) btn.SetTop(50) btn.SetOnClick(func(sender lcl.IObject) { api.ShowMessage("Hello from Go!") }) }
Webview Hybrid Mode
package main
import ( "github.com/energye/energy/v3/application" "github.com/energye/energy/v3/window" "github.com/energye/energy/v3/wv" "github.com/energye/lcl/lcl" "github.com/energye/lcl/types" )
type TForm1 struct { window.TWindow Webview1 wv.IWebview }
var Form1 TForm1
func (m *TForm1) FormCreate(sender lcl.IObject) { m.TWindow.InternalBeforeFormCreate() // window create before call m.SetCaption("Hello Energy") m.SetWidth(800) m.SetHeight(600)
m.Webview1 = wv.NewWebview(m) m.Webview1.SetAlign(types.AlClient) m.Webview1.SetParent(m)
m.TWindow.FormCreate(sender) // window widget create after call
m.Webview1.SetWindow(m) }
func main() { wvApp := wv.Init() wvApp.SetOptions(application.Options{ DefaultURL: "https://energye.github.io", }) wv.Run(&Form1) }
Using Energy Designer
- Launch Energy Designer
- Create a new project, drag components onto the canvas
- Configure properties and events
- Click Run to preview
NO CGO
Optionally develop in pureGo— noCGOcompilation required
Examples
Documentation
- Introduction — What is Energy
- Go Reference — API Documentation
- DeepWiki — Project Wiki
Platform Support
| | 32-bit | 64-bit | Tested OS Versions | |---------------|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|-------------------------------------| | Windows | |
| 7, 10, 11 | | MacOSX |
|
| MacOSX Intel x86 | | MacOS M1/M2 |
|
| MacOS Apple Silicon | | Linux |
|
| Deepin 20.8, Ubuntu 18.04, LinuxMint 21 | | Linux ARM |
|
| Kylin-V10-SP1-2107 |
Related Projects
- Energy Designer
- Energy
- LCL
- Webview
- CEF
- WebView4Delphi
- CEF
- CEF4Delphi
- CefSharp
- Java-CEF
- cefpython
- Chromium
If you find this project helpful, please give us a Star!