silgi

The fastest end-to-end type-safe RPC framework for TypeScript — compiled pipelines, single package, every runtime

8
0
8
TypeScript


Silgi — Type-safe RPC framework for TypeScript

npm version npm downloads CI license

End-to-end type-safe RPC framework for TypeScript. Single package — server, client, 15 plugins, 14 adapters. Full docs at silgi.dev.

Install

pnpm add silgi
# or: npm install silgi / yarn add silgi / bun add silgi

Requires Node.js >=24.

Minimal example

import { silgi } from 'silgi'

const k = silgi({
  context: (req) => ({ now: Date.now() }),
})

const hello = k.$resolve(({ ctx }) => ({ message: 'hi', at: ctx.now }))

const router = k.router({ hello })

export default k.handler(router)

Export handler from any Fetch-compatible runtime (Next.js App Router,
SvelteKit, Remix, Astro, SolidStart, Hono, srvx, Bun, Deno, Cloudflare
Workers, AWS Lambda via the hono adapter, …). Dedicated adapters for
Express, Nitro, NestJS, and Node’s raw http live under
silgi/express, silgi/nextjs, silgi/sveltekit, etc.

Run a standalone server:

await k.serve(router, { port: 3000 })

Documentation

  • undefinedsilgi.dev — user guide, recipes, API reference.
  • CONTRIBUTING.md — dev setup, commands, PR checklist.
  • ARCHITECTURE.md — request pipeline, module layout, performance invariants.
  • SECURITY.md — threat model, reporting policy, security features.
  • docs/rfcs/0001-de-magic.md — the
    refactor that removed module-global mutable state, explicit schema
    converter injection, and per-instance context bridges.

Credits

  • oRPC — Pipeline architecture, client proxy, error handling, contract-first workflow
  • tRPC — Router/procedure model, end-to-end type inference
  • Elysia — Sucrose-style static handler analysis

License

MIT

[beta]v0.14.0