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.
- package/README.md +70 -67
- package/bin/stackpatch.ts +2441 -2
- package/boilerplate/auth/app/api/auth/[...nextauth]/route.ts +124 -0
- package/boilerplate/auth/app/api/auth/signup/route.ts +45 -0
- package/boilerplate/auth/app/auth/login/page.tsx +24 -50
- package/boilerplate/auth/app/auth/signup/page.tsx +56 -69
- package/boilerplate/auth/app/dashboard/page.tsx +82 -0
- package/boilerplate/auth/app/login/page.tsx +136 -0
- package/boilerplate/auth/app/page.tsx +48 -0
- package/boilerplate/auth/components/auth-button.tsx +43 -0
- package/boilerplate/auth/components/auth-navbar.tsx +118 -0
- package/boilerplate/auth/components/protected-route.tsx +74 -0
- package/boilerplate/auth/components/session-provider.tsx +11 -0
- package/boilerplate/auth/middleware.ts +51 -0
- package/package.json +2 -4
- package/boilerplate/auth/app/stackpatch/page.tsx +0 -269
- package/boilerplate/auth/components/auth-wrapper.tsx +0 -61
- package/src/auth/generator.ts +0 -569
- package/src/auth/index.ts +0 -372
- package/src/auth/setup.ts +0 -293
- package/src/commands/add.ts +0 -112
- package/src/commands/create.ts +0 -128
- package/src/commands/revert.ts +0 -389
- package/src/config.ts +0 -52
- package/src/fileOps/copy.ts +0 -224
- package/src/fileOps/layout.ts +0 -304
- package/src/fileOps/protected.ts +0 -67
- package/src/index.ts +0 -215
- package/src/manifest.ts +0 -87
- package/src/ui/logo.ts +0 -24
- package/src/ui/progress.ts +0 -82
- package/src/utils/dependencies.ts +0 -114
- package/src/utils/deps-check.ts +0 -45
- package/src/utils/files.ts +0 -58
- package/src/utils/paths.ts +0 -217
- package/src/utils/scanner.ts +0 -109
package/README.md
CHANGED
|
@@ -1,76 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
[](https://npm.chart.dev/stackpatch?primary=neutral&gray=neutral&theme=dark)
|
|
28
|
+
[](https://www.npmjs.com/package/stackpatch)
|
|
29
|
+
[](https://github.com/Darshh09/StackPatch/stargazers)
|
|
30
|
+
[](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
|
-
###
|
|
56
|
+
### Add to Existing Project
|
|
57
|
+
|
|
58
|
+
Navigate to your Next.js project directory and run:
|
|
33
59
|
|
|
34
60
|
```bash
|
|
35
|
-
|
|
36
|
-
# or
|
|
37
|
-
bun add -g stackpatch
|
|
61
|
+
npx stackpatch add auth
|
|
38
62
|
```
|
|
39
63
|
|
|
40
|
-
|
|
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
|
|
75
|
+
# Using npm create (recommended)
|
|
44
76
|
npm create stackpatch@latest my-app
|
|
45
77
|
|
|
46
|
-
# Using npx
|
|
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
|
|
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
|
-
|
|
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`)
|