Fitz Framework Lets WASM Components Call Server Functions Without Manual API Wiring
Fitz, a web framework, introduces an @rpc decorator that allows developers to mark server-side async functions and call them directly from WebAssembly client components as if they were local calls. The compiler automatically generates both the server-side HTTP endpoint (POST /__rpc/function_name) and a client-side fetch stub, eliminating the need to write routes, JSON glue code, or duplicate type definitions. A single shared type defined in the server module is compiled into both a native struct for the backend and a WASM struct for the frontend, preventing type drift between the two sides. The approach draws comparison to existing solutions like Next.js Server Actions, tRPC, and Phoenix, but requires no external dependencies, code generators, or special directives beyond the single decorator. This feature is presented as Part 7 of the ongoing FitzLiveViews series, building on earlier work covering server-rendered and WebSocket-based component compilation.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in