Achieving Both Performance and Productivity, the TypeScript Way
Key point
This introduces a method for boosting development productivity by dynamically implementing a frontend client for gRPC communication using the JavaScript Proxy API.
Details
Devsisters' games, including Cookie Run: Kingdom, adopt the gRPC protocol for efficient real-time communication. However, since browsers do not support the custom headers required for gRPC, instead of the frontend (FE) calling the game server directly, a structure is used where the Admin Backend (BE) acts as a proxy server.
In the existing structure, every time a gRPC method was added, developers had to manually write a REST API endpoint on the BE and also implement the corresponding client code on the FE side individually. This undermined the purpose of using protobuf to define and automate data structures.
To solve this problem, a FE client that operates dynamically at runtime was designed using JavaScript Proxy. By capturing the property access path of an object through the Proxy's get handler, it is possible to implement a client that follows the BE's type signatures as-is without any separate code generation (code-gen), maximizing development productivity.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.