feat(backend): add tRPC with Hono adapter

- Add @trpc/server, @hono/trpc-server, zod dependencies
- Create tRPC context with BetterAuth session
- Create router with publicProcedure and protectedProcedure
- Mount tRPC at /trpc/* via Hono adapter

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-01-25 22:19:05 +00:00
parent 0db6cae82b
commit aff9464245
6 changed files with 70 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
import { trpcServer } from "@hono/trpc-server"
import { Hono } from "hono"
import { registerAuthHandlers } from "./auth/http.ts"
import { createContext } from "./trpc/context.ts"
import { appRouter } from "./trpc/router.ts"
const app = new Hono()
@@ -8,6 +11,14 @@ app.get("/health", (c) => c.json({ status: "ok" }))
registerAuthHandlers(app)
app.use(
"/trpc/*",
trpcServer({
router: appRouter,
createContext,
}),
)
export default {
port: 3000,
fetch: app.fetch,