create-authenik8-app 1.0.6 → 1.0.7

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 CHANGED
@@ -1,4 +1,8 @@
1
1
 
2
+
3
+
4
+ ---
5
+
2
6
  # create-authenik8-app
3
7
 
4
8
  <p align="center">
@@ -11,7 +15,7 @@
11
15
 
12
16
  ---
13
17
 
14
- ## Usage
18
+ ## šŸ“¦ Usage
15
19
 
16
20
  Create a new project:
17
21
 
@@ -23,8 +27,8 @@ Then:
23
27
  cd my-app
24
28
  npm install
25
29
  npm run dev
26
-
27
30
  ```
31
+
28
32
  ---
29
33
 
30
34
  ## What you get instantly
@@ -33,19 +37,19 @@ A fully working Express authentication starter with:
33
37
 
34
38
  JWT authentication (access + refresh tokens)
35
39
 
36
- Secure refresh token rotation
40
+ Secure refresh token rotation
37
41
 
38
- Redis-based token storage
42
+ Redis-based token storage
39
43
 
40
- Role-Based Access Control (RBAC)
44
+ Role-Based Access Control (RBAC)
41
45
 
42
46
  TypeScript setup
43
47
 
44
- Express server preconfigured
48
+ Express server preconfigured
45
49
 
46
50
  Clean scalable folder structure
47
51
 
48
- .env file generated automatically
52
+ .env file generated automatically
49
53
 
50
54
 
51
55
 
@@ -79,8 +83,8 @@ Redis (required for refresh tokens)
79
83
 
80
84
  ---
81
85
 
82
- ## Redis Setup
83
- ```
86
+ ## Redis Setup
87
+ ```
84
88
 
85
89
  Local
86
90
 
@@ -89,10 +93,11 @@ redis-server
89
93
  Docker
90
94
 
91
95
  docker run -p 6379:6379 redis
96
+
92
97
  ```
93
98
  ---
94
99
 
95
- Environment Variables
100
+ ## Environment Variables
96
101
 
97
102
  Generated automatically:
98
103
  ```
@@ -101,22 +106,22 @@ REFRESH_SECRET=your-refresh-secret
101
106
 
102
107
  REDIS_HOST=127.0.0.1
103
108
  REDIS_PORT=6379
104
- ```
105
109
 
110
+ ```
106
111
  ---
107
112
 
108
- RBAC Example
109
-
110
- Example of a protected route:
113
+ ## RBAC Example
111
114
  ```
115
+ Example of a protected route:
116
+
112
117
  app.get("/admin", auth.requireAdmin, (req, res) => {
113
118
  res.json({ message: "Admin only route" });
114
119
  });
115
- ```
116
120
 
121
+ ```
117
122
  ---
118
123
 
119
- ## Powered by
124
+ šŸ“¦ Powered by
120
125
 
121
126
  authenik8-core
122
127
 
@@ -126,9 +131,10 @@ authenik8-core
126
131
 
127
132
  ## Project Structure
