Supported methods
- Email and password — with email verification via Resend
- GitHub OAuth — links to the user’s GitHub account and auto-verifies email
Session management
After sign-in, Better Auth sets abetter-auth.session_token cookie. This cookie authenticates all subsequent requests. Sessions are stored in the database and validated on each request.
Multi-tenancy
Kommit uses organization-based multi-tenancy:- User signs in and their session is validated
- Middleware resolves which organization the user belongs to
- All database queries are scoped to that organization via row-level security
Roles
| Role | Permissions |
|---|---|
| Owner | Full access, billing, member management, org deletion |
| Admin | Member management, integration config, template management |
| Member | Project access, memory, chat, PRD generation |
Middleware flow
The Next.js middleware (middleware.ts) runs on every request:
(dashboard) redirect to /sign-in if there’s no valid session.
API key auth
For MCP and programmatic access, users generate API keys (prefixedkm_) from the settings page. These are passed as Bearer tokens and validated by the API middleware. API keys are scoped to an organization and rate-limited to 1,000 requests per hour.