create-authenik8-app 2.4.12 → 2.4.13

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 (235) hide show
  1. package/README.md +160 -57
  2. package/assets/logo.svg +53 -0
  3. package/dist/src/bin/index.js +199 -125
  4. package/dist/src/bin/index.js.map +1 -1
  5. package/dist/src/lib/args.d.ts +18 -0
  6. package/dist/src/lib/args.d.ts.map +1 -0
  7. package/dist/src/lib/args.js +82 -0
  8. package/dist/src/lib/args.js.map +1 -0
  9. package/dist/src/lib/constants.d.ts +1 -0
  10. package/dist/src/lib/constants.d.ts.map +1 -1
  11. package/dist/src/lib/constants.js +10 -11
  12. package/dist/src/lib/constants.js.map +1 -1
  13. package/dist/src/lib/preflight.d.ts +3 -0
  14. package/dist/src/lib/preflight.d.ts.map +1 -0
  15. package/dist/src/lib/preflight.js +21 -0
  16. package/dist/src/lib/preflight.js.map +1 -0
  17. package/dist/src/lib/process.d.ts +6 -2
  18. package/dist/src/lib/process.d.ts.map +1 -1
  19. package/dist/src/lib/process.js +66 -8
  20. package/dist/src/lib/process.js.map +1 -1
  21. package/dist/src/lib/projectName.d.ts +2 -0
  22. package/dist/src/lib/projectName.d.ts.map +1 -0
  23. package/dist/src/lib/projectName.js +6 -0
  24. package/dist/src/lib/projectName.js.map +1 -0
  25. package/dist/src/lib/schemas.d.ts +192 -0
  26. package/dist/src/lib/schemas.d.ts.map +1 -0
  27. package/dist/src/lib/schemas.js +171 -0
  28. package/dist/src/lib/schemas.js.map +1 -0
  29. package/dist/src/lib/state.d.ts.map +1 -1
  30. package/dist/src/lib/state.js +20 -3
  31. package/dist/src/lib/state.js.map +1 -1
  32. package/dist/src/lib/types.d.ts +6 -13
  33. package/dist/src/lib/types.d.ts.map +1 -1
  34. package/dist/src/lib/ui.d.ts +8 -3
  35. package/dist/src/lib/ui.d.ts.map +1 -1
  36. package/dist/src/lib/ui.js +76 -112
  37. package/dist/src/lib/ui.js.map +1 -1
  38. package/dist/src/steps/configurePrisma.d.ts.map +1 -1
  39. package/dist/src/steps/configurePrisma.js +83 -9
  40. package/dist/src/steps/configurePrisma.js.map +1 -1
  41. package/dist/src/steps/createProject.d.ts +2 -1
  42. package/dist/src/steps/createProject.d.ts.map +1 -1
  43. package/dist/src/steps/createProject.js +149 -28
  44. package/dist/src/steps/createProject.js.map +1 -1
  45. package/dist/src/steps/finalSetup.d.ts +3 -3
  46. package/dist/src/steps/finalSetup.d.ts.map +1 -1
  47. package/dist/src/steps/finalSetup.js +24 -28
  48. package/dist/src/steps/finalSetup.js.map +1 -1
  49. package/dist/src/steps/installAuth.d.ts +1 -1
  50. package/dist/src/steps/installAuth.d.ts.map +1 -1
  51. package/dist/src/steps/installAuth.js +5 -4
  52. package/dist/src/steps/installAuth.js.map +1 -1
  53. package/dist/src/steps/installDeps.d.ts +11 -4
  54. package/dist/src/steps/installDeps.d.ts.map +1 -1
  55. package/dist/src/steps/installDeps.js +45 -77
  56. package/dist/src/steps/installDeps.js.map +1 -1
  57. package/dist/src/steps/prompts.d.ts +1 -1
  58. package/dist/src/steps/prompts.d.ts.map +1 -1
  59. package/dist/src/steps/prompts.js +42 -30
  60. package/dist/src/steps/prompts.js.map +1 -1
  61. package/dist/src/utils/jwk.d.ts +2 -0
  62. package/dist/src/utils/jwk.d.ts.map +1 -0
  63. package/dist/src/utils/jwk.js +44 -0
  64. package/dist/src/utils/jwk.js.map +1 -0
  65. package/dist/src/utils/output.d.ts +1 -1
  66. package/dist/src/utils/output.d.ts.map +1 -1
  67. package/dist/src/utils/output.js +75 -68
  68. package/dist/src/utils/output.js.map +1 -1
  69. package/package.json +17 -9
  70. package/templates/AGENT_IDENTITY.md +112 -0
  71. package/templates/THREAT_MODEL.md +27 -5
  72. package/templates/express-auth/README.md +13 -10
  73. package/templates/express-auth/docker-compose.yml +10 -0
  74. package/templates/express-auth/gitignore.template +6 -0
  75. package/templates/express-auth/package.json +13 -6
  76. package/templates/express-auth/src/app.ts +2 -0
  77. package/templates/express-auth/src/controllers/auth.controller.ts +2 -6
  78. package/templates/express-auth/src/controllers/protected.controller.ts +25 -10
  79. package/templates/express-auth/src/middleware/auth.middleware.ts +1 -0
  80. package/templates/express-auth/src/routes/protected.routes.ts +3 -1
  81. package/templates/express-auth/src/server.ts +6 -12
  82. package/templates/express-auth/src/utils/security.ts +119 -32
  83. package/templates/express-auth+/README.md +13 -10
  84. package/templates/express-auth+/docker-compose.yml +10 -0
  85. package/templates/express-auth+/gitignore.template +6 -0
  86. package/templates/express-auth+/package.json +12 -5
  87. package/templates/express-auth+/src/auth/auth.ts +3 -2
  88. package/templates/express-auth+/src/auth/controllers/password.controller.ts +3 -7
  89. package/templates/express-auth+/src/auth/controllers/protected.controller.ts +26 -11
  90. package/templates/express-auth+/src/auth/identity.adapter.ts +90 -0
  91. package/templates/express-auth+/src/auth/middleware/auth.middleware.ts +3 -4
  92. package/templates/express-auth+/src/auth/routes/protected.routes.ts +2 -2
  93. package/templates/express-auth+/src/oauth-providers/github/src/auth/auth.ts +3 -2
  94. package/templates/express-auth+/src/oauth-providers/google/src/auth/auth.ts +3 -2
  95. package/templates/express-auth+/src/oauth-providers/google-github/src/auth/auth.ts +3 -2
  96. package/templates/express-auth+/src/server.ts +5 -10
  97. package/templates/express-auth+/src/utils/security.ts +109 -28
  98. package/templates/express-base/README.md +13 -6
  99. package/templates/express-base/app.ts +2 -0
  100. package/templates/express-base/controllers/base.controller.ts +33 -19
  101. package/templates/express-base/docker-compose.yml +10 -0
  102. package/templates/express-base/gitignore.template +6 -0
  103. package/templates/express-base/package.json +11 -5
  104. package/templates/express-base/routes/base.routes.ts +1 -1
  105. package/templates/express-base/src/.env.example +7 -2
  106. package/templates/express-base/src/server.ts +6 -12
  107. package/templates/express-base/tsconfig.json +7 -40
  108. package/templates/express-base/utils/security.ts +111 -15
  109. package/templates/fullstack/.env.example +24 -0
  110. package/templates/fullstack/PRESET_CONTRACT.md +46 -0
  111. package/templates/fullstack/README.md +65 -0
  112. package/templates/fullstack/THREAT_MODEL.md +30 -0
  113. package/templates/fullstack/apps/api/package.json +48 -0
  114. package/templates/fullstack/apps/api/prisma/schema.prisma +124 -0
  115. package/templates/fullstack/apps/api/prisma/seed.ts +36 -0
  116. package/templates/fullstack/apps/api/prisma.config.ts +18 -0
  117. package/templates/fullstack/apps/api/src/app.ts +68 -0
  118. package/templates/fullstack/apps/api/src/auth/auth.controller.ts +125 -0
  119. package/templates/fullstack/apps/api/src/auth/auth.routes.ts +50 -0
  120. package/templates/fullstack/apps/api/src/auth/auth.service.ts +257 -0
  121. package/templates/fullstack/apps/api/src/auth/authenik8.ts +67 -0
  122. package/templates/fullstack/apps/api/src/auth/cookies.ts +36 -0
  123. package/templates/fullstack/apps/api/src/config/env.ts +72 -0
  124. package/templates/fullstack/apps/api/src/config/logger.ts +17 -0
  125. package/templates/fullstack/apps/api/src/config/mailer.ts +32 -0
  126. package/templates/fullstack/apps/api/src/config/origins.ts +27 -0
  127. package/templates/fullstack/apps/api/src/config/prisma.ts +9 -0
  128. package/templates/fullstack/apps/api/src/middleware/authenticate.ts +35 -0
  129. package/templates/fullstack/apps/api/src/middleware/csrf.ts +60 -0
  130. package/templates/fullstack/apps/api/src/middleware/origin.ts +12 -0
  131. package/templates/fullstack/apps/api/src/middleware/request-id.ts +9 -0
  132. package/templates/fullstack/apps/api/src/modules/admin/admin.controller.ts +17 -0
  133. package/templates/fullstack/apps/api/src/modules/admin/admin.routes.ts +14 -0
  134. package/templates/fullstack/apps/api/src/modules/admin/admin.service.ts +54 -0
  135. package/templates/fullstack/apps/api/src/modules/projects/project.controller.ts +22 -0
  136. package/templates/fullstack/apps/api/src/modules/projects/project.policy.ts +14 -0
  137. package/templates/fullstack/apps/api/src/modules/projects/project.repository.ts +20 -0
  138. package/templates/fullstack/apps/api/src/modules/projects/project.routes.ts +21 -0
  139. package/templates/fullstack/apps/api/src/modules/projects/project.service.ts +41 -0
  140. package/templates/fullstack/apps/api/src/modules/users/user.controller.ts +26 -0
  141. package/templates/fullstack/apps/api/src/modules/users/user.presenter.ts +13 -0
  142. package/templates/fullstack/apps/api/src/modules/users/user.routes.ts +21 -0
  143. package/templates/fullstack/apps/api/src/modules/users/user.service.ts +71 -0
  144. package/templates/fullstack/apps/api/src/openapi.ts +32 -0
  145. package/templates/fullstack/apps/api/src/server.ts +29 -0
  146. package/templates/fullstack/apps/api/src/types.ts +15 -0
  147. package/templates/fullstack/apps/api/src/utils/crypto.ts +4 -0
  148. package/templates/fullstack/apps/api/src/utils/http.ts +33 -0
  149. package/templates/fullstack/apps/api/src/utils/sealed-value.ts +37 -0
  150. package/templates/fullstack/apps/api/tests/project.policy.test.ts +26 -0
  151. package/templates/fullstack/apps/api/tests/registration.test.ts +69 -0
  152. package/templates/fullstack/apps/api/tests/security.test.ts +98 -0
  153. package/templates/fullstack/apps/api/tests/validation.test.ts +37 -0
  154. package/templates/fullstack/apps/api/tsconfig.json +16 -0
  155. package/templates/fullstack/apps/api/vitest.config.ts +9 -0
  156. package/templates/fullstack/apps/web/index.html +14 -0
  157. package/templates/fullstack/apps/web/package.json +31 -0
  158. package/templates/fullstack/apps/web/public/authenik8-logo.svg +53 -0
  159. package/templates/fullstack/apps/web/src/App.tsx +45 -0
  160. package/templates/fullstack/apps/web/src/auth/AuthProvider.tsx +53 -0
  161. package/templates/fullstack/apps/web/src/auth/RouteGuards.tsx +16 -0
  162. package/templates/fullstack/apps/web/src/auth/providers.ts +3 -0
  163. package/templates/fullstack/apps/web/src/components/AppShell.tsx +80 -0
  164. package/templates/fullstack/apps/web/src/components/AuthShell.tsx +26 -0
  165. package/templates/fullstack/apps/web/src/components/Page.tsx +30 -0
  166. package/templates/fullstack/apps/web/src/features/projects/ProjectPages.tsx +79 -0
  167. package/templates/fullstack/apps/web/src/main.tsx +24 -0
  168. package/templates/fullstack/apps/web/src/pages/DashboardPage.tsx +48 -0
  169. package/templates/fullstack/apps/web/src/pages/StatusPages.tsx +8 -0
  170. package/templates/fullstack/apps/web/src/pages/admin/AuditPage.tsx +19 -0
  171. package/templates/fullstack/apps/web/src/pages/admin/UsersPage.tsx +24 -0
  172. package/templates/fullstack/apps/web/src/pages/auth/LoginPage.tsx +51 -0
  173. package/templates/fullstack/apps/web/src/pages/auth/OAuthCallbackPage.tsx +26 -0
  174. package/templates/fullstack/apps/web/src/pages/auth/RecoveryPages.tsx +53 -0
  175. package/templates/fullstack/apps/web/src/pages/auth/RegisterPage.tsx +86 -0
  176. package/templates/fullstack/apps/web/src/pages/auth/VerifyEmailPage.tsx +24 -0
  177. package/templates/fullstack/apps/web/src/pages/settings/ProfilePage.tsx +34 -0
  178. package/templates/fullstack/apps/web/src/pages/settings/SecurityPage.tsx +57 -0
  179. package/templates/fullstack/apps/web/src/styles.css +289 -0
  180. package/templates/fullstack/apps/web/src/token-storage.test.ts +12 -0
  181. package/templates/fullstack/apps/web/tsconfig.app.json +19 -0
  182. package/templates/fullstack/apps/web/tsconfig.json +7 -0
  183. package/templates/fullstack/apps/web/tsconfig.node.json +10 -0
  184. package/templates/fullstack/apps/web/vite.config.ts +18 -0
  185. package/templates/fullstack/docker-compose.yml +35 -0
  186. package/templates/fullstack/docs/PRODUCTION.md +30 -0
  187. package/templates/fullstack/gitignore.template +8 -0
  188. package/templates/fullstack/package.json +39 -0
  189. package/templates/fullstack/packages/api-client/package.json +20 -0
  190. package/templates/fullstack/packages/api-client/src/index.ts +203 -0
  191. package/templates/fullstack/packages/api-client/tsconfig.json +14 -0
  192. package/templates/fullstack/packages/contracts/package.json +20 -0
  193. package/templates/fullstack/packages/contracts/src/index.ts +146 -0
  194. package/templates/fullstack/packages/contracts/tsconfig.json +13 -0
  195. package/templates/fullstack/packages/ui/package.json +22 -0
  196. package/templates/fullstack/packages/ui/src/index.tsx +33 -0
  197. package/templates/fullstack/packages/ui/tsconfig.json +14 -0
  198. package/templates/prisma/postgresql/.env.example +6 -2
  199. package/templates/prisma/postgresql/client.ts +17 -0
  200. package/templates/prisma/postgresql/prisma.config.ts +12 -0
  201. package/templates/prisma/postgresql/schema.prisma +0 -1
  202. package/templates/prisma/sqlite/.env.example +6 -2
  203. package/templates/prisma/sqlite/client.ts +16 -0
  204. package/templates/prisma/sqlite/prisma.config.ts +12 -0
  205. package/templates/prisma/sqlite/schema.prisma +0 -1
  206. package/dist/src/tests/templated-routes.test.d.ts +0 -2
  207. package/dist/src/tests/templated-routes.test.d.ts.map +0 -1
  208. package/dist/src/tests/templated-routes.test.js +0 -325
  209. package/dist/src/tests/templated-routes.test.js.map +0 -1
  210. package/dist/templates/THREAT_MODEL.md +0 -138
  211. package/dist/templates/express-auth/src/controllers/protected.controller.d.ts +0 -8
  212. package/dist/templates/express-auth/src/controllers/protected.controller.d.ts.map +0 -1
  213. package/dist/templates/express-auth/src/controllers/protected.controller.js +0 -50
  214. package/dist/templates/express-auth/src/controllers/protected.controller.js.map +0 -1
  215. package/dist/templates/express-auth/src/routes/protected.routes.d.ts +0 -2
  216. package/dist/templates/express-auth/src/routes/protected.routes.d.ts.map +0 -1
  217. package/dist/templates/express-auth/src/routes/protected.routes.js +0 -16
  218. package/dist/templates/express-auth/src/routes/protected.routes.js.map +0 -1
  219. package/dist/templates/express-auth/src/utils/security.d.ts +0 -8
  220. package/dist/templates/express-auth/src/utils/security.d.ts.map +0 -1
  221. package/dist/templates/express-auth/src/utils/security.js +0 -55
  222. package/dist/templates/express-auth/src/utils/security.js.map +0 -1
  223. package/dist/templates/express-base/controllers/base.controller.d.ts +0 -12
  224. package/dist/templates/express-base/controllers/base.controller.d.ts.map +0 -1
  225. package/dist/templates/express-base/controllers/base.controller.js +0 -77
  226. package/dist/templates/express-base/controllers/base.controller.js.map +0 -1
  227. package/dist/templates/express-base/routes/base.routes.d.ts +0 -2
  228. package/dist/templates/express-base/routes/base.routes.d.ts.map +0 -1
  229. package/dist/templates/express-base/routes/base.routes.js +0 -20
  230. package/dist/templates/express-base/routes/base.routes.js.map +0 -1
  231. package/dist/templates/express-base/utils/security.d.ts +0 -5
  232. package/dist/templates/express-base/utils/security.d.ts.map +0 -1
  233. package/dist/templates/express-base/utils/security.js +0 -40
  234. package/dist/templates/express-base/utils/security.js.map +0 -1
  235. package/dist/templates/package.json +0 -27
