How poly-gui/poly works
Poly is a multi-language framework for building native GUI applications from portable application code. A representative workflow is React elements reconciled into widget descriptors, sent by the TypeScript SDK over RPC, and handled by a native runtime; the SDK also exposes list views and other widgets. The repository additionally includes a CLI and a shared Tailwind-style class parser. The excerpts show TypeScript and React call paths; runtime implementation links beyond the sampled Swift files are documented at a high level in the README and are marked unverified.
Main entry points: native-layer-service.np.ts Native RPC service · application.ts Application transport · NativeLayerService.np.swift Native RPC handlers · reconciler.ts React reconciler
Components 17
Portable SDK
- Application transport
sdks/typescript/core/src/application.ts - Native RPC service
sdks/typescript/core/src/rpc/native-layer-service.np.ts - Callback RPC service
sdks/typescript/core/src/rpc/portable-layer-service.np.ts - Message decoding
sdks/typescript/core/src/rpc/message-factory.np.ts - List view
sdks/typescript/core/src/widget/list-view.ts
React Integration
- React reconciler
integrations/react/src/reconciler.ts - React widgets
integrations/react/src/widget.ts - Column widget
integrations/react/src/widget/column.ts
Native Runtime
- Application context
runtimes/swift/Sources/PolyNative/ApplicationContext.swift - Native RPC handlers
runtimes/swift/Sources/PolyNative/RPC/NativeLayerService.np.swift - Portable RPC handlers
runtimes/swift/Sources/PolyNative/RPC/PortableLayerService.np.swift - Native widgets
runtimes/swift/Sources/PolyNative/Widgets/ListView.swift - Window manager
runtimes/swift/Sources/PolyNative/WindowManager.swift - GTK runtime
runtimes/gtk
Shared Styling
- Tailwind class parser
libs/twx/src/colors.c
Developer CLI
- Poly CLI
tools/poly-cli/cmd/poly/poly.go
Other components
- App developer
Connections 18
- App developer → React reconciler: creates UI
- React reconciler → React widgets: creates widgets
integrations/react/src/reconciler.ts - React reconciler → Column widget: selects column
integrations/react/src/reconciler.ts - React widgets → Native RPC service: sends widget updates
integrations/react/src/widget.ts - Column widget → Native RPC service: sends updates
integrations/react/src/widget/column.ts - Application transport → Native RPC service: creates client
sdks/typescript/core/src/application.ts - Application transport → Callback RPC service: creates server
sdks/typescript/core/src/application.ts - Native RPC service → Message decoding: decodes messages
sdks/typescript/core/src/rpc/native-layer-service.np.ts - Callback RPC service → Message decoding: decodes messages
sdks/typescript/core/src/rpc/portable-layer-service.np.ts - List view → Native RPC service: sends updates
sdks/typescript/core/src/widget/list-view.ts - Application context → Native RPC handlers: configures runtime
- Application context → Portable RPC handlers: configures callbacks
- Native RPC handlers → Native widgets: dispatches widget operations
- Native RPC handlers → Window manager: manages windows
- Application transport → Native RPC handlers: exchanges native RPC
- Portable RPC handlers → Application transport: invokes portable callbacks
- App developer → Poly CLI: uses tools
- App developer → Tailwind class parser: styles interfaces