init Better Auth CLI command (#1427)
* update: init command now can do plugins & DB generation * fix: revert nextjs auth.ts file * add: pacakge @clack/prompts for better CLI experience * update: moved from prompts to clack/prompts * add: functionality to hide logs coming from `getConfig` * remove: hide logs functionality * chore: remove unneeded import * add: install dependencies feature * add: functionality to update/install better-auth * fix: install/upgrade better-auth deps * add: spinner during version checking * fix: nextCookies plugin import path * fix: oidc plugin contents * update: emoji-ify * fix: mysql code * refactor: logging/prompt style * update: mysql use 1 ENV * fix: msql, revert back to old code * fix: mysql connectionUri, again * fix: missing sqlite env * fix: added back the plugins multiselect * update: outro text * add: ENV generation for `BETTER_AUTH_URL` & `BETTER_AUTH_SECRET` * update: intro & outro text, plus some ENV default values * remove: name from cli options * fix: made index.ts's getPackageInfo not crash the program entirely if ENOENT * update: prompt to get auth config dir if not auto found * fix: create auth config file * add: log to state the new file that's being created * update: outro text * fix: unneeded diff display * add: auth-client creator * fix: auth-client plugins are now grouped * fix: auth-client import path bugs * fix: invalid client plugins * fix: oneTap client plugin contents * update: allow getConfig to throw errors instead of logging * fix: auth config error logging * WIP: auth client code gen * chore: linter * update: now supports auth client generation * WIP: grouped imports * remove: functionality to update existing auth code * add: functionality to update tsconfig * fix: tsconfig not saving new updated values * fix: handle missing .env files in init process * update: made `no env file found` error message use `outro` for better logging experience * fix: removed `ms` at the end as the `formatMilliseconds` fn already handles that * update: move ENV code after plugins initialization * chore: update pnpm lockfile and remove deprecated package note * chore: lint --------- Co-authored-by: Bereket Engida <bekacru@gmail.com>
Better Auth
The most comprehensive authentication library for TypeScript
Learn more »
Discord
·
Website
·
Issues
About the Project
Better Auth is framework-agnostic authentication (and authorization) library for TypeScript. It provides a comprehensive set of features out of the box and includes a plugin ecosystem that simplifies adding advanced functionalities with minimal code in short amount of time. Whether you need 2FA, multi-tenant support, or other complex features. It lets you focus on building your actual application instead of reinventing the wheel.
Why Better Auth
Authentication in the TypeScript ecosystem is a half-solved problem. Other open-source libraries often requires a lot of additional code for anything beyond basic authentication. Rather than just pushing third-party services as the solution, I believe we can do better as a community—hence, Better Auth.
Contribution
Better Auth is free and open source project licensed under the MIT License. You are free to do whatever you want with it.
You could help continuing its development by:
Security
If you discover a security vulnerability within Better Auth, please send an e-mail to security@better-auth.com.
All reports will be promptly addressed, and you'll be credited accordingly.
