[PR #1427] [MERGED] feat: init Better Auth CLI command #29404

Closed
opened 2026-04-17 20:44:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1427
Author: @ping-maxwell
Created: 2/12/2025
Status: Merged
Merged: 2/28/2025
Merged by: @Bekacru

Base: mainHead: feat/cli/create-new-project


📝 Commits (10+)

  • e32bac5 update: init command now can do plugins & DB generation
  • 6f88ea3 fix: revert nextjs auth.ts file
  • 9546be7 add: pacakge @clack/prompts for better CLI experience
  • 3e72c33 update: moved from prompts to clack/prompts
  • ef9f1ee add: functionality to hide logs coming from getConfig
  • 3f61dba remove: hide logs functionality
  • 4e5d9fa chore: remove unneeded import
  • d4ef0ab add: install dependencies feature
  • 524ced9 add: functionality to update/install better-auth
  • bda0f09 fix: install/upgrade better-auth deps

📊 Changes

13 files changed (+2115 additions, -21 deletions)

View changed files

📝 docs/content/docs/concepts/cli.mdx (+32 -1)
📝 packages/cli/package.json (+4 -0)
packages/cli/src/commands/init.ts (+1159 -0)
📝 packages/cli/src/commands/secret.ts (+5 -1)
packages/cli/src/generators/auth-config.ts (+725 -0)
📝 packages/cli/src/index.ts (+8 -1)
packages/cli/src/utils/check-package-managers.ts (+26 -0)
packages/cli/src/utils/format-ms.ts (+16 -0)
📝 packages/cli/src/utils/get-config.ts (+34 -14)
📝 packages/cli/src/utils/get-package-info.ts (+9 -3)
packages/cli/src/utils/get-tsconfig-info.ts (+22 -0)
packages/cli/src/utils/install-dependencies.ts (+40 -0)
📝 pnpm-lock.yaml (+35 -1)

📄 Description

npx @better-auth/cli init command!

https://github.com/user-attachments/assets/11af6767-f5f9-4dd3-a64a-26ff6859f0c1

Todos:

  • install/upgrade better-auth deps 👍
  • check env vars (better-auth-secret, better-auth-url) 👍
  • create auth.ts & auth-client.ts 👍
    • options to add plugins or DBs 👍
    • Asks to install deps & ENVs 👍
  • check tsconfig for strict 👍

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/1427 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 2/12/2025 **Status:** ✅ Merged **Merged:** 2/28/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feat/cli/create-new-project` --- ### 📝 Commits (10+) - [`e32bac5`](https://github.com/better-auth/better-auth/commit/e32bac5a8ea2e8586f923866e9b198caa152e085) update: init command now can do plugins & DB generation - [`6f88ea3`](https://github.com/better-auth/better-auth/commit/6f88ea32f452bf60fbdd5d7339a7ff06c3959d00) fix: revert nextjs auth.ts file - [`9546be7`](https://github.com/better-auth/better-auth/commit/9546be7d5960c62664f88765c525c521f85fca19) add: pacakge @clack/prompts for better CLI experience - [`3e72c33`](https://github.com/better-auth/better-auth/commit/3e72c33f56f345f20419f34e97ddc5a99bfad77b) update: moved from prompts to clack/prompts - [`ef9f1ee`](https://github.com/better-auth/better-auth/commit/ef9f1ee87b10787de6fb3a7452df05309f6b1aad) add: functionality to hide logs coming from `getConfig` - [`3f61dba`](https://github.com/better-auth/better-auth/commit/3f61dba29b877825a483a58b70f3487ea5533de5) remove: hide logs functionality - [`4e5d9fa`](https://github.com/better-auth/better-auth/commit/4e5d9fa9b4ff94741c8faba7dacffa414cd7775b) chore: remove unneeded import - [`d4ef0ab`](https://github.com/better-auth/better-auth/commit/d4ef0ab1ed73897247ae46f2add05081a10a3442) add: install dependencies feature - [`524ced9`](https://github.com/better-auth/better-auth/commit/524ced94f192ace932fade8a60c62522e698cf56) add: functionality to update/install better-auth - [`bda0f09`](https://github.com/better-auth/better-auth/commit/bda0f096bc19da0c014ee8e376c51f200620c2f6) fix: install/upgrade better-auth deps ### 📊 Changes **13 files changed** (+2115 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/cli.mdx` (+32 -1) 📝 `packages/cli/package.json` (+4 -0) ➕ `packages/cli/src/commands/init.ts` (+1159 -0) 📝 `packages/cli/src/commands/secret.ts` (+5 -1) ➕ `packages/cli/src/generators/auth-config.ts` (+725 -0) 📝 `packages/cli/src/index.ts` (+8 -1) ➕ `packages/cli/src/utils/check-package-managers.ts` (+26 -0) ➕ `packages/cli/src/utils/format-ms.ts` (+16 -0) 📝 `packages/cli/src/utils/get-config.ts` (+34 -14) 📝 `packages/cli/src/utils/get-package-info.ts` (+9 -3) ➕ `packages/cli/src/utils/get-tsconfig-info.ts` (+22 -0) ➕ `packages/cli/src/utils/install-dependencies.ts` (+40 -0) 📝 `pnpm-lock.yaml` (+35 -1) </details> ### 📄 Description # `npx @better-auth/cli init` command! https://github.com/user-attachments/assets/11af6767-f5f9-4dd3-a64a-26ff6859f0c1 # Todos: * install/upgrade better-auth deps 👍 * check env vars (better-auth-secret, better-auth-url) 👍 * create auth.ts & auth-client.ts 👍 * options to add plugins or DBs 👍 * Asks to install deps & ENVs 👍 * check tsconfig for `strict` 👍 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 20:44:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#29404