Implement and update oRPC backend APIs in this organization and HR SvelteKit monorepo using Better Auth, Drizzle ORM, `@repo/auth_db`, and `@repo/db`. Use when tasks ask to add or modify handlers under `apps/website/src/lib/server/orpc/handlers` or `apps/dashboard/src/lib/server/orpc/handlers`, register procedures in either router, compose middleware in either `base.ts`, inspect schemas and relations in `packages/auth_db/src` or `packages/db/src`, or build organization, member, invitation, attendance, leave, calendar, image, or auth-adjacent APIs and pagination flows.
Implement backend API handlers with oRPC in the current monorepo structure. Follow existing project conventions for authentication, authorization, pagination, router registration, and the parallel website and dashboard app trees.
apps/website: user-facing site and self-service flowsapps/dashboard: organization dashboard and admin flows@repo/auth_db and $lib/server/auth_db.ts for auth, session, organization membership, and middleware lookups.@repo/db and $lib/server/db.ts for organization-domain data such as members, invitations, attendance, calendars, leave, and images.src/lib/server/orpc/base.ts and router.ts.packages/auth_db/src/index.ts and packages/auth_db/src/schema/relations.ts.packages/db/src/index.ts and packages/db/src/schema/relations.ts.src/lib/server/orpc/handlers/<domain>/<action>.ts..route({ method: "GET" }) for read-only handlers.base.ts.
authMiddleware and organizationMiddleware before creating a new guard.concat(...) when refining context or input requirements.apps/website and apps/dashboard as parallel server implementations, not as a single generated copy.concat as a general middleware composition tool, not only an RBAC pattern.session?: Session | null to guaranteed session.organizationMiddleware is the default entry point for organization-scoped handlers; it resolves session, membership, role, organization, and optional org DB context.{ items, pageSize, nextCursor }.