Not included (TODO: ts-rest | gRPC | Deepkit RPC | Blitz RPC | Remult Backend methods | Phero)
Restfuncs | Telefunc | tRPC | wildcard | |
---|---|---|---|---|
Comment | Uses server side transformers. Aimed for a quick jump in / less config. | Specially tailored for certain frameworks. Uses server side and client side transformers. | Widely used, many 3rd party integrations. Also has additional higher level execution plans (links / queries / mutations) to reduce the number of calls but that goes beyond this comparison. | Precedent of telefunc. Not maintained anymore. |
Your service is defined as a | class | module | t.router({ ...}) declaration |
by adding functions to the server object |
End-to-end-type safety (compile time) | ✅ | ✅ | ✅ | ❌* |
Function declarations are in native language style (see examples) | ✅ | ✅ | ❌ | ✅ |
Automatic arguments validation at runtime (implies that you don't have to declare or handle a type twice) | ✅* | ✅* | ✅* | ❌ |
Server-Side rendering | ❌* | ✅ | ✅ | ❌* |
Request batching | ❌ | ❌ | ✅ | ❌ |
Subscriptions / WebSockets | ✅ | ❌ | ✅ | ❌ |
File uploads / WebSockets | ❌ | ❌ | ❌ | ❌ |
Superjson support: proper handling of Date/Map/Set/BigInt | ❌ | ❌ | ✅* | ❌ |
REST API | ✅ | ❌ | ❌ | ❌ |
Auto. generate OpenAPI/Swagger docs | ❌* | ❌* | ✅ | ❌ |
React helpers | ❌ | ❌ | ✅ | ❌ |
Typesafe session / context objects | ✅ | ❌ | ✅ | ❌ |
Assuming full features (like automatic arguments validation)
restfuncs | telefunc | tRPC | wildcard | |
---|---|---|---|---|
tsc / ttsc | ✅ | ❌ | ✅ | ✅ |
ts-node | ✅* | ❌ | ✅ | ✅ |
tsx / esbuild | ❌* | ❌ | ✅ | ✅ |
When server code is build within... | ||||
... Vite/SVELTE KIT | ❌ | ✅ | ✅ | ✅ |
... Next | ❌ | ✅ | ✅ | ✅ |
... Prisma | ❌ | ✅ | ✅ | ✅ |
restfuncs | telefunc | tRPC | wildcard | |
---|---|---|---|---|
Standalone | ✅ | ❌ | ✅ | ✅ |
Express | ✅ | ✅ | ✅ | ✅ |
Koa | ❌ | ✅ | ✅ | ✅ |
hapi | ❌ | ❌ | ❌ | ✅ |
Electron | ❌ | ❌ | ✅ | ❌ |
µWebSockets.js | ❌ | ❌ | ✅ | ❌ |
Other | see here |
restfuncs | telefunc | tRPC | wildcard | |
---|---|---|---|---|
Client | ||||
Vite | ✅ | ✅ | ✅ | ✅ |
Webpack | ✅ | ✅ | ✅ | ✅ |
Babel | ✅ | ✅ | ✅ | ✅ |
All other packagers and non-browser js clients (that can load NPM packages) | ✅ | ❌ | ✅ | ✅ |
Special frontend framework utils / other | see here |
@remote()
greet(name: string) {
return `Hello ${name} from the server`
}
export async function greet(name: string) {
return `Hello ${name} from the server`
}
greet: t.procedure
.input(z.object({ name: z.string() })) // arguments validation
.query(async ({ name }) => {
return `Hello ${name} from the server`
})
server.greet = async function(name: string) {
// ... arguments validation code
return `Hello ${name} from the server`
}
console.log(await client.greet("Bob"))
Except on tRPC it's await client.greet.query("Bob")