new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Reference · all subjects

options/databasehooks

2 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

databaseHooks option structure

The databaseHooks option defines lifecycle hooks for core database operations. It has keys for: user, session, account, verification. Each can have create, update hooks with before and after sub-hooks that receive the relevant data and can modify it before the operation or perform actions after.

databaseHooks example code

import { betterAuth } from "better-auth"; export const auth = betterAuth({ databaseHooks: { user: { create: { before: async (user) => { // Modify user data before creation return { data: { ...user, customField: "value" } }; }, after: async (user) => { // Perform actions after user creation } }, update: { before: async (userData) => { // Modify user data before update return { data: { ...userData, updatedAt: new Date() } }; }, after: async (user) => { // Perform actions after user update } } }, session: { // Session hooks }, account: { // Account hooks }, verification: { // Verification hooks } }, })

Give your agent this brain