Middleware & Authentication
Thebackend/convex/middleware/ directory ensures that every request hitting the CommitT backend is secure, authenticated, and authorized.
Better Auth Integration
CommitT uses Better Auth for cross-platform identity management, integrated natively with Convex via the@convex-dev/better-auth plugin.
Located in middleware/auth.ts:
API Guards
Instead of checking auth state manually in every endpoint, the backend exports strongly-typed middleware wrappers:authedMutationauthedQuery
ctx.user object is populated before the endpoint logic executes. If a user is unauthenticated, the request is instantly rejected, preventing unauthorized access to the core logic layer.