create-authenik8-app 2.1.0 → 2.1.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.
- package/README.md +130 -56
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,19 +28,17 @@ if this saved you time, a ⭐ helps a lot
|
|
|
28
28
|
|
|
29
29
|
Create a new project:
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
```
|
|
32
32
|
bash
|
|
33
33
|
npx create-authenik8-app my-app
|
|
34
|
-
``
|
|
35
|
-
|
|
36
|
-
Then:
|
|
37
34
|
|
|
38
35
|
cd my-app
|
|
39
36
|
|
|
40
37
|
redis-server --daemonize yes
|
|
41
38
|
|
|
42
39
|
npm run dev
|
|
43
|
-
|
|
40
|
+
```
|
|
41
|
+
Your production-ready auth backend will be ready in 2min.
|
|
44
42
|
|
|
45
43
|
---
|
|
46
44
|
|
|
@@ -48,9 +46,9 @@ npm run dev
|
|
|
48
46
|
|
|
49
47
|
• A fully working Express authentication starter with:
|
|
50
48
|
|
|
51
|
-
• JWT authentication (access + refresh tokens)
|
|
49
|
+
• JWT authentication (access + refresh tokens) with secure rotation
|
|
52
50
|
|
|
53
|
-
•
|
|
51
|
+
• Secure refresh token rotation
|
|
54
52
|
|
|
55
53
|
• Redis-based token storage
|
|
56
54
|
|
|
@@ -64,21 +62,22 @@ npm run dev
|
|
|
64
62
|
|
|
65
63
|
• .env file generated automatically
|
|
66
64
|
|
|
65
|
+
• Production extras (PM2 cluster, Helmet, rate limiting, memory guards)
|
|
67
66
|
|
|
68
67
|
|
|
69
68
|
---
|
|
70
69
|
|
|
71
70
|
## Why Authenik8?
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
Most developers waste days (or weeks) on:
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
• Manual JWT setup
|
|
76
75
|
|
|
77
|
-
refresh token handling
|
|
76
|
+
• Secure refresh token handling
|
|
78
77
|
|
|
79
|
-
Redis
|
|
78
|
+
• Redis session configuration
|
|
80
79
|
|
|
81
|
-
access control
|
|
80
|
+
• Proper access control
|
|
82
81
|
|
|
83
82
|
|
|
84
83
|
Authenik8 provides all of this out of the box so you can start building your API immediately.
|
|
@@ -88,19 +87,16 @@ Authenik8 provides all of this out of the box so you can start building your API
|
|
|
88
87
|
|
|
89
88
|
## Requirements
|
|
90
89
|
|
|
91
|
-
Node.js 18+
|
|
90
|
+
• Node.js 18+
|
|
92
91
|
|
|
93
|
-
Redis (required for refresh tokens)
|
|
92
|
+
• Redis (required for refresh tokens & security features)
|
|
94
93
|
|
|
94
|
+
Redis (Local)
|
|
95
|
+
```
|
|
96
|
+
Bash
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
## Redis Setup
|
|
100
|
-
|
|
101
|
-
Local
|
|
102
|
-
|
|
103
|
-
redis-server --daemomize yes
|
|
98
|
+
redis-server --daemonize yes
|
|
99
|
+
```
|
|
104
100
|
|
|
105
101
|
|
|
106
102
|
---
|
|
@@ -109,86 +105,164 @@ redis-server --daemomize yes
|
|
|
109
105
|
|
|
110
106
|
Generated automatically:
|
|
111
107
|
|
|
108
|
+
The CLI generates these automatically:
|
|
112
109
|
|
|
110
|
+
```
|
|
113
111
|
JWT_SECRET=your-secret
|
|
114
112
|
REFRESH_SECRET=your-refresh-secret
|
|
115
|
-
|
|
116
113
|
REDIS_HOST=127.0.0.1
|
|
117
114
|
REDIS_PORT=6379
|
|
118
|
-
|
|
115
|
+
```
|
|
119
116
|
|
|
120
117
|
|
|
121
118
|
---
|
|
122
119
|
|
|
123
120
|
|
|
124
|
-
|
|
125
121
|
## RBAC Example
|
|
126
122
|
|
|
127
123
|
Example of a protected route:
|
|
128
|
-
|
|
124
|
+
```
|
|
129
125
|
app.get("/admin", auth.requireAdmin, (req, res) => {
|
|
130
126
|
res.json({ message: "Admin only route" });
|
|
131
127
|
});
|
|
132
|
-
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## How It Works (Key Concept)
|
|
133
|
+
|
|
134
|
+
Authenik8 is not just another auth library.
|
|
135
|
+
It is an auth system generator.
|
|
136
|
+
At its core is the Identity Engine ``(authenik8-core)`` that treats authentication as an
|
|
137
|
+
|
|
138
|
+
# identity resolution problem:
|
|
139
|
+
|
|
140
|
+
• Unifies credentials (email/password) + OAuth providers
|
|
141
|
+
|
|
142
|
+
• Prevents duplicate identities
|
|
143
|
+
|
|
144
|
+
• Handles account linking intelligently
|
|
145
|
+
|
|
146
|
+
• Normalizes data across providers
|
|
147
|
+
|
|
148
|
+
This design makes future additions (MFA, WebAuthn, etc.) much cleaner.
|
|
133
149
|
|
|
134
150
|
---
|
|
135
151
|
## Powered by
|
|
136
152
|
|
|
137
|
-
authenik8-core
|
|
153
|
+
authenik8-core (v1.0.3) — battle-tested identity & token engine
|
|
138
154
|
|
|
139
155
|
---
|
|
140
156
|
|
|
141
|
-
##
|
|
157
|
+
## Production Enhancements
|
|
142
158
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
159
|
+
• PM2 cluster mode + auto-restart
|
|
160
|
+
|
|
161
|
+
• Memory usage guardrails
|
|
162
|
+
|
|
163
|
+
• Security middleware (Helmet, rate limiting, etc.)
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## The Identity Engine
|
|
146
168
|
|
|
147
|
-
|
|
169
|
+
At the heart of Authenik8 is the **Identity Engine** , a unified authentication core built into `authenik8-core`.
|
|
148
170
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
### Why a dedicated Identity Engine?
|
|
174
|
+
|
|
175
|
+
Traditional auth systems treat login as separate, isolated flows:
|
|
176
|
+
|
|
177
|
+
• Email/password goes one way
|
|
178
|
+
|
|
179
|
+
• Google OAuth another way
|
|
180
|
+
|
|
181
|
+
• GitHub yet another
|
|
182
|
+
|
|
183
|
+
This leads to duplicate accounts, inconsistent data, fragile linking logic, and security gaps.
|
|
184
|
+
|
|
185
|
+
The **Identity Engine** solves this by treating authentication as an **identity resolution problem** instead of just credential validation.
|
|
153
186
|
|
|
154
187
|
---
|
|
155
188
|
|
|
156
|
-
|
|
189
|
+
### What the Identity Engine does
|
|
190
|
+
|
|
191
|
+
• **Unified Identity Resolution**
|
|
192
|
+
It intelligently resolves any login method (credentials, OAuth, or future strategies) into a single, consistent user identity in your system.
|
|
157
193
|
|
|
158
|
-
•
|
|
159
|
-
|
|
160
|
-
OAuth in Authenik8 is not a direct provider integration layer.
|
|
194
|
+
• **Smart Account Linking**
|
|
195
|
+
Automatically detects when a user already exists (via email or other signals) and offers secure linking instead of creating duplicates.
|
|
161
196
|
|
|
162
|
-
|
|
197
|
+
• **Profile Normalization**
|
|
198
|
+
Converts provider-specific data (Google profile, GitHub profile, etc.) into your app’s clean, unified user schema.
|
|
163
199
|
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
- Handling login vs account linking flows
|
|
167
|
-
- Preventing duplicate identity creation across providers
|
|
168
|
-
- Normalizing provider-specific user data into a unified schema
|
|
200
|
+
• **Secure Token Lifecycle Management**
|
|
201
|
+
Handles JWT access + refresh tokens with rotation, JTI-based replay protection, and Redis-backed stateful control.
|
|
169
202
|
|
|
170
|
-
|
|
203
|
+
- **Consistent Security Layer**
|
|
204
|
+
Applies the same high-security rules (rate limiting, IP awareness, session controls) across all authentication methods.
|
|
171
205
|
|
|
172
206
|
---
|
|
173
207
|
|
|
174
|
-
###
|
|
208
|
+
### OAuth Through the Identity Engine
|
|
209
|
+
|
|
210
|
+
OAuth (Google, GitHub, and more coming) is **not** implemented as direct Passport.js-style routes. Instead:
|
|
211
|
+
|
|
212
|
+
1. The provider callback is received
|
|
213
|
+
|
|
214
|
+
2. The Identity Engine resolves/normalizes the profile
|
|
215
|
+
|
|
216
|
+
3. It decides: login existing user, link to existing account, or create new identity
|
|
217
|
+
|
|
218
|
+
4. Returns consistent tokens and user data
|
|
219
|
+
|
|
220
|
+
This design makes adding new providers or authentication methods much cleaner and more secure.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Authenik8 vs Passport.js
|
|
225
|
+
|
|
226
|
+
| Aspect | **Authenik8** | **Passport.js** |
|
|
227
|
+
|---------------------------|----------------------------------------------------|------------------------------------------|
|
|
228
|
+
| **Purpose** | Full auth system generator | Authentication middleware |
|
|
229
|
+
| **Setup Time** | \~30 seconds (complete project) | Hours to days |
|
|
230
|
+
| **JWT + Refresh Tokens** | Secure rotation + replay protection built-in | Manual implementation required |
|
|
231
|
+
| **OAuth** | Unified via Identity Engine (smart linking) | Separate strategies per provider |
|
|
232
|
+
| **RBAC** | Built-in middleware | Not included |
|
|
233
|
+
| **Production Features** | PM2, Helmet, rate limiting, memory guards | None (you add them) |
|
|
234
|
+
| **Identity Management** | Centralized Identity Engine | None |
|
|
235
|
+
| **Flexibility** | Medium (opinionated & extensible) | Very high |
|
|
236
|
+
| **Best For** | Fast, secure, consistent backends | Maximum customization |
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
Passport.js is a great flexible tool, but it leaves you to build secure JWT, refresh logic, OAuth linking, and RBAC yourself.
|
|
240
|
+
Authenik8 gives you a complete, production-ready authentication system from day one.
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### Benefits for you
|
|
246
|
+
|
|
247
|
+
• No more duplicate user headaches
|
|
248
|
+
|
|
249
|
+
• Consistent security behavior across all login methods
|
|
175
250
|
|
|
176
|
-
-
|
|
177
|
-
- Auto restart on crashes
|
|
178
|
-
- Memory usage guardrails
|
|
179
|
-
- Basic security middleware (helmet, rate limiting)
|
|
251
|
+
• Easier future-proofing (MFA, WebAuthn, enterprise SSO, etc.)
|
|
180
252
|
|
|
253
|
+
• Cleaner, more maintainable codebase in your generated project
|
|
181
254
|
|
|
255
|
+
The Identity Engine is what makes Authenik8 feel like a coherent **authentication system** rather than a collection of routes and middleware.
|
|
182
256
|
|
|
183
257
|
---
|
|
184
258
|
|
|
185
259
|
## Notes
|
|
186
260
|
|
|
187
|
-
|
|
261
|
+
• This generates a starter project, not a full framework
|
|
188
262
|
|
|
189
|
-
|
|
263
|
+
• Redis is mandatory for security features
|
|
190
264
|
|
|
191
|
-
|
|
265
|
+
• authenik8-core is closed-source for security reasons (implementation details)
|
|
192
266
|
|
|
193
267
|
|
|
194
268
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-authenik8-app",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "⚡ Fast Express + TypeScript auth starter with secure JWT, refresh rotation, Redis, RBAC, OAuth & Prisma.\nPowered by the Authenik8 Identity Engine.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-authenik8-app": "dist/index.js"
|
|
7
7
|
},
|