create-authenik8-app 1.0.4 → 1.0.6

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+
2
+ MIT License
3
+
4
+ Copyright (c) 2026 TheSBD
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,4 @@
1
1
 
2
-
3
-
4
- ---
5
-
6
2
  # create-authenik8-app
7
3
 
8
4
  <p align="center">
@@ -15,7 +11,7 @@
15
11
 
16
12
  ---
17
13
 
18
- ## šŸ“¦ Usage
14
+ ## Usage
19
15
 
20
16
  Create a new project:
21
17
 
@@ -27,8 +23,8 @@ Then:
27
23
  cd my-app
28
24
  npm install
29
25
  npm run dev
30
- ```
31
26
 
27
+ ```
32
28
  ---
33
29
 
34
30
  ## What you get instantly
@@ -37,19 +33,19 @@ A fully working Express authentication starter with:
37
33
 
38
34
  JWT authentication (access + refresh tokens)
39
35
 
40
- Secure refresh token rotation
36
+ Secure refresh token rotation
41
37
 
42
- Redis-based token storage
38
+ Redis-based token storage
43
39
 
44
- Role-Based Access Control (RBAC)
40
+ Role-Based Access Control (RBAC)
45
41
 
46
42
  TypeScript setup
47
43
 
48
- Express server preconfigured
44
+ Express server preconfigured
49
45
 
50
46
  Clean scalable folder structure
51
47
 
52
- .env file generated automatically
48
+ .env file generated automatically
53
49
 
54
50
 
55
51
 
@@ -83,8 +79,8 @@ Redis (required for refresh tokens)
83
79
 
84
80
  ---
85
81
 
86
- ## Redis Setup
87
- ```
82
+ ## Redis Setup
83
+ ```
88
84
 
89
85
  Local
90
86
 
@@ -93,11 +89,10 @@ redis-server
93
89
  Docker
94
90
 
95
91
  docker run -p 6379:6379 redis
96
-
97
92
  ```
98
93
  ---
99
94
 
100
- ## Environment Variables
95
+ Environment Variables
101
96
 
102
97
  Generated automatically:
103
98
  ```
@@ -106,22 +101,22 @@ REFRESH_SECRET=your-refresh-secret
106
101
 
107
102
  REDIS_HOST=127.0.0.1
108
103
  REDIS_PORT=6379
109
-
110
104
  ```
105
+
111
106
  ---
112
107
 
113
- ## RBAC Example
114
- ```
115
- Example of a protected route:
108
+ RBAC Example
116
109
 
110
+ Example of a protected route:
111
+ ```
117
112
  app.get("/admin", auth.requireAdmin, (req, res) => {
118
113
  res.json({ message: "Admin only route" });
119
114
  });
120
-
121
115
  ```
116
+
122
117
  ---
123
118
 
124
- šŸ“¦ Powered by
119
+ ## Powered by
125
120
 
126
121
  authenik8-core
127
122
 
@@ -131,10 +126,9 @@ authenik8-core
131
126
 
132
127
  ## Project Structure
