Audit log plugin for Better Auth, providing comprehensive tracking of authentication events such as sign-ins, sign-ups, password changes, and admin actions. Version 1.0.2, released with weekly cadence, supports automatic event capture, configurable storage backends, and query APIs. Differentiators include zero-config setup, typed audit events via Zod schemas, and seamless integration with Better Auth's middleware. Requires better-auth >=1.2.0 and zod >=3.0.0. Fully typed with TypeScript declarations.
npm install better-auth-auditVerified import paths — ran on the pinned version, not inferred.
Configures the audit log plugin with Better Auth, then fetches audit logs for a specific user.
Use 'events' instead of 'eventTypes' in plugin options.
Migrate to 'database' storage with a persistent adapter.
Review your excluded paths and ensure authentication callback paths are not excluded.
Ensure zod is in your dependencies.
Update to >=1.0.0 and use named import: import { auditLog } from 'better-auth-audit';Check that better-auth version is ^1.2.0 and that you passed the plugin inside the plugins array.
Ensure all required fields (actorId, action, resource) are provided when emitting custom events.