Course lesson 50 · Better Auth

Configuration & Schema Creation

One study unit · Read, recall, then practice · Original video 00:15:44

Better Auth configuration is connected to the existing Drizzle workflow so authentication tables can be generated and then created in D1. A shared factory supports both schema generation, where provider credentials are unnecessary, and runtime initialization, where they are required. The generated authentication schema is also registered with the runtime Drizzle adapter, and package exports are repaired after TypeScript’s output layout changes.

Primary source: course video 50 · Supplied English subtitles · 00:15:44.

Understand the idea

What the course does

  1. Create shared Better Auth setup with email/password disabled and Google provider support.
  2. Implement the runtime accessor using the project’s existing Drizzle database setup.
  3. Configure a generation entry point with the SQLite Drizzle adapter and point the Better Auth CLI at it.
  4. Generate the user, session, account, and verification schemas, then generate their SQL statements.
  5. Execute the required statements against stage and production D1 and supply schema references to the runtime adapter.
  6. Update package exports to the new dist/source layout after including the generation folder in TypeScript compilation.

Watch for

Recall before revealing

Why share one Better Auth configuration factory between generation and runtime?

Reveal the explanation

It keeps the enabled providers and plugins aligned, while allowing generation placeholders and real runtime dependencies to be supplied differently.

Try it

Write the ordered steps required after adding a plugin that needs a new table.

Check your result

You include configuration, schema generation, SQL generation, applying database changes, and making the runtime adapter aware of the schemas.

Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.

Rewatch only what you need

Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.

Companion primary documentation: Better Auth basic usage. For recorded API names, commands, limits, and prices, check the version you use.

← Previous   Next →