HYPERJS.AI

TRPC

v0.1.0tRPC bridge — mount tRPC into Hyper, or convert a tRPC router to Hyper routes.

$ hyper add trpc

Copies 4 files into src/hyper/trpc/ and updates hyper.lock.json.

DEPS

FILES

README

@hyper/trpc

tRPC bridge — mount tRPC into Hyper, or convert a tRPC router into Hyper routes.

Install

Components are installed as source into your repo, not pulled from npm:

bunx hyper add trpc

Wires the alias @hyper/trpc to src/hyper/trpc/ (configurable in hyper.config.json). See hyperjs.ai for the full registry.

Usage

Mount a tRPC router inside a Hyper app:

import { Hyper } from "@hyper/core"
import { trpcPlugin } from "@hyper/trpc"
import { appRouter } from "./trpc/router.ts"

export default new Hyper()
  .use(trpcPlugin({ router: appRouter, prefix: "/trpc" }))
  .listen(3000)

Or convert a Hyper app into a tRPC router:

import { toTrpcRouter } from "@hyper/trpc"
import { initTRPC } from "@trpc/server"
import app from "./app.ts"

const t = initTRPC.create()
export const trpcRouter = toTrpcRouter(app, { t })

Docs

See the main README and docs/ for guides and integration recipes.

License

MIT

MANIFEST