Silgi

Comparison

How Silgi compares to oRPC, tRPC, ts-rest, and Hono — features, architecture, and benchmarks.

Feature matrix

FeatureSilgioRPCtRPCts-rest
End-to-end type-safe I/OYesYesYesYes
End-to-end type-safe errorsYesYesPartialYes
End-to-end type-safe File/BlobYesYesPartialNo
End-to-end type-safe streamingYesYesYesNo
Single package1 package35 packages4+ packages3+ packages
Middleware modelGuard + WrapMiddleware chainMiddleware chain
Compiled pipelineYesNoNoNo
Content negotiationAutomaticRPC protocolNoNo
JSON protocolYesYesYesYes
MessagePack (binary)Built-inVia RPC protocolVia superjson linkNo
devalue (rich types)Built-inNative types via RPCVia superjsonNo
WebSocket RPCYesYesYesNo
Contract-firstYesYesNoYes
Standard Schema (Zod, Valibot, ArkType)YesYesYesNo
OpenAPI generationBuilt-in (Scalar)PluginVia trpc-openapiBuilt-in
SSE / StreamingYesYesYesNo
Server Actions (React)Built-inBuilt-inYesNo
TanStack Query (React)Built-inBuilt-inBuilt-inPartial
TanStack Query (Vue)YesYesNoPartial
TanStack Query (Solid)YesYesNoPartial
TanStack Query (Svelte)YesYesNoNo
AI SDK integrationBuilt-inBuilt-inNoNo
Batch requestsYesYesYesNo
Lazy routingYesYesYesNo
NestJS integrationYesYesPartialYes
Message Port (Electron, Workers)YesYesPartialNo
CF WebSocket HibernationNoYesNoNo
Framework adapters1517+4+2
Typed guard errors (auto-merge)YesNoNoNo
Response caching (SWR, pluggable)Built-inNoNoNo
Offline API docs (no CDN)YesNoNoNo
HTTP Cache-Control headersBuilt-inNoNoNo
Built-in plugins1614+
This table is maintained honestly. Where oRPC or tRPC has a feature we don't, it's marked accurately.

Architecture differences

Single package vs 35 packages

Silgi ships everything as one npm install silgi with subpath imports:

import {  } from 'silgi'
import {  } from 'silgi/client'
import {  } from 'silgi/hono'
import {  } from 'silgi/otel'

oRPC requires separate installs: @orpc/server, @orpc/client, @orpc/react-query, @orpc/openapi, @orpc/zod, etc. Both approaches work — single package is simpler to manage, monorepo packages allow finer dependency control.

Guard / Wrap vs middleware chain

Most RPC libraries have one middleware type. Silgi has two:

  • Guard — runs before, enriches context. No next(). Sync fast-path.
  • Wrap — runs before AND after (onion). Has next(). For timing, caching, error capture.
oRPC:    middleware → middleware → middleware → handler
Silgi:  guard → guard → guard → [wrap → [wrap → handler]]

Guards are semantically clearer and faster (no async overhead when sync). oRPC's single middleware is more flexible.

Compiled pipeline vs runtime dispatch

Silgi compiles the middleware chain once at startup:

  • Guards are unrolled (0-4 specialization, no loop)
  • Context pool eliminates per-request allocation
  • Handler analysis skips unused features

oRPC evaluates the chain at runtime per request. More flexible for dynamic middleware, but Silgi is faster for static pipelines.

Content negotiation vs RPC protocol

Silgi inspects Accept header and responds in the matching format (JSON, MessagePack, or devalue). Standard HTTP, works with any client.

oRPC uses its own RPC protocol that natively handles Date, File, Blob, BigInt without negotiation. Simpler for oRPC-to-oRPC, less interoperable with non-oRPC consumers.

tRPC uses JSON by default, SuperJSON via transformer for rich types.

Benchmarks

All benchmarks run on the same machine (Apple M3 Max, Node v24.11.0). Sequential requests to isolate per-request latency.

Pipeline performance (no HTTP, pure execution)

Measures raw middleware pipeline overhead — how fast the framework processes a call after TCP/HTTP is stripped away.

ScenarioSilgioRPCH3 v2vs oRPCvs H3
No middleware111 ns685 ns2,025 ns6.2x faster18.2x faster
Zod input validation241 ns804 ns4,214 ns3.3x faster17.5x faster
3 middleware + Zod297 ns1,718 ns3,954 ns5.8x faster13.3x faster
5 middleware + Zod413 ns2,219 ns3,917 ns5.4x faster9.5x faster

