SvelteKit 3 puts heat on Next.js with radical approach to RPCs
Remote functions bring type-safe remote procedure calls right into Web page components
SvelteKit 3.0, an experimental release candidate, brings an innovative feature called remote functions that challenge the conventional approach to remote procedure calls (RPCs) and could potentially disrupt the landscape. This new method offers a smoother, more efficient way for components on a web page to fetch and update their data from the server without causing a full page refresh.
SvelteKit, a backend framework inspired by Svelte, aims to simplify the development process with fewer headaches while supporting dynamic content effectively. Its previous versions have already been making waves by delivering HTML payloads up to three times smaller than Next.js for similar products, enhancing performance for web shops.
The remote functions work by performing data retrieval and querying tasks on the server before transferring the serialized results back to the requesting component. These functions are written in JavaScript or TypeScript, compiled beforehand, and seamlessly integrated into the client-side code, eliminating the need for additional boilerplate or worrying about where the code runs.
One significant advantage of remote functions is their type-safe data fetching. Unlike traditional RPCs, this feature ensures data integrity and reduces the likelihood of hacks or workarounds that often accompany similar solutions.
Though Next.js, another popular JavaScript framework, introduced Server Functions to handle similar tasks, SvelteKit's remote functions stand out by focusing on fetching and querying data, a process traditionally challenging in the web development world. Vercel, the sponsor of Svelte and owner of Next.js, supports both approaches, indicating a broader trend towards more efficient, server-side functions callable from the client.
SvelteKit developer Simon Holthausen succinctly sums up the appeal, stating, "I’m not saying no other RPC systems have done it as good as this, but it better be as good as this if you want me to use it."
Written by urgent.news from The Register Science's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
Also reported by 1 other outlet
- SvelteKit 3 puts heat on Next.js with radical approach to RPCs theregister.com