stackpatch 1.1.4 β†’ 1.1.5

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 (36) hide show
  1. package/README.md +70 -67
  2. package/bin/stackpatch.ts +2441 -2
  3. package/boilerplate/auth/app/api/auth/[...nextauth]/route.ts +124 -0
  4. package/boilerplate/auth/app/api/auth/signup/route.ts +45 -0
  5. package/boilerplate/auth/app/auth/login/page.tsx +24 -50
  6. package/boilerplate/auth/app/auth/signup/page.tsx +56 -69
  7. package/boilerplate/auth/app/dashboard/page.tsx +82 -0
  8. package/boilerplate/auth/app/login/page.tsx +136 -0
  9. package/boilerplate/auth/app/page.tsx +48 -0
  10. package/boilerplate/auth/components/auth-button.tsx +43 -0
  11. package/boilerplate/auth/components/auth-navbar.tsx +118 -0
  12. package/boilerplate/auth/components/protected-route.tsx +74 -0
  13. package/boilerplate/auth/components/session-provider.tsx +11 -0
  14. package/boilerplate/auth/middleware.ts +51 -0
  15. package/package.json +2 -4
  16. package/boilerplate/auth/app/stackpatch/page.tsx +0 -269
  17. package/boilerplate/auth/components/auth-wrapper.tsx +0 -61
  18. package/src/auth/generator.ts +0 -569
  19. package/src/auth/index.ts +0 -372
  20. package/src/auth/setup.ts +0 -293
  21. package/src/commands/add.ts +0 -112
  22. package/src/commands/create.ts +0 -128
  23. package/src/commands/revert.ts +0 -389
  24. package/src/config.ts +0 -52
  25. package/src/fileOps/copy.ts +0 -224
  26. package/src/fileOps/layout.ts +0 -304
  27. package/src/fileOps/protected.ts +0 -67
  28. package/src/index.ts +0 -215
  29. package/src/manifest.ts +0 -87
  30. package/src/ui/logo.ts +0 -24
  31. package/src/ui/progress.ts +0 -82
  32. package/src/utils/dependencies.ts +0 -114
  33. package/src/utils/deps-check.ts +0 -45
  34. package/src/utils/files.ts +0 -58
  35. package/src/utils/paths.ts +0 -217
  36. package/src/utils/scanner.ts +0 -109
