richmond-next-orbit-kernel 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +152 -0
  2. package/index.js +109 -0
  3. package/package.json +36 -0
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # better-auth-kit 🔐 by Watuulo-Richard
2
+
3
+ > A CLI that scaffolds a production-ready Next.js + TypeScript project with **Better Auth** pre-configured in seconds.
4
+
5
+ ---
6
+
7
+ ## 📦 Installation
8
+
9
+ You can use it directly without installing:
10
+
11
+ ```bash
12
+ npx better-auth-kit <project-name>
13
+ ```
14
+
15
+ Or install it globally:
16
+
17
+ ```bash
18
+ npm install -g better-auth-kit
19
+ better-auth-kit <project-name>
20
+ ```
21
+
22
+ ---
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ ```bash
27
+ npx better-auth-kit my-app
28
+ cd my-app
29
+ npm install
30
+ npm dev
31
+ ```
32
+
33
+ That's it. Your project is scaffolded and ready to go.
34
+
35
+ ---
36
+
37
+ ## ✨ What You Get
38
+
39
+ Every project scaffolded with `better-auth-kit` comes with:
40
+
41
+ - 🔐 **Better Auth** — credentials & Google OAuth pre-configured
42
+ - 🟦 **TypeScript** — fully typed from day one
43
+ - ⚡ **Next.js 15** — App Router, Server Actions, the works
44
+ - 🗄️ **Prisma + PostgreSQL** — schema and migrations ready to run
45
+ - 🎨 **Tailwind CSS + ShadCN UI** — clean, accessible component library
46
+ - 📁 **Sensible project structure** — no clutter, no guesswork
47
+
48
+ ---
49
+
50
+ ## 🖥️ CLI Usage
51
+
52
+ ```bash
53
+ better-auth-kit <project-name>
54
+ ```
55
+
56
+ ### Arguments
57
+
58
+ | Argument | Description |
59
+ |---|---|
60
+ | `<project-name>` | The name of the project to scaffold |
61
+
62
+ ### Example
63
+
64
+ ```bash
65
+ npx better-auth-kit my-saas-app
66
+ ```
67
+
68
+ This will:
69
+ 1. Clone the TypeScript starter template
70
+ 2. Rename the project
71
+ 3. Install all dependencies
72
+ 4. Print next steps
73
+
74
+ ---
75
+
76
+ ## ⚙️ After Scaffolding
77
+
78
+ ### 1. Set Up Environment Variables
79
+
80
+ Create a `.env` file in your project root:
81
+
82
+ ```env
83
+ # Better Auth
84
+ BETTER_AUTH_SECRET=<your_better_auth_secret>
85
+ BETTER_AUTH_URL=http://localhost:3000
86
+
87
+ # PostgreSQL
88
+ DATABASE_URL="postgresql://<username>:<password>@<host>/<database_name>?sslmode=require"
89
+
90
+ # Google OAuth
91
+ GOOGLE_CLIENT_ID=<your_google_client_id>
92
+ GOOGLE_CLIENT_SECRET=<your_google_client_secret>
93
+ ```
94
+
95
+ > 💡 Generate a secure secret with: `openssl rand -base64 32`
96
+
97
+ ### 2. Run Database Migrations
98
+
99
+ ```bash
100
+ npx prisma migrate dev
101
+ ```
102
+
103
+ ### 3. Start the Dev Server
104
+
105
+ ```bash
106
+ npm dev
107
+ ```
108
+
109
+ App runs at **http://localhost:3000**.
110
+
111
+ ---
112
+
113
+ ## 📁 Scaffolded Project Structure
114
+
115
+ ```
116
+ my-app/
117
+ ├── app/
118
+ │ ├── (auth)/ # Login & register pages
119
+ │ ├── (dashboard)/ # Protected routes
120
+ │ └── api/auth/ # Better Auth API route
121
+ ├── components/ # ShadCN UI components
122
+ ├── lib/
123
+ │ └── auth.ts # Better Auth config
124
+ ├── prisma/
125
+ │ └── schema.prisma # Database schema
126
+ ├── .env # Environment variables
127
+ └── package.json
128
+ ```
129
+
130
+ ---
131
+
132
+ ## 🔗 Live Demo
133
+
134
+ See the scaffolded template live: [better-auth-kit.vercel.app](https://next-shield.vercel.app/)
135
+
136
+ ---
137
+
138
+ ## 🤝 Contributing
139
+
140
+ Contributions, issues, and feature requests are welcome!
141
+
142
+ 1. Fork the repository
143
+ 2. Create your branch: `git checkout -b feature/my-feature`
144
+ 3. Commit your changes: `git commit -m 'add my feature'`
145
+ 4. Push to the branch: `git push origin feature/my-feature`
146
+ 5. Open a pull request
147
+
148
+ ---
149
+
150
+ ## 📄 License
151
+
152
+ MIT © [Watuulo Richard](https://github.com/Watuulo-Richard)
package/index.js ADDED
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from "commander";
4
+ import chalk from "chalk";
5
+ import fs from "fs-extra";
6
+ import path from "path";
7
+ import { simpleGit } from "simple-git";
8
+ import ora from "ora";
9
+ import inquirer from "inquirer";
10
+ import { execSync } from "child_process";
11
+
12
+ // ASCII art shown first when command runs
13
+ console.log(
14
+ chalk.cyan(`
15
+ ██████╗ ███████╗████████╗████████╗███████╗██████╗ █████╗ ██╗ ██╗████████╗██╗ ██╗
16
+ ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗ ██╔══██╗██║ ██║╚══██╔══╝██║ ██║
17
+ ██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝ ███████║██║ ██║ ██║ ███████║
18
+ ██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗ ██╔══██║██║ ██║ ██║ ██╔══██║
19
+ ██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║ ██║ ██║╚██████╔╝ ██║ ██║ ██║
20
+ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
21
+ `),
22
+ );
23
+
24
+ console.log(chalk.cyan(" PACKAGE\n"));
25
+ console.log(chalk.gray(" Modern Authentication Starter for Next.js\n"));
26
+
27
+ const program = new Command();
28
+
29
+ program
30
+ .version("1.0.0")
31
+ .argument("<project-name>", "name of the project")
32
+ .action(async (projectName) => {
33
+ // The main logic of your CLI will go here
34
+ // Check if the project name already exists
35
+ // Choose the next-js template
36
+ // Clone the next-js template
37
+ // While downloading show the spinner
38
+ // While downloading show the spinner
39
+ // When the download is complete, show a message
40
+ // Create the project name
41
+ // Cd into the project and install the dependencies
42
+ // After we display a message
43
+ const projectPath = path.join(process.cwd(), projectName);
44
+
45
+ // Check if the project directory already exists
46
+ if (fs.existsSync(projectPath)) {
47
+ console.error(
48
+ chalk.red(`Error: Directory ${projectName} already exists.`),
49
+ );
50
+ process.exit(1);
51
+ }
52
+
53
+ // Prompt the user to select the template type
54
+ const answers = await inquirer.prompt([
55
+ {
56
+ type: "confirm",
57
+ name: "useTypeScript",
58
+ message: "Use TypeScript? (recommended)",
59
+ default: true,
60
+ },
61
+ ]);
62
+
63
+ // Determine the repository URL based on the user's selection
64
+ const repoUrl =
65
+ "https://github.com/Watuulo-Richard/Better-Auth-Modern-Authentication-Lesson-Next.js-TypeScript-.git";
66
+
67
+ // Create the project directory
68
+ fs.mkdirSync(projectPath);
69
+
70
+ // Set up the spinner for visual feedback
71
+ const spinner = ora({
72
+ text: "Downloading TypeScript template by Watuulo-Richard...",
73
+ spinner: {
74
+ interval: 80,
75
+ frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
76
+ },
77
+ color: "yellow",
78
+ }).start();
79
+
80
+ const git = simpleGit();
81
+
82
+ try {
83
+ // Clone the selected template
84
+ await git.clone(repoUrl, projectPath);
85
+ spinner.succeed("TypeScript template downloaded successfully!");
86
+
87
+ // Navigate into the project directory
88
+ process.chdir(projectPath);
89
+
90
+ // Stop spinner BEFORE running npm install (stdio: inherit takes over the terminal)
91
+ console.log(chalk.yellow("Installing dependencies..."));
92
+
93
+ execSync("npm install --ignore-scripts", { stdio: "inherit" });
94
+
95
+ console.log(chalk.green("✔ Dependencies installed successfully!"));
96
+ console.log(chalk.green(`\nProject ${projectName} is ready!`));
97
+ console.log(chalk.cyan(` cd ${projectName}`));
98
+ console.log(
99
+ chalk.cyan(` # Add DATABASE_URL to your .env file first, then:`),
100
+ );
101
+ console.log(chalk.cyan(` npm run dev`));
102
+ } catch (error) {
103
+ spinner.fail("Failed to set up the project.");
104
+ console.error(chalk.red(error.message));
105
+ process.exit(1);
106
+ }
107
+ });
108
+
109
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "richmond-next-orbit-kernel",
3
+ "version": "1.0.1",
4
+ "description": "A toolkit of utilities, plugins, and helpers built on top of better-auth for faster and easier authentication integration.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "bin": {
10
+ "richmond-next-orbit-kernel": "index.js"
11
+ },
12
+ "keywords": [
13
+ "better-auth",
14
+ "auth",
15
+ "authentication",
16
+ "toolkit",
17
+ "plugins",
18
+ "helpers",
19
+ "typescript"
20
+ ],
21
+ "author": "watuulo richard",
22
+ "license": "MIT",
23
+ "type": "module",
24
+ "dependencies": {
25
+ "chalk": "^5.6.2",
26
+ "commander": "^14.0.3",
27
+ "figlet": "^1.10.0",
28
+ "fs-extra": "^11.3.3",
29
+ "inquirer": "^13.2.5",
30
+ "ora": "^9.3.0",
31
+ "simple-git": "^3.31.1"
32
+ },
33
+ "devDependencies": {
34
+ "@types/figlet": "^1.7.0"
35
+ }
36
+ }