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

setup & configuration

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

Better Auth package installation

Better Auth can be installed via npm using the command: npm i better-auth

Better Auth is framework-agnostic

Better Auth is a framework-agnostic authentication and authorization framework for TypeScript.

Better Auth features and plugin ecosystem

Better Auth provides a comprehensive set of features out of the box and includes a plugin ecosystem that simplifies adding advanced functionalities such as 2FA and multi-tenant support.

PlanetScale PostgreSQL connection string format

The PostgreSQL connection string for PlanetScale follows the format: postgresql://<username>:<pa••••••d>@<host>/postgres?sslmode=verify-full. This string is saved as the DATABASE_URL environment variable for use with Better Auth configuration.

Installing Better Auth and PostgreSQL client

To set up Better Auth with PlanetScale PostgreSQL, install the better-auth package using npm install better-auth, then install the PostgreSQL client with npm install pg and npm install --save-dev @types/pg.

CLI commands for schema generation and migration

Run npx auth generate to generate all the schema needed to set up Better Auth, then run npx auth migrate to apply the generated schema to the database.

Better Auth configuration with PlanetScale PostgreSQL

The auth.ts configuration should import Pool from 'pg', then create a betterAuth instance with: baseURL set to the application URL, database set to new Pool({ connectionString: process.env.DATABASE_URL }), and emailAndPassword.enabled set to true.

Migration script execution

The migration script can be executed using bun migration.ts, node, ts-node, or other TypeScript/JavaScript runtime tools.

Give your agent this brain