docs: sketch optional no-email email/password auth design#155
Draft
jgpruitt wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an exploratory design document describing how to support optional email+password authentication (without any automated email) for self-hosted deployments, alongside existing GitHub/Google OAuth, while keeping the CLI flow unchanged (browser-based auth during the OAuth loopback).
Changes:
- Introduces
EMAIL_PASSWORD_DESIGN.mdoutlining goals, blockers, and proposed server/DB/web changes. - Documents configuration flags, tradeoffs around
email_verified, and invite/password-reset implications. - Provides a rollout/testing checklist and open decisions for reviewers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+353
to
+354
| </content> | ||
| </invoke> |
| | Config | `packages/server/start.ts` | read `AUTH_EMAIL_PASSWORD*`, pass to `createBetterAuth`; relax the "no providers" warning | | ||
| | better-auth | `packages/server/auth/betterauth.ts` | `emailAndPassword` block; `isLoginAllowed` gate helper | | ||
| | DB | `packages/database/auth/migrate/incremental/007_credential.sql`, `version.ts` | relax `provider_id` CHECK; bump schema version | | ||
| | DB test | `auth/migrate/migrate.integration.test.ts` | update drift snapshot; credential-account case | |
Comment on lines
+3
to
+4
| **Status:** design direction agreed on the core decisions; two sub-calls remain | ||
| (see "Open decisions"). Not yet an implementation. |
Comment on lines
+293
to
+294
| - Migration footgun reminder (per AGENTS.md): this is a plain `alter table`, not a | ||
| function signature change, so no `{{fn …}}` wrapper is needed. |
Comment on lines
+492
to
+493
| | CLI | — | none (browser-based OAuth loopback is method-agnostic; operator surface is server-side, not the `me` client) | | ||
| | Docs | `SELF_HOST.md`, `.env.sample`, `AGENTS.md` auth summary | document the flag, no-email caveats, and the operator commands | |
Comment on lines
+494
to
+495
| </content> | ||
| </invoke> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exploratory design sketch (docs only) for adding an optional, self-host-oriented email + password login alongside the existing GitHub/Google OAuth — without sending any email. No code/behavior changes; adds
EMAIL_PASSWORD_DESIGN.mdat the repo root.Motivation: self-hosters have asked for email/password instead of OAuth. This documents what it would take and the tradeoffs, before committing to an implementation.
What the doc covers
auth.accounts.provider_idCHECK constraint (in ('google','github')) vs better-auth'sprovider_id='credential'.EMAIL_NOT_VERIFIEDsession.create.beforegate inbetterauth.ts, which a password sign-up (email_verified=false) would trip.AUTH_EMAIL_PASSWORDflag (+ sign-up / min-length toggles) in the existing env-var style.Open decisions (for reviewers)
email_verifiedsemantics for credential accounts (gate-trust vs set-true) — drives whether email-invite discovery works for password users.Note
Draft — this is a design for discussion, not an implementation.