What is DeesseJS RPC?
Understand the core concepts of DeesseJS RPC
Overview
DeesseJS RPC is a type-safe RPC protocol that enables seamless communication between clients and servers with full TypeScript inference.
Key Features
- Type Safety - Full TypeScript inference for queries, mutations, and procedures
- Framework Agnostic - Works with Next.js, Hono, Express, and more
- Cache System - Built-in cache keys and automatic invalidation
- Security Model - Clear separation between public and internal procedures
- Plugin System - Extend context and add routes
Architecture
Client (@deessejs/client)
│
│ HTTP Requests
▼
Server Adapters (Next.js, Hono, etc.)
│
▼
@deessejs/server
├── defineContext() → Define context
├── t.query() → Public read
├── t.mutation() → Public write
├── t.internalQuery() → Server-only read
├── t.internalMutation()→ Server-only write
├── Middleware → Global hooks
└── Event System → Pub/subQuick Example
// src/api.ts
import { defineContext } from '@deessejs/server'
import { z } from 'zod'
import { ok } from '@deessejs/fp'
const { t, createAPI } = defineContext({
context: () => ({ db: myDatabase }),
})
const getUser = t.query({
args: z.object({ id: z.number() }),
handler: async (ctx, args) => {
const user = await ctx.db.users.find(args.id)
return ok(user, { keys: [['users', { id: args.id }]] })
},
})
export const appRouter = t.router({
users: t.router({
get: getUser,
}),
})
export type AppRouter = typeof appRouterNext Steps
- Quick Start - Get started in 5 minutes
- Core Concepts - Learn the fundamentals
- Comparisons - How we compare to alternatives