128
133
  ```
134
+
129
135
  my-app/
130
136
  ā”œā”€ā”€ src/
131
- │ ā”œ
137
+ │ |
132
138
  │ ā”œ
133
139
  │ └── server.ts
134
140
  ā”œā”€ā”€ .env
@@ -150,7 +156,7 @@ RBAC is included via middleware (e.g. requireAdmin)
150
156
 
151
157
  ---
152
158
 
153
- ## Roadmap
159
+ ## Roadmap
154
160
 
155
161
  OAuth providers (Google, GitHub)
156
162
 
@@ -162,3 +168,6 @@ Admin dashboard
162
168
 
163
169
  Production presets
164
170
 
171
+
172
+
173
+ ---
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,182 @@
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
+ - Fastify(coming soon)
47
+
48
+ Database (if Prisma enabled):
49
+ - PostgreSQL
50
+ - SQLite (quick start)
51
+
52
+ Features:
53
+ - Prisma ORM (optional)
54
+ - Git initialization (optional)
55
+ `));
56
+ // šŸ”„ PROMPTS
57
+ const answers = await inquirer.prompt([
58
+ {
59
+ type: "list",
60
+ name: "framework",
61
+ message: "Choose framework:",
62
+ choices: ["Express", "Fastify (coming soon)"],
63
+ },
64
+ {
65
+ type: "confirm",
66
+ name: "usePrisma",
67
+ message: "Use Prisma?",
68
+ default: true,
69
+ },
70
+ {
71
+ type: "list",
72
+ name: "database",
73
+ message: "Choose database:",
74
+ choices: [
75
+ { name: "PostgreSQL", value: "postgresql" },
76
+ { name: "SQLite (quick start)", value: "sqlite" }
77
+ ],
78
+ when: (answers) => answers.usePrisma,
79
+ },
80
+ {
81
+ type: "confirm",
82
+ name: "useGit",
83
+ message: "Initialize git?",
84
+ default: true,
85
+ },
86
+ ]);
87
+ // 🚫 Prevent overwrite
88
+ if (fs.existsSync(targetDir)) {
89
+ console.log(chalk.red("\nāŒ Folder already exists"));
90
+ process.exit(1);
91
+ }
92
+ console.log(chalk.cyan("\nāš™ļø Setting things up...\n"));
93
+ const templateRoot = path.resolve(__dirname, "../../templates");
94
+ const templatePath = answers.framework === "Express"
95
+ ? path.join(templateRoot, "express-ts")
96
+ : path.join(templateRoot, "express-ts"); // fallback for now
97
+ // šŸ“ Create project (SPINNER)
98
+ const createSpinner = ora("Creating project structure...").start();
99
+ try {
100
+ await fs.copy(templatePath, targetDir);
101
+ createSpinner.succeed("Project files created");
102
+ }
103
+ catch (err) {
104
+ createSpinner.fail("Failed to create project");
105
+ console.error(err);
106
+ process.exit(1);
107
+ }
108
+ if (answers.usePrisma) {
109
+ const prismaSpinner = ora("Adding Prisma setup...").start();
110
+ try {
111
+ const dbType = answers.database.toLowerCase().includes("post")
112
+ ? "postgresql"
113
+ : "sqlite";
114
+ const prismaTemplatePath = path.join(templateRoot, `prisma/${dbType}`);
115
+ // Copy prisma schema
116
+ await fs.copy(path.join(prismaTemplatePath, "schema.prisma"), path.join(targetDir, "prisma/schema.prisma"));
117
+ // Copy env
118
+ await fs.copy(path.join(prismaTemplatePath, ".env"), path.join(targetDir, ".env"));
119
+ const pkgPath = path.join(targetDir, "package.json");
120
+ const pkg = await fs.readJson(pkgPath);
121
+ // Inject dependencies
122
+ pkg.dependencies = {
123
+ ...pkg.dependencies,
124
+ "@prisma/client": "^5.0.0",
125
+ };
126
+ pkg.devDependencies = {
127
+ ...pkg.devDependencies,
128
+ prisma: "^5.0.0",
129
+ };
130
+ // Add scripts
131
+ pkg.scripts = {
132
+ ...pkg.scripts,
133
+ "prisma:generate": "prisma generate",
134
+ "prisma:migrate": "prisma migrate dev",
135
+ };
136
+ prismaSpinner.succeed(`Prisma (${answers.database}) configured`);
137
+ }
138
+ catch (err) {
139
+ prismaSpinner.fail("Failed to setup Prisma");
140
+ console.error(err);
141
+ }
142
+ }
143
+ //
144
+ const installSpinner = ora("Installing dependencies...(this may take a few minutes)").start();
145
+ try {
146
+ execSync("npm install", {
147
+ cwd: targetDir,
148
+ stdio: "ignore",
149
+ });
150
+ installSpinner.succeed("Dependencies installed");
151
+ }
152
+ catch (err) {
153
+ installSpinner.fail("Failed to install dependencies");
154
+ console.error(err);
155
+ process.exit(1);
156
+ }
157
+ if (answers.useGit) {
158
+ const gitSpinner = ora("Initializing git...").start();
159
+ try {
160
+ execSync("git init", {
161
+ cwd: targetDir,
162
+ stdio: "ignore",
163
+ });
164
+ gitSpinner.succeed("Git initialized");
165
+ }
166
+ catch (err) {
167
+ gitSpinner.fail("Git init failed");
168
+ }
169
+ }
170
+ console.log(chalk.green.bold("\nšŸŽ‰ Authenik8 app created successfully!\n"));
171
+ console.log(chalk.white(`
172
+ Next steps:
173
+
174
+ cd ${projectName}
175
+ cp .env.example .env
176
+ npm run dev
177
+
178
+ šŸ”„ Your Authenik8 server is ready to go!
179
+ `));
180
+ }
181
+ main();
182
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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,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AAE;YACtB,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;QAGH,cAAc,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,cAAc,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QACtD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAGD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,UAAU,GAAG,GAAG,CAAC,qBAAqB,CAAC,CAAC,KAAK,EAAE,CAAC;QAEtD,IAAI,CAAC;YACH,QAAQ,CAAC,UAAU,EAAE;gBACnB,GAAG,EAAE,SAAS;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC,CAAC;IAE5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC;;;OAGnB,WAAW;;;;;CAKjB,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-authenik8-app",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
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.",
5
5
  "bin": {
6
6
  "create-authenik8-app": "dist/bin/index.js"
package/LICENSE DELETED
@@ -1,22 +0,0 @@
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.