RPC

We generally recommend using Vike with an RPC tool. See Guides > Data Fetching.

What is RPC?

Remote Procedure Call (RPC, aka Server Actions) enables the frontend to seamlessly call backend functions, see in-depth explanation here.

It's an increasingly popular data-fetching technique used instead of GraphQL and REST. (You can also use multiple data-fetching techniques, although the use case for it is seldom.)

Common RPC tools:

  • Telefunc

    Telefunc was created by the Vike team.

    You'll soon be able to use Telefunc also to fetch initial data (instead of using the data() hook), see Telefunc > #102.

  • tRPC

    Similar to Telefunc:

    • Con: Telefunc is simpler.
    • Pro: supports real-time data using websockets.

See also