orpc-better-auth-integration
Use Better Auth inside your oRPC projects without any extra overhead.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use Better Auth inside your oRPC projects without any extra overhead.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Quick reference for Better Notify configuration, patterns, and common gotchas
Interactive setup wizard for adding Better Notify to a TypeScript/JavaScript project
Context and API guidance for Better Notify — end-to-end typed notification infrastructure for Node.js
Seamlessly use AI SDK inside your oRPC projects without any extra overhead.
Use oRPC inside an Astro project.
Functions to encode and decode base64url strings (URL-safe variant of base64).
| name | oRPC Better Auth Integration |
| description | Use Better Auth inside your oRPC projects without any extra overhead. |
| license | MIT |
| metadata | {"author":"Ali Torki","homepage":"https://github.com/ali-master","version":"1.0.0"} |
Better Auth is a framework-agnostic, universal authentication and authorization framework for TypeScript.
Access request headers in your context — manually or via the Request Headers Plugin.
import { os } from '@orpc/server'
export const base = os.$context<{ headers: Headers }>()
Use the plugin's setup.
import { auth } from './auth' // Your Better Auth instance
import { base } from './context'
import { ORPCError } from '@orpc/server'
export const authMiddleware = base.middleware(async ({ context, next }) => {
const sessionData = await auth.api.getSession({
headers: context.headers,
})
if (!sessionData?.session || !sessionData?.user) {
throw new ORPCError('UNAUTHORIZED')
}
return next({
context: {
session: sessionData.session,
user: sessionData.user
},
})
})
Create an authorized base that includes the auth middleware:
import { base } from './context'
import { authMiddleware } from './middlewares/auth'
export const authorized = base.use(authMiddleware)
Now use it to create authenticated procedures:
import { authorized } from './authorized'
export const getMessages = authorized.handler(({ context }) => {
// context.session and context.user are guaranteed to be defined
})