You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exposes explicit entry points for app/pages routers
Introduces explicit subpath imports for Next.js App Router and Pages Router environments, enhancing clarity and enabling future optimizations.
All existing imports continue to work unchanged. Adds `createAppRouterSession` and `createPagesRouterSession` helpers for syntactic sugar.
Copy file name to clipboardExpand all lines: readme.md
+40-14Lines changed: 40 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,36 +34,39 @@ You will need to add your Kinde credentials to the generated `.env.local` file i
34
34
35
35
By contributing to Kinde, you agree that your contributions will be licensed under its MIT License.
36
36
37
-
## New Explicit Import Entry Points (App vs Pages Router)
37
+
## Explicit Import Entry Points (App vs Pages Router)
38
38
39
-
We have introduced **additive, non-breaking** explicit subpath imports to make it clearer which APIs you are using in a Next.js App Router vs Pages Router environment. All existing imports continue to work unchanged.
39
+
To make router intent clear (and enable future optimizations), you can now use router‑specific subpath imports. All existing imports still work unchanged.
40
+
41
+
### Imports
40
42
41
-
### Available existing imports
42
43
```
44
+
# Existing (unchanged)
43
45
@kinde-oss/kinde-auth-nextjs
44
46
@kinde-oss/kinde-auth-nextjs/server
45
47
@kinde-oss/kinde-auth-nextjs/components
46
48
@kinde-oss/kinde-auth-nextjs/middleware
47
-
```
48
49
49
-
### New additive imports
50
-
```
50
+
# New (additive)
51
51
@kinde-oss/kinde-auth-nextjs/app
52
52
@kinde-oss/kinde-auth-nextjs/app/server
53
53
@kinde-oss/kinde-auth-nextjs/pages
54
54
@kinde-oss/kinde-auth-nextjs/pages/server
55
55
```
56
56
57
-
### When to use which
58
-
- Use `.../app` in client components or RSC-compatible code for the App Router.
59
-
- Use `.../app/server` inside App Router server contexts (route handlers, server actions) when you need helpers like `getKindeServerSession`.
60
-
- Use `.../pages` and `.../pages/server` analogously when working in the traditional Pages Router.
57
+
### Which path to use
58
+
59
+
| Path | Use in | Typical usage |
60
+
|------|--------|---------------|
61
+
|`.../app`| App Router client/RSC | Provider, hooks, link components |
62
+
|`.../app/server`| App Router server code (route handlers, server actions) | Session + auth helpers |
63
+
|`.../pages`| Pages Router client code | Same client exports as root |
64
+
|`.../pages/server`| Pages API routes / SSR utilities | Session + auth helpers |
61
65
62
66
### Behavior parity
63
-
Currently these new paths **re-export the same implementations** as the legacy generic paths. This guarantees there is no behavior change. Future minor versions may begin optimizing these new entrypoints (e.g., lighter dependencies) while keeping the old ones stable; any divergence will be documented.
67
+
All new subpaths currently re-export the exact same implementations as the legacy ones. No behavior change, no deprecations yet. Future minor versions may optimize these bundles; any divergence will be documented.
64
68
65
-
### Migration (optional at this stage)
66
-
You can start switching to the explicit paths for clarity:
0 commit comments