Shopify Dec 1, 2021

Remote Rendering UI Extensibility

Article Summary

Joey Freund from Shopify reveals how they let third-party developers extend their UI without compromising security or performance. The secret? Rendering UI in one place while defining it in another.

Shopify needed a way to let millions of developers build extensions that feel native across web, iOS, and Android while keeping untrusted code sandboxed. Their solution, called remote rendering, separates UI definition from rendering using message passing. They built the open-source remote-ui library to handle the complex technical challenges.

Key Takeaways

Critical Insight

Shopify built a cross-platform extension system that lets developers use familiar APIs while maintaining platform security, performance, and native look-and-feel through message-based remote rendering.

The article includes working code examples showing exactly how the RPC layer passes functions across sandboxes and how React components map to remote UI trees.

About This Article

Problem

Shopify needed third-party extensions to work consistently across web, iOS, and Android. The extensions had to match the native experience in terms of UX, performance, and accessibility. At the same time, the platform needed protection from malicious or poorly written code.

Solution

Shopify built remote rendering using the open-source remote-ui library. The approach separates UI definition, which runs in sandboxes, from rendering, which happens in hosts. They used MessageChannel for communication, added RPC abstractions, and implemented automatic memory management for event handlers.

Impact

This architecture let Shopify launch product subscriptions and post-purchase extensions with a single codebase. The same extension code renders natively across web, iOS, and Android using web workers, Kotlin, and Swift. Developers no longer need to rewrite code for each platform.

Recent from Shopify

Related Articles