thednp / vite-uni-rpc

⚡ A Vite plugin for creating server functions with automatic Remote Procedure Calls (RPC) generation

Repository from Github https://github.comthednp/vite-uni-rpcRepository from Github https://github.comthednp/vite-uni-rpc

vite-uni-rpc

A Vite plugin for creating server functions with automatic Remote Procedure Calls generation.

Features

  • File-level server code isolation without using directives like 'use server'
  • System wide configuration via vite style config file
  • Automatic RPC generation for server functions
  • Server-side caching with single-flight requests
  • Flexible middleware system with hooks support and adapters for express, fastify and hono
  • Framework agnostic
  • TypeScript support

Examples

Example Source Code Try online
SPA - node:http SPA StackBlitz
Express Express StackBlitz
Fastify Fastify StackBlitz
Hono Hono StackBlitz

Installation

npm install vite-uni-rpc@latest
pnpm add vite-uni-rpc@latest

Wiki

Please refer to the Wiki for guides on installation, configuration and usage.

TO DO

  • Add/update examples examples
  • Add SPA support
  • Add wiki
  • Test bun
  • Add contentType option to createServerFunction, currently supporting: application/json, text/plain;
  • Add koa adapter
  • Add Github tooling/workflows
  • Add tests

Credits

This project is inspired by vite-dev-rpc.

License

Released under MIT.

About

⚡ A Vite plugin for creating server functions with automatic Remote Procedure Calls (RPC) generation

License:MIT License


Languages

Language:TypeScript 100.0%