133
128
  ```
134
-
135
129
  my-app/
136
130
  ā”œā”€ā”€ src/
137
- │ |
131
+ │ ā”œ
138
132
  │ ā”œ
139
133
  │ └── server.ts
140
134
  ā”œā”€ā”€ .env
@@ -156,7 +150,7 @@ RBAC is included via middleware (e.g. requireAdmin)
156
150
 
157
151
  ---
158
152
 
159
- ## Roadmap
153
+ ## Roadmap
160
154
 
161
155
  OAuth providers (Google, GitHub)
162
156
 
@@ -168,6 +162,3 @@ Admin dashboard
168
162
 
169
163
  Production presets
170
164
 
171
-
172
-
173
- ---
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "create-authenik8-app",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
+ "description":"Create production-ready backend APIs in seconds. Authenik8 scaffolds Express + Prisma projects with JWT authentication, database setup (PostgreSQL or SQLite), and scalable architecture out of the box.",
4
5
  "bin": {
5
6
  "create-authenik8-app": "dist/bin/index.js"
6
7
  },
@@ -24,6 +25,8 @@
24
25
  "project-generator",
25
26
  "fullstack-backend"
26
27
  ],
28
+ "license":"MIT",
29
+ "author":"Karabo Seeisa",
27
30
  "type": "module",
28
31
  "dependencies": {
29
32
  "authenik8-core": "^0.1.4",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "authenik8-app",
3
- "version": "1.0.0",
3
+ "version": "1.0.5",
4
4
  "scripts": {
5
- "dev": "ts-node-dev --respawn --transpile-only ./server.ts",
5
+ "dev": "ts-node-dev --respawn --transpile-only ./src/server.ts",
6
6
  "build": "tsc",
7
7
  "start": "node dist/server.js"
8
8
  },
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
package/dist/bin/index.js DELETED
@@ -1,181 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "fs-extra";
3
- import path from "path";
4
- import chalk from "chalk";
5
- import inquirer from "inquirer";
6
- import ora from "ora";
7
- import { execSync } from "child_process";
8
- import { fileURLToPath } from "url";
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
11
- const projectName = process.argv[2];
12
- if (!projectName) {
13
- console.log(chalk.red("āŒ Please provide a project name"));
14
- process.exit(1);
15
- }
16
- const targetDir = path.join(process.cwd(), projectName);
17
- async function main() {
18
- console.log(chalk.blue.bold("\nšŸš€ Authenik8 App Generator\n"));
19
- if (process.argv.includes("--help")) {
20
- console.log(`
21
- Authenik8 CLI
22
-
23
- Usage:
24
- create-authenik8-app <project-name>
25
-
26
- Options:
27
- --help Show this help message
28
-
29
- Features:
30
- - Express backend (default)
31
- - Optional Prisma ORM
32
- - PostgreSQL (production)
33
- - SQLite (quick start)
34
- - Optional Git initialization
35
-
36
- Examples:
37
- create-authenik8-app my-app
38
- `);
39
- process.exit(0);
40
- }
41
- console.log(chalk.gray(`
42
- Available options:
43
-
44
- Frameworks:
45
- - Express
46
-
47
- Database (if Prisma enabled):
48
- - PostgreSQL
49
- - SQLite (quick start)
50
-
51
- Features:
52
- - Prisma ORM (optional)
53
- - Git initialization (optional)
54
- `));
55
- // šŸ”„ PROMPTS
56
- const answers = await inquirer.prompt([
57
- {
58
- type: "list",
59
- name: "framework",
60
- message: "Choose framework:",
61
- choices: ["Express", "Fastify (coming soon)"],
62
- },
63
- {
64
- type: "confirm",
65
- name: "usePrisma",
66
- message: "Use Prisma?",
67
- default: true,
68
- },
69
- {
70
- type: "list",
71
- name: "database",
72
- message: "Choose database:",
73
- choices: [
74
- { name: "PostgreSQL", value: "postgresql" },
75
- { name: "SQLite (quick start)", value: "sqlite" }
76
- ],
77
- when: (answers) => answers.usePrisma,
78
- },
79
- {
80
- type: "confirm",
81
- name: "useGit",
82
- message: "Initialize git?",
83
- default: true,
84
- },
85
- ]);
86
- // 🚫 Prevent overwrite
87
- if (fs.existsSync(targetDir)) {
88
- console.log(chalk.red("\nāŒ Folder already exists"));
89
- process.exit(1);
90
- }
91
- console.log(chalk.cyan("\nāš™ļø Setting things up...\n"));
92
- const templateRoot = path.resolve(__dirname, "../../templates");
93
- const templatePath = answers.framework === "Express"
94
- ? path.join(templateRoot, "express-ts")
95
- : path.join(templateRoot, "express-ts"); // fallback for now
96
- // šŸ“ Create project (SPINNER)
97
- const createSpinner = ora("Creating project structure...").start();
98
- try {
99
- await fs.copy(templatePath, targetDir);
100
- createSpinner.succeed("Project files created");
101
- }
102
- catch (err) {
103
- createSpinner.fail("Failed to create project");
104
- console.error(err);
105
- process.exit(1);
106
- }
107
- if (answers.usePrisma) {
108
- const prismaSpinner = ora("Adding Prisma setup...").start();
109
- try {
110
- const dbType = answers.database.toLowerCase().includes("post")
111
- ? "postgresql"
112
- : "sqlite";
113
- const prismaTemplatePath = path.join(templateRoot, `prisma/${dbType}`);
114
- // Copy prisma schema
115
- await fs.copy(path.join(prismaTemplatePath, "schema.prisma"), path.join(targetDir, "prisma/schema.prisma"));
116
- // Copy env
117
- await fs.copy(path.join(prismaTemplatePath, ".env"), path.join(targetDir, ".env"));
118
- const pkgPath = path.join(targetDir, "package.json");
119
- const pkg = await fs.readJson(pkgPath);
120
- // Inject dependencies
121
- pkg.dependencies = {
122
- ...pkg.dependencies,
123
- "@prisma/client": "^5.0.0",
124
- };
125
- pkg.devDependencies = {
126
- ...pkg.devDependencies,
127
- prisma: "^5.0.0",
128
- };
129
- // Add scripts
130
- pkg.scripts = {
131
- ...pkg.scripts,
132
- "prisma:generate": "prisma generate",
133
- "prisma:migrate": "prisma migrate dev",
134
- };
135
- prismaSpinner.succeed(`Prisma (${answers.database}) configured`);
136
- }
137
- catch (err) {
138
- prismaSpinner.fail("Failed to setup Prisma");
139
- console.error(err);
140
- }
141
- }
142
- //
143
- const installSpinner = ora("Installing dependencies...(this may take a few minutes)").start();
144
- try {
145
- execSync("npm install", {
146
- cwd: targetDir,
147
- stdio: "ignore",
148
- });
149
- installSpinner.succeed("Dependencies installed");
150
- }
151
- catch (err) {
152
- installSpinner.fail("Failed to install dependencies");
153
- console.error(err);
154
- process.exit(1);
155
- }
156
- if (answers.useGit) {
157
- const gitSpinner = ora("Initializing git...").start();
158
- try {
159
- execSync("git init", {
160
- cwd: targetDir,
161
- stdio: "ignore",
162
- });
163
- gitSpinner.succeed("Git initialized");
164
- }
165
- catch (err) {
166
- gitSpinner.fail("Git init failed");
167
- }
168
- }
169
- console.log(chalk.green.bold("\nšŸŽ‰ Authenik8 app created successfully!\n"));
170
- console.log(chalk.white(`
171
- Next steps:
172
-
173
- cd ${projectName}
174
- cp .env.example .env
175
- npm run dev
176
-
177
- šŸ”„ Your Authenik8 server is ready to go!
178
- `));
179
- }
180
- main();
181
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAGpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAG3C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpC,IAAI,CAAC,WAAW,EAAE,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;AAExD,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAE/D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