package/README.md CHANGED
@@ -1,76 +1,90 @@
1
- # StackPatch CLI
2
-
3
- > Composable frontend features for modern React & Next.js apps - Add authentication, UI components, and more with zero configuration.
4
-
5
- [![npm version](https://img.shields.io/npm/v/stackpatch.svg)](https://www.npmjs.com/package/stackpatch)
6
- [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
7
-
8
- StackPatch is a CLI tool that helps you quickly add production-ready features to your Next.js applications. No more copy-pasting boilerplate code or configuring complex setups - just run a command and you're done.
9
-
10
- ## ✨ Features
11
-
12
- - πŸš€ **Zero Configuration** - Add features with a single command
13
- - πŸ” **Authentication** - Full Better Auth setup with customizable OAuth providers
14
- - πŸ›‘οΈ **Protected Routes** - Easy route protection with components or middleware
15
- - 🎨 **UI Components** - Pre-built, production-ready components
16
- - πŸ“¦ **Composable** - Add only what you need, when you need it
17
- - ⚑ **Fast** - Built with Bun for lightning-fast execution
18
- - πŸ›‘οΈ **Type-Safe** - Full TypeScript support
19
- - 🧠 **Smart Detection** - Automatically detects `app/` vs `src/app/` and places files correctly
20
- - πŸ”„ **Revert Support** - Safely revert any installation with `npx stackpatch revert`
21
- - 🎯 **Path Alias Aware** - Automatically uses your `tsconfig.json` path aliases for imports
22
- - πŸ”§ **Provider Selection** - Choose which OAuth providers to configure (Google, GitHub, Email/Password)
23
-
24
- ## πŸ“‹ Prerequisites
25
-
26
- - **Bun** >= 1.0.0 ([Install Bun](https://bun.sh))
27
- - **Node.js** >= 18.0.0 (for npm/npx)
28
- - A Next.js project (App Router)
1
+ <p align="center">
2
+ <h2 align="center">
3
+ StackPatch ⚑
4
+ </h2>
5
+
6
+ <p align="center">
7
+ Composable frontend features for modern React & Next.js apps
8
+ <br />
9
+ Add production-ready features to existing projects without restructuring
10
+ <br />
11
+ <a href="https://stackpatch.darshitdev.in"><strong>Visit Website Β»</strong></a>
12
+ <br />
13
+ <br />
14
+ <a href="https://github.com/Darshh09/StackPatch/issues">Issues</a>
15
+ Β·
16
+ <a href="https://github.com/Darshh09/StackPatch">GitHub</a>
17
+ Β·
18
+ <a href="https://www.producthunt.com/products/stackpatch">Product Hunt</a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="https://www.producthunt.com/products/stackpatch?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-stackpatch" target="_blank" rel="noopener noreferrer">
23
+ <img alt="StackPatch - Patch authentication into your Next.js app with one command | Product Hunt" width="250" height="54" src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1063012&theme=light&t=1768419170786" />
24
+ </a>
25
+ </p>
26
+
27
+ [![npm](https://img.shields.io/npm/dm/stackpatch?style=flat&colorA=000000&colorB=000000)](https://npm.chart.dev/stackpatch?primary=neutral&gray=neutral&theme=dark)
28
+ [![npm version](https://img.shields.io/npm/v/stackpatch.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/stackpatch)
29
+ [![GitHub stars](https://img.shields.io/github/stars/Darshh09/StackPatch?style=flat&colorA=000000&colorB=000000)](https://github.com/Darshh09/StackPatch/stargazers)
30
+ [![Product Hunt](https://img.shields.io/badge/Product%20Hunt-Featured-orange?style=flat&colorA=000000&colorB=000000)](https://www.producthunt.com/products/stackpatch)
31
+ </p>
32
+
33
+ ## About the Project
34
+
35
+ StackPatch is a CLI tool that helps you quickly add production-ready features to your Next.js applications. No more copy-pasting boilerplate code or configuring complex setupsβ€”just run a command and you're done.
36
+
37
+ Think of StackPatch as **shadcn/ui, but for complete features** instead of components. Each patch is self-contained, fully reversible, and designed to work with your existing project structure.
38
+
39
+ ### Why StackPatch
40
+
41
+ Adding features to existing Next.js projects often means:
42
+ - Copy-pasting boilerplate code from multiple sources
43
+ - Manually configuring complex setups
44
+ - Worrying about breaking existing code
45
+ - Struggling with path aliases and directory structures
46
+
47
+ StackPatch solves this by:
48
+ - βœ… **Zero Configuration** - Interactive setup guides you through everything
49
+ - βœ… **Smart Detection** - Automatically adapts to your project structure (`app/` vs `src/app/`)
50
+ - βœ… **Fully Reversible** - Track and revert any installation safely
51
+ - βœ… **Own Your Code** - Every line of code is yours to modify
52
+ - βœ… **Production-Ready** - Battle-tested patterns, not toy examples
29
53
 
30
54
  ## πŸš€ Quick Start
31
55
 
32
- ### Install
56
+ ### Add to Existing Project
57
+
58
+ Navigate to your Next.js project directory and run:
33
59
 
34
60
  ```bash
35
- npm install -g stackpatch
36
- # or
37
- bun add -g stackpatch
61
+ npx stackpatch add auth
38
62
  ```
39
63
 
40
- ### Create a New Project
64
+ The CLI will guide you through an interactive setup:
65
+ 1. **Session Mode** - Choose Database (persistent) or Stateless (JWT)
66
+ 2. **Database** (if database mode) - Select PostgreSQL, MySQL, SQLite, or MongoDB
67
+ 3. **ORM** (if database mode) - Choose Drizzle, Prisma, or Raw SQL
68
+ 4. **Auth Providers** - Enable Email/Password and select OAuth (Google, GitHub)
69
+ 5. **UI Components** - Choose whether to add prebuilt login/signup pages
70
+ 6. **Protected Routes** - Select which routes to protect (supports wildcards like `/dashboard/*`)
71
+
72
+ ### Create New Project
41
73
 
42
74
  ```bash
43
- # Using npm create (recommended - works with create-stackpatch bin)
75
+ # Using npm create (recommended)
44
76
  npm create stackpatch@latest my-app
45
77
 
46
- # Using npx (recommended alternative)
78
+ # Using npx
47
79
  npx create-stackpatch@latest my-app
48
80
  # or
49
81
  npx stackpatch create my-app
50
82
 
51
83
  # Using bunx (Bun's npx equivalent)
52
84
  bunx create-stackpatch@latest my-app
53
- # or
54
- bunx stackpatch create my-app
55
85
  ```
56
86
 
57
- > **Note:**
58
- > - `bun create stackpatch@latest` won't work because Bun's `create` command looks for packages named `create-*` in npm. Use `bunx` instead.
59
- > - `npm create stackpatch` works because it uses the `create-stackpatch` binary from the `stackpatch` package.
60
- > - All commands will prompt you for a project name if not provided.
61
-
62
- ### Add Features to Existing Project
63
-
64
- Navigate to your Next.js project directory and run:
65
-
66
- ```bash
67
- # Add authentication with UI
68
- npx stackpatch add auth
69
- # or
70
- npx stackpatch add auth-ui
71
- ```
72
-
73
- > **Note:** Both `auth` and `auth-ui` commands are identical - they add the complete authentication setup.
87
+ > **Note:** All commands will prompt you for a project name if not provided.
74
88
 
75
89
  ### Revert an Installation
76
90
 
@@ -89,20 +103,9 @@ This will:
89
103
 
90
104
  ## πŸ“– What Gets Added
91
105
 
92
- ### Setup Flow
93
-
94
- When you run `npx stackpatch add auth`, StackPatch will guide you through an interactive setup:
95
-
96
- 1. **Session Mode**: Choose between Database (persistent sessions) or Stateless (JWT only)
97
- 2. **Database** (if database mode): Select PostgreSQL, MySQL, SQLite, or MongoDB
98
- 3. **ORM** (if database mode): Choose Drizzle, Prisma, or Raw SQL driver
99
- 4. **Auth Providers**: Enable Email/Password and select OAuth providers (Google, GitHub)
100
- 5. **UI Components**: Choose whether to add prebuilt login/signup pages
101
- 6. **Protected Routes**: Select which routes to protect (supports wildcards like `/dashboard/*`)
102
-
103
- ### Files Generated
106
+ ### Authentication Setup
104
107
 
105
- After the interactive setup, StackPatch automatically generates:
108
+ When you run `npx stackpatch add auth`, StackPatch automatically generates:
106
109
 
107
110
  - βœ… **Better Auth configuration** (`lib/auth.ts` or `src/lib/auth.ts`)
108
111
  - βœ… **Auth client utilities** (`lib/auth-client.ts` or `src/lib/auth-client.ts`)