Skip to content

Migration: Auth0 to Better Auth#157

Merged
Joel-Joseph-George merged 6 commits into
mainfrom
ft/betterauth-migration
May 15, 2026
Merged

Migration: Auth0 to Better Auth#157
Joel-Joseph-George merged 6 commits into
mainfrom
ft/betterauth-migration

Conversation

@Joel-Joseph-George
Copy link
Copy Markdown
Contributor

@Joel-Joseph-George Joel-Joseph-George commented May 13, 2026

Closes #87

  • Admin Tooling: Added CLI scripts for user creation (db:create-user), password resets (db:set-password), and legacy data migration (db:migrate-users).
  • Documentation: Created a detailed authentication-migration.md guide for system architecture and management.
  • Custom API Extensions: Added a dedicated /api/auth/password/set endpoint to support the new invitation flow.

@Joel-Joseph-George Joel-Joseph-George self-assigned this May 13, 2026
Copy link
Copy Markdown
Contributor

@kaseywright kaseywright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks pretty good. Only minor things were found. Some enhancements for ease of local development were needed.

We should still test that the migration of PROD users will go smoothly before pushing to PROD.

I have created a PR to address the current comments and other issues found during review. You, @Joel-Joseph-George , feel free to merge that PR and adapt anything else you might find.

@vipinpaul can approve this branch merging into main

Comment thread src/db/scripts/create-user.ts Outdated
Comment thread src/db/scripts/migrate-users-to-betterauth.ts Outdated
Comment thread src/db/scripts/set-password.ts Outdated
Comment thread src/db/scripts/create-user.ts Outdated
* fix: check auth_user for duplicate email in create-user script

* Add limit(1) to duplicate-check queries in create-user script

Both the auth_user and users duplicate-check queries now explicitly
specify limit(1) to optimize queries on UNIQUE-indexed columns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace logger with console in dev scripts

* refactor: export seedRoles function from roles seed

* refactor: export seedRbac function from rbac seed

* feat: add organizations seed

* feat: add dev-users seed with extensible config and env var fallbacks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add transaction and username check to dev-users seed

* fix: move idempotency checks inside transaction in dev-users seed

* feat: add db:setup orchestrator script

* docs: add seed env vars to .env.example

* fix: transaction in create-user, limit(1) in set-password, dynamic banner in setup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: update fapi.sh db:seed and db:init to use new setup command

db:seed now runs all four seeds (org, roles, RBAC, dev-users) via npm
run scripts. db:init delegates to npm run db:setup instead of manually
chaining individual steps. Updates Auth0 reference in setup message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* update default credentials

* format

* format

* fix: bring fapi.ps1 db:seed and db:init to parity with fapi.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: set cookie expire and domain to be ENV driven

* remove unneccessary cors domains.

Accepted domain for the instance should be set in ENV

* update eslint.config to mute warning for dev script

---------

Co-authored-by: kaseywright <kasey.wright@biblionexus.org>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@Joel-Joseph-George Joel-Joseph-George merged commit 9eb13f5 into main May 15, 2026
1 check passed
@github-actions github-actions Bot deleted the ft/betterauth-migration branch May 15, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from Auth0 to BetterAuth

3 participants