How Lakeport is built·/docs/architecture-overview

Architecture overview

Lakeport separates formally verified Lean application logic from thin, shared host engines written in C (C11) across Web, iOS, Android, macOS, Windows, and Linux.

Repository map

Layer
Directories
Responsibility
Core & protocol
packages/lakeport-core/, lakeport-session/, lakeport-signals/, lakeport-host/
Checked views, A11yProps, reactive transactions, binary wire codecs (Wire2/Schema 3), and the shared C11 frame/style decoder (ABI5, Lakeport's native frame binary interface)
Styling & UI kits
packages/lakeport-style/, lakeport-primitives/
StyledView, StyledApp, unstyled accessible primitives + proofs, and optional copy-owned Tailwind UI templates
Virtualization & motion
packages/lakeport-virtual/, lakeport-native-motion/
Fenwick-tree VirtualList/VirtualGrid, native nav chrome, and UI-thread 60/120Hz C11 RK4 spring/gesture engine
Routing, effects & data
packages/lakeport-router/, lakeport-effects/, lakeport-json/, lakeport-xml/, lakeport-memo/
LawfulUrlCodec, EffectReq/Outbox, pure-Lean JSON/XML codecs, and MemoCell
Native device plugins
packages/lakeport-plugin-{transport,storage,media-device,device-platform,on-device-ai}/
Typed 6-target bridges for HTTP/multipart, Keychain/SQLite, camera/audio/video/WebView, biometrics, geolocation, haptics, and notifications
Platform hosts
packages/lakeport-web/, lakeport-ios/, lakeport-android/, lakeport-desktop/
Web DOM + Wasm + SSG; hybrid UIKit & AppKit; Android Views + Skia; GTK4/Cairo; Win32/Direct2D
CLI, scaffolding & IDE
packages/lakeport-cli/, create-lakeport/, lakeport-npm/, tools/{lakeport-lsp,vscode-lakeport,zed-lakeport}/
Vite-style build plugin pipeline, lakeport.native-deps/2, lakeport size, lakeport setup, MCP gateway, and .lp IDE extensions

Hybrid native controls + unified W3C CSS engine

The five native hosts use a shared C11 engine for the CSS cascade and layout. The hosts paint that layout with their platform graphics APIs and mount native widgets for controls such as text inputs.

On top of those computed native frames (ABI5), interactive elements mount real platform controls instead of flat bitmaps:

•
iOS (NativeUIKitSurface): Keyed LakeportUITextField, LakeportUITextView, LakeportUIScrollView (120Hz rubber-band physics & scroll-snap), LakeportUIButton, <native-view> UIView subviews, keyboard avoidance, safe areas, and VoiceOver.
•
macOS (NativeAppKitSurface): LakeportNSTextField, NSScrollView + LakeportNSTextView (NSTextInputClient IME), LakeportNSButton, <native-view> NSView subviews, NSCursor, and NSAccessibility.
•
Android (LakeportAndroidRenderer): Real Android Views (EditText, ScrollView, Button, TextView, <native-view>) paired with Skia Canvas drawing for advanced CSS filters, masks, and blend modes.
•
Linux & Windows: Cairo/Pango on GTK4 (GtkIMMulticontext IME, GdkClipboard, kinetic scroll, AT-SPI) and Direct2D/DirectWrite on Win32 (native IME, clipboard, smooth scroll, UIA), both supporting <native-view> child widgets.

UI-thread motion boundary

Continuous 60/120Hz gestures and RK4 spring animations run inside lp_gesture_spring directly on the platform UI thread so dragging a sheet, swiping back a navigation stack, or scrolling a 10,000-row VirtualList never blocks on a per-frame Lean round-trip. Lean receives only discrete semantic events when gestures start, cross snap thresholds, commit, or settle.

Verification boundaries

App theorems (in any .lean or .lp file) prove properties over the exact Lean state transitions, codecs, Fenwick trees, and UI primitive state machines linked into your app. Native engines, toolchains, and platform renderers are verified empirically through C11 ASan/UBSan/LSan test suites, cross-platform builds, and headless pixel diffs against Chrome.