orpc-dedupe-middleware
Enhance oRPC middleware performance by avoiding redundant executions.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Enhance oRPC middleware performance by avoiding redundant executions.
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 Dedupe Middleware |
| description | Enhance oRPC middleware performance by avoiding redundant executions. |
| license | MIT |
| metadata | {"author":"Ali Torki","homepage":"https://github.com/ali-master","version":"1.0.0"} |
Optimize middleware for fast and efficient repeated execution.
When a procedure calls another procedure, overlapping middleware may run in both. Similarly, .use(auth).router(router) may run auth multiple times.
Track middleware execution via context to prevent duplication:
const dbProvider = os
.$context<{ db?: Awaited<ReturnType<typeof connectDb>> }>()
.middleware(async ({ context, next }) => {
const db = context.db ?? await connectDb()
return next({ context: { db } })
})
Now dbProvider can be safely applied multiple times without duplicating the connection:
const foo = os.use(dbProvider).handler(({ context }) => 'Hello World')
const bar = os.use(dbProvider).handler(({ context }) => {
const result = call(foo, 'input', { context })
return 'Hello World'
})
const router = os
.use(dbProvider)
.use(({ next }) => next())
.router({ foo, bar })
oRPC auto-dedupes middleware when the router's middlewares are a subset of the leading procedure middlewares and appear in the same order.
const router = os.use(logging).use(dbProvider).router({
// ✅ Deduplicated:
ping: os.use(logging).use(dbProvider).use(auth).handler(() => 'ping'),
pong: os.use(logging).use(dbProvider).handler(() => 'pong'),
// ⛔ Not deduplicated:
diff_subset: os.use(logging).handler(() => 'ping'),
diff_order: os.use(dbProvider).use(logging).handler(() => 'pong'),
diff_leading: os.use(monitor).use(logging).use(dbProvider).handler(() => 'bar'),
})
Disable with .$config:
const base = os.$config({ dedupeLeadingMiddlewares: false })