Silgi's compiled pipeline (unrolled guards, context pool) is 3-6x faster than oRPC and 9-18x faster than H3 at the pipeline level.

HTTP performance (Silgi vs oRPC vs H3 vs Hono)

Real HTTP servers, real TCP connections, 3000 sequential requests per scenario.

ScenarioSilgioRPCH3 v2Hono
Simple (no middleware)79µs (12,592/s)83µs (12,048/s)78µs (12,753/s)74µs (13,516/s)
Zod validation86µs (11,627/s)120µs (8,315/s)93µs (10,707/s)97µs (10,280/s)
Guard + Zod79µs (12,706/s)116µs (8,625/s)96µs (10,359/s)102µs (9,799/s)
ComparisonSimpleZodGuard + Zod
Silgi vs oRPC~tied1.4x faster1.5x faster
Silgi vs H3~tied1.1x faster1.2x faster
Silgi vs Hono0.9x1.1x faster1.3x faster

For simple routes, all four are within 10% — TCP overhead dominates. As middleware complexity grows, Silgi's compiled pipeline pulls ahead: 1.5x faster than oRPC and 1.2-1.3x faster than H3/Hono with guards + validation.

Router performance (Silgi compiled vs rou3)

JIT-compiled radix tree router vs rou3's compiled router.

ScenarioSilgirou3
Static /users/list3.1 ns3.9 ns1.23x faster
Param /users/12322.0 ns25.6 ns1.16x faster
Deep /users/1/posts/223.7 ns26.6 ns1.12x faster
Wildcard /files/a/b/c19.2 ns91.3 ns4.75x faster
Miss /missing/deep4.5 ns22.3 ns4.96x faster

Silgi's router uses indexOf fast path for simple branches (avoids split()), switch-based charCodeAt dispatch, and compile-time substring() for wildcards.

Tail latency (p99)

Scenario (Guard + Zod)avgp50p99
Silgi79µs70µs148µs
oRPC116µs103µs223µs
H3 v296µs82µs236µs
Hono102µs87µs194µs

Silgi's p99 is 34% lower than oRPC and 37% lower than H3 — compiled pipelines keep tail latency predictable.

Memory usage

50K calls, 3 guards + Zod validation, measured with --expose-gc

FrameworkBytes per callRatio
Silgi~40 bytes1x
oRPC~56 bytes1.4x more

WebSocket performance

2000 sequential messages over persistent connection

ScenarioSilgioRPCH3 v2
Simple query39µs42µs34µs

WebSocket eliminates TCP handshake overhead. All three are close — H3 is slightly faster here.

What the benchmarks don't show

  • Real-world APIs spend 95%+ of time in DB queries and business logic. Pipeline overhead matters most for high-throughput, low-latency services.
  • All benchmarks are sequential (1 connection). Concurrent load may show different characteristics.
Reproduce on your hardware: node --experimental-strip-types bench/router.ts

Where oRPC is ahead

Being honest about oRPC's strengths:

  • Ecosystem breadth — 35 packages with more niche integrations (React SWR, Vue Pinia Colada, Hey API, Sentry)
  • Cloudflare Durable Objects — Hibernation + Durable Iterator support
  • RPC protocol — Native type serialization without header negotiation
  • Community size — Larger user base means more battle-tested edge cases
  • Angular support — TanStack Query for Angular

Where Silgi is ahead

  • Single package — one install, no version coordination, no transitive dependency issues
  • Compiled pipeline — measurably faster, lower p99 latency
  • Guard / Wrap model — clearer separation of concerns
  • Typed guard errors — guards declare errors that auto-merge into procedures and OpenAPI spec
  • Response cachingcacheQuery() with TTL, SWR, dedup, pluggable backends via unstorage
  • Rich type serialization — Set, Map, Date via devalue codec without extra plugins
  • Content negotiation — standard HTTP, interoperable with any client
  • Built-in Scalarscalar: true in serve() for API docs, with offline mode (cdn: 'local')
  • HTTP Cache-Controlroute: { cache: 60 } for CDN/browser caching
  • HTTP/2 support — one-flag TLS setup
  • Auto port selection — no EADDRINUSE handling needed

What's next?

On this page