package/README.md CHANGED
@@ -1,72 +1,122 @@
1
1
 
2
2
  <div align="center">
3
- <pre>
4
- █████╗ █████╗
5
- ██╔══██╗ ██╔══██╗
6
- ███████║ ╚█████╔╝
7
- ██╔══██║ ██╔══██╗
8
- ██║ ██║ ╚█████╔╝
9
- ╚═╝ ╚═╝ ╚════╝
10
- </pre>
11
3
 
12
- <h1>create-authenik8-app</h1>
13
- </div>
4
+ ![create-authenik8-app logo](https://raw.githubusercontent.com/COD434/create-authenik8-app/main/assets/logo.svg)
14
5
 
15
- <p align="center">
16
- <i>Launch secure, production-ready authentication in seconds.</i>
17
- </p>
6
+ <h1>create-authenik8-app</h1>
18
7
 
19
- <p align="center">
20
- If this saved you time, a ⭐ helps a lot
21
- </p>
8
+ <p><strong>Generate a secure Express API or a connected React + Express application from one CLI.</strong></p>
22
9
 
10
+ <p>Authenik8 provides production-minded identity flows, stateful JWT rotation, Redis-backed sessions, Prisma, OAuth, and a complete fullstack application preset.</p>
23
11
 
24
- <p align="center">
25
- <b> A lightweight authentication infrastructure generator powered by an internal Identity Engine.</b>
26
- </p>
12
+ </div>
27
13
 
28
14
  ![NPM Downloads](https://img.shields.io/npm/dw/create-authenik8-app)
29
15
  [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/COD434/create-authenik8-app/badge)](https://securityscorecards.dev/viewer/?uri=github.com/COD434/create-authenik8-app)
30
16
  ![CI](https://github.com/COD434/create-authenik8-app/actions/workflows/ci.yml/badge.svg)
31
17
  [![Coverage](https://img.shields.io/badge/coverage-80%25-green)](https://github.com/COD434/create-authenik8-app/actions/workflows/ci.yml)
32
18
 
33
- ![subtitle](https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&pause=1000&color=00C2FF&width=600&lines=Production-ready+Auth+Generator;JWT+%2B+OAuth+%2B+Prisma+%2B+Redis;Identity+Engine+powered+authentication+system)
34
-
35
-
36
- ![Demo](https://raw.githubusercontent.com/COD434/create-authenik8-app/main/assets/demo.gif)
37
-
38
-
39
19
  **See a real generated example → [create-authenik8-app-example](https://github.com/COD434/create-authenik8-app-example)**
40
20
 
41
21
 
42
22
  ---
43
23
 
44
- ## Usage
24
+ ## Quickstart
45
25
 
46
26
  Create a new project:
47
27
 
48
28
  ```bash
49
29
  npx create-authenik8-app my-app
30
+ ```
31
+
32
+ Choose the installer for an Express preset when needed:
33
+
34
+ ```bash
35
+ npx create-authenik8-app my-api --package-manager pnpm
36
+ ```
37
+
38
+ The CLI uses the invoking package manager when it can identify one, otherwise it defaults to npm. Install commands use the local package cache first and suppress registry audit/funding requests during scaffolding. Set `AUTHENIK8_VERBOSE=1` to show complete installer output.
50
39
 
40
+ Choose **Full-stack application** for the complete App Kit, or select one of the three Express API presets.
41
+
42
+ ### Full-stack application
43
+
44
+ Requirements: Node.js 20.19+, 22.12+, or 24+, npm, and Docker with Compose.
45
+
46
+ ```bash
51
47
  cd my-app
48
+ npm run docker:up
49
+ npm run db:migrate
50
+ npm run db:seed
51
+ npm run dev
52
+ ```
53
+
54
+ Open `http://localhost:5173`. Vite proxies `/api` to Express on `http://localhost:3000`.
52
55
 
53
- npm run prisma:migrate
56
+ ### Express API
54
57
 
55
- redis-server --daemonize yes
58
+ Requirements: Node.js 20.19+, 22.12+, or 24+.
56
59
 
60
+ ```bash
61
+ cd my-app
62
+ npm run docker:up
63
+ npm run prisma:migrate # Skip only when JWT-only was generated without Prisma
57
64
  npm run dev
58
65
  ```
59
- Your production-ready auth backend will be ready in 50 seconds.
60
66
 
61
67
  ---
62
68
 
63
- ## What you get instantly
69
+ ## Presets
64
70
 
65
- A fully working Express authentication starter with:
71
+ | Preset | Best for | Included |
72
+ | --- | --- | --- |
73
+ | **Express API (JWT only)** | APIs that manage identities elsewhere | Protected routes, rotating refresh tokens, RBAC, optional Prisma |
74
+ | **Express API + email/password** | First-party accounts | Registration, login, password hashing, Prisma |
75
+ | **Express API + OAuth** | Multiple sign-in methods | Password auth, Google and/or GitHub OAuth, account linking |
76
+ | **Full-stack application** | Starting a complete product | React/Vite, Express, shared contracts, typed client, PostgreSQL, Redis, account/admin UI, Project CRUD |
66
77
 
67
- JWT authentication (access + refresh tokens) with secure rotation
78
+ ## Full-stack App Kit
79
+
80
+ The fullstack preset is an npm workspace with connected frontend, backend, and shared packages:
81
+
82
+ ```text
83
+ apps/
84
+ api/ Express, Authenik8, Prisma, PostgreSQL, Redis
85
+ web/ React, Vite, React Router, TanStack Query
86
+ packages/
87
+ contracts/ Shared Zod request schemas and response types
88
+ api-client/ Typed browser client and refresh handling
89
+ ui/ Reusable application primitives
90
+ ```
68
91
 
69
- Secure refresh token rotation
92
+ It includes:
93
+
94
+ - Registration, login, logout, OAuth, password recovery, and email verification
95
+ - Profile, password, linked-provider, session, and session-revocation screens
96
+ - Admin users, roles, status controls, session revocation, and audit events
97
+ - An owned Project resource across database, API, policy, client, and UI layers
98
+ - OpenAPI 3.1 output, health checks, structured logs, request IDs, and security middleware
99
+ - Docker Compose for PostgreSQL and Redis, Prisma migrations, seed data, tests, and production docs
100
+
101
+ Access tokens remain in browser memory. Refresh tokens use a restricted HttpOnly cookie, and server-side policies remain the authorization boundary.
102
+
103
+ ### Full-stack commands
104
+
105
+ | Command | Purpose |
106
+ | --- | --- |
107
+ | `npm run dev` | Build shared packages and watch the API, web app, contracts, client, and UI |
108
+ | `npm run build` | Build all production bundles |
109
+ | `npm start` | Start Express and serve the built SPA and `/api` |
110
+ | `npm run db:migrate` | Apply the Prisma development migration |
111
+ | `npm run db:seed` | Create the configured administrator and example data |
112
+ | `npm test` | Run API policy/security tests and web storage tests |
113
+ | `npm run typecheck` | Type-check every workspace |
114
+
115
+ ---
116
+
117
+ ## Core authentication features
118
+
119
+ • JWT authentication (access + refresh tokens) with secure rotation
70
120
 
71
121
  • Redis-based token storage
72
122
 
@@ -74,13 +124,13 @@ Your production-ready auth backend will be ready in 50 seconds.
74
124
 
75
125
  • TypeScript setup
76
126
 
77
- • Express server preconfigured
127
+ • Express server preconfigured with security middleware
78
128
 
79
129
  • Clean scalable folder structure
80
130
 
81
131
  • .env file generated automatically
82
132
 
83
- Production extras (PM2 cluster, Helmet, rate limiting, memory guards)
133
+ Generated threat model and production guidance
84
134
 
85
135
 
86
136
  ---
@@ -97,43 +147,55 @@ Most developers waste days (or weeks) on:
97
147
 
98
148
  • Proper access control
99
149
 
100
- Authenik8 provides all of this out of the box so you can start building your API immediately.
150
+ Authenik8 provides these foundations so you can start with a secure API or a connected application instead of rebuilding identity infrastructure.
101
151
 
102
152
 
103
153
  ---
104
154
 
105
155
  ## Requirements
106
156
 
107
- • Node.js 18+
157
+ • Node.js 20.19+, 22.12+, or 24+ for every preset
108
158
 
109
- Redis (required for refresh tokens & security features)
159
+ Docker with Compose for the generated PostgreSQL and Redis services
110
160
 
111
- Redis (Local)
112
- ```
113
- Bash
161
+ Redis is required for refresh-token rotation, OAuth state, rate limits, and session controls
114
162
 
115
- redis-server --daemonize yes
116
- ```
163
+ ### CLI compatibility
164
+
165
+ The CLI is tested on Linux, Windows, and macOS. Express presets support npm, pnpm, and Bun dependency installation; the fullstack preset uses npm workspaces. Prisma-backed pnpm and Bun projects include explicit approvals for the native dependency build steps they require.
166
+
167
+ | Option | Purpose |
168
+ | --- | --- |
169
+ | `--package-manager npm\|pnpm\|bun` | Select the installer for an Express preset |
170
+ | `--no-install` | Generate files without installing dependencies |
171
+ | `--resume` | Continue an interrupted generation |
172
+ | `--production-ready` | Add PM2 configuration to an Express preset |
173
+ | `--version` | Print the installed CLI version |
174
+
175
+ Git initialization is skipped with a clear status when Git is unavailable. Installer failures retain the package manager's diagnostic output, while successful interactive runs keep the progress display concise.
117
176
 
118
177
  ---
119
178
 
120
179
  ## Environment Variables
121
180
 
122
- Generated automatically:
181
+ The CLI creates a git-ignored `.env` with a unique ES256 signing key and refresh secret. Move those values into your deployment secret manager; never commit the private JWK.
123
182
 
124
- The CLI generates these automatically:
183
+ ### Express API presets
125
184
 
126
- ```
185
+ ```dotenv
127
186
  DATABASE_URL=file:./dev.db
128
- JWT_SECRET=your-secret
129
- REFRESH_SECRET=your-refresh-secret
187
+ AUTHENIK8_SIGNING_JWKS='[{"kty":"EC","crv":"P-256","kid":"<key-id>","x":"...","y":"...","d":"...","alg":"ES256"}]'
188
+ AUTHENIK8_ACTIVE_KID=<key-id>
189
+ AUTHENIK8_ISSUER=http://localhost:3000
190
+ AUTHENIK8_AUDIENCE=my-app-api
191
+ REFRESH_SECRET=<generated-random-secret>
130
192
  REDIS_HOST=127.0.0.1
131
193
  REDIS_PORT=6379
132
194
  ```
133
195
 
134
- For Full Auth (Password + OAuth), also set:
196
+ For password + OAuth, also configure the enabled providers:
135
197
 
136
- ```bash
198
+ ```dotenv
137
199
  GOOGLE_CLIENT_ID=your-google-client-id
138
200
  GOOGLE_CLIENT_SECRET=your-google-client-secret
139
201
  GOOGLE_REDIRECT_URI=http://localhost:3000/auth/google/callback
@@ -142,6 +204,22 @@ GITHUB_CLIENT_SECRET=your-github-client-secret
142
204
  GITHUB_REDIRECT_URI=http://localhost:3000/auth/github/callback
143
205
  ```
144
206
 
207
+ ### Full-stack preset
208
+
209
+ ```dotenv
210
+ WEB_ORIGIN=http://localhost:5173
211
+ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/authenik8?schema=public
212
+ REDIS_URL=redis://localhost:6379
213
+ AUTHENIK8_SIGNING_JWKS='[{"kty":"EC","crv":"P-256","kid":"<key-id>","x":"...","y":"...","d":"...","alg":"ES256"}]'
214
+ AUTHENIK8_ACTIVE_KID=<key-id>
215
+ AUTHENIK8_ISSUER=http://localhost:3000
216
+ AUTHENIK8_AUDIENCE=my-app-api
217
+ REFRESH_SECRET=<generated-random-secret>
218
+ GOOGLE_REDIRECT_URI=http://localhost:3000/api/auth/oauth/google/callback
219
+ GITHUB_REDIRECT_URI=http://localhost:3000/api/auth/oauth/github/callback
220
+ ```
221
+
222
+ OAuth variables are generated only for selected providers. The fullstack `.env.example` also documents cookie, proxy, logging, mail delivery, and seed-admin settings.
145
223
 
146
224
  ---
147
225
 
@@ -186,7 +264,7 @@ This design makes future additions (MFA, WebAuthn, etc.) much cleaner.
186
264
  ---
187
265
  ## Powered by
188
266
 
189
- authenik8-core (v1.0.38) identity & token engine(beta)
267
+ authenik8-core (v2.0.3) JOSE/JWK human + agent identity engine (beta)
190
268
 
191
269
  ---
192
270
 
@@ -196,8 +274,9 @@ Generated projects call:
196
274
 
197
275
  ```ts
198
276
  const auth = await createAuthenik8({
199
- jwtSecret: requiredSecret("JWT_SECRET"),
277
+ jwt: authJwkConfig(),
200
278
  refreshSecret: requiredSecret("REFRESH_SECRET"),
279
+ agent: agentIdentityConfig(),
201
280
  oauth: {
202
281
  google: {
203
282
  clientId: requiredEnv("GOOGLE_CLIENT_ID"),
@@ -219,6 +298,10 @@ That factory returns one auth object used by the generated routes:
219
298
 
220
299
  • `verifyToken(token)` verifies access tokens.
221
300
 
301
+ • `requireAuth` verifies the token and rejects Redis-revoked sessions.
302
+
303
+ • `getJwks()` returns only public verification keys for the generated JWKS endpoint.
304
+
222
305
  • `generateRefreshToken(payload)` creates stateful refresh tokens.
223
306
 
224
307
  • `refreshToken(refreshToken)` rotates refresh tokens and returns a new access/refresh pair.
@@ -229,16 +312,34 @@ That factory returns one auth object used by the generated routes:
229
312
 
230
313
  • `oauth.google` and `oauth.github` provide redirect and callback handlers.
231
314
 
232
- • `issueTokensFromProfile(profile)` turns a verified OAuth profile into app tokens through the Identity Engine.
315
+ • `issueTokens(payload)` creates an access/refresh pair with one shared session ID.
316
+
317
+ • `agent.issueToken(...)` creates a scoped, Redis-session-backed M2M identity after your application authenticates the workload.
318
+
319
+ • `agent.issueDelegatedToken(...)` creates an agent token bound to an active human session and explicit delegation policy.
320
+
321
+ • `agent.requireScopes(...)`, `agent.revokeSession(...)`, and `agent.revokeAgent(...)` enforce machine authorization and revocation.
322
+
323
+ ### Agent identity mapping
324
+
325
+ Generated projects keep agent identity disabled with `AUTHENIK8_AGENTS={}`.
326
+ Adding a validated agent-to-scope mapping enables the optional core API. Every
327
+ project also receives `AGENT_IDENTITY.md` with a database-registry example,
328
+ trusted workload exchange, scoped route, delegated-user flow, and revocation.
329
+
330
+ The CLI intentionally does not scaffold a public token-minting endpoint. It
331
+ cannot safely infer whether your workload uses mTLS, a cloud workload identity,
332
+ or a signed client assertion. Applications must authenticate that workload
333
+ before calling the privileged `agent.issueToken()` primitive.
233
334
 
234
335
  ### Redis-backed token lifecycle
235
336
 
236
337
  Authenik8-core intentionally makes JWT auth stateful:
237
338
 
238
- 1. Access tokens are signed with `JWT_SECRET`.
339
+ 1. Access tokens are signed with the active ES256 JWK and carry its `kid`, issuer, audience, and token purpose.
239
340
  2. Refresh tokens are signed with `REFRESH_SECRET` and include a unique `jti`.
240
- 3. The current valid refresh token is stored in Redis under `refresh:<userId>`.
241
- 4. Refresh calls acquire a Redis lock with `lock:<userId>`.
341
+ 3. Each session's current refresh token is stored under `refresh:<userId>:<sessionId>` and indexed for complete user-wide revocation.
342
+ 4. Refresh calls acquire a Redis lock with `lock:<userId>:<sessionId>`.
242
343
  5. The submitted refresh token must match the Redis value.
243
344
  6. A new access token and refresh token are issued.
244
345
  7. The new refresh token atomically replaces the old one.
@@ -246,6 +347,8 @@ Authenik8-core intentionally makes JWT auth stateful:
246
347
 
247
348
  This is why Redis is required. It enables refresh-token replay protection, concurrent refresh protection, and server-side session control.
248
349
 
350
+ To rotate keys, append a new private JWK to `AUTHENIK8_SIGNING_JWKS`, set `AUTHENIK8_ACTIVE_KID` to its `kid`, and retain old public JWKs until all tokens signed by them have expired. `/.well-known/jwks.json` publishes every verification key without private fields.
351
+
249
352
  ### OAuth identity resolution
250
353
 
251
354
  OAuth is not handled as separate unrelated Passport-style strategies. Provider callbacks are normalized into this profile shape:
@@ -317,7 +420,7 @@ Generated apps include a `THREAT_MODEL.md` file. It explains:
317
420
 
318
421
  • and what must be configured before production.
319
422
 
320
- Key protections include refresh-token replay detection, concurrent refresh locking, OAuth state validation, verified-email OAuth token issuance, Redis-backed rate limiting, secure headers, session tracking, and admin-route checks.
423
+ Key protections include refresh-token replay detection, concurrent refresh locking, OAuth state validation, verified-email OAuth token issuance, Redis-backed rate limiting, secure headers, human and agent session tracking, scoped agent middleware, delegated actor chains, and revocation.
321
424
 
322
425
  Key non-goals include frontend XSS protection, CSRF for cookie-based auth, object-level authorization, MFA/WebAuthn, password reset, provider dashboard security, and protection from leaked secrets.
323
426
 
@@ -0,0 +1,53 @@
1
+ <svg width="680" height="680" viewBox="0 0 680 680" role="img" aria-labelledby="title desc" xmlns="http://www.w3.org/2000/svg">
2
+ <title id="title">Authenik8 A8 logo</title>
3
+ <desc id="desc">A geometric Authenik8 mark with interlocked A and 8 forms in a mint green security badge.</desc>
4
+ <defs>
5
+ <radialGradient id="badgeFill" cx="50%" cy="42%" r="64%">
6
+ <stop offset="0" stop-color="#246a43" />
7
+ <stop offset="1" stop-color="#17492f" />
8
+ </radialGradient>
9
+ <filter id="softGlow" x="-18%" y="-18%" width="136%" height="136%">
10
+ <feGaussianBlur stdDeviation="10" result="blur" />
11
+ <feColorMatrix in="blur" type="matrix" values="0 0 0 0 0.49 0 0 0 0 0.91 0 0 0 0 0.67 0 0 0 0.45 0" result="glow" />
12
+ <feMerge>
13
+ <feMergeNode in="glow" />
14
+ <feMergeNode in="SourceGraphic" />
15
+ </feMerge>
16
+ </filter>
17
+ </defs>
18
+
19
+ <g opacity="0.34" fill="#7ce8aa">
20
+ <circle cx="100" cy="100" r="3.5" />
21
+ <circle cx="160" cy="100" r="3.5" />
22
+ <circle cx="220" cy="100" r="3.5" />
23
+ <circle cx="460" cy="100" r="3.5" />
24
+ <circle cx="520" cy="100" r="3.5" />
25
+ <circle cx="580" cy="100" r="3.5" />
26
+ <circle cx="100" cy="160" r="3.5" />
27
+ <circle cx="580" cy="160" r="3.5" />
28
+ <circle cx="100" cy="520" r="3.5" />
29
+ <circle cx="580" cy="520" r="3.5" />
30
+ <circle cx="100" cy="580" r="3.5" />
31
+ <circle cx="160" cy="580" r="3.5" />
32
+ <circle cx="220" cy="580" r="3.5" />
33
+ <circle cx="460" cy="580" r="3.5" />
34
+ <circle cx="520" cy="580" r="3.5" />
35
+ <circle cx="580" cy="580" r="3.5" />
36
+ </g>
37
+
38
+ <circle cx="340" cy="340" r="280" fill="none" stroke="#7ce8aa" stroke-width="2" stroke-dasharray="8 14" opacity="0.35" />
39
+
40
+ <g filter="url(#softGlow)">
41
+ <circle cx="340" cy="340" r="240" fill="url(#badgeFill)" />
42
+ <circle cx="340" cy="340" r="240" fill="none" stroke="#39c978" stroke-width="5" />
43
+ <circle cx="340" cy="340" r="224" fill="none" stroke="#bdf6d4" stroke-width="1.4" opacity="0.28" />
44
+
45
+ <polygon points="226 490 262 490 342 260 322 260" fill="#f7fff9" />
46
+ <polygon points="356 260 336 260 418 490 454 490" fill="#f7fff9" />
47
+ <rect x="270" y="388" width="98" height="32" rx="5" fill="#f7fff9" />
48
+
49
+ <rect x="360" y="262" width="92" height="96" rx="36" fill="#a7dfbf" />
50
+ <rect x="354" y="362" width="102" height="112" rx="42" fill="#a7dfbf" />
51
+ <rect x="358" y="349" width="94" height="22" rx="5" fill="#a7dfbf" />
52
+ </g>
53
+ </svg>