create-arktos 1.5.0 → 2.0.0

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 (37) hide show
  1. package/LICENSE +34 -21
  2. package/README.md +54 -490
  3. package/cli/generator.js +184 -0
  4. package/cli/package-manager.js +66 -0
  5. package/cli/project-name.js +179 -0
  6. package/cli/ui.js +54 -0
  7. package/index.js +153 -0
  8. package/package.json +27 -54
  9. package/templates/backend/.prettierrc +23 -0
  10. package/templates/backend/LICENSE +34 -0
  11. package/bin/cli.js +0 -332
  12. /package/{.env.example → templates/backend/.env.example} +0 -0
  13. /package/{eslint.config.js → templates/backend/eslint.config.js} +0 -0
  14. /package/{template.package.json → templates/backend/package.json} +0 -0
  15. /package/{prisma → templates/backend/prisma}/schema.prisma +0 -0
  16. /package/{src → templates/backend/src}/app.ts +0 -0
  17. /package/{src → templates/backend/src}/config/env.validation.ts +0 -0
  18. /package/{src → templates/backend/src}/config/logger.ts +0 -0
  19. /package/{src → templates/backend/src}/constants/errorCodes.ts +0 -0
  20. /package/{src → templates/backend/src}/constants/messages.ts +0 -0
  21. /package/{src → templates/backend/src}/controllers/auth.controller.ts +0 -0
  22. /package/{src → templates/backend/src}/middleware/index.ts +0 -0
  23. /package/{src → templates/backend/src}/routes/auth.routes.ts +0 -0
  24. /package/{src → templates/backend/src}/routes/index.ts +0 -0
  25. /package/{src → templates/backend/src}/schemas/index.ts +0 -0
  26. /package/{src → templates/backend/src}/services/database.service.ts +0 -0
  27. /package/{src → templates/backend/src}/services/email.service.ts +0 -0
  28. /package/{src → templates/backend/src}/services/jwt.service.ts +0 -0
  29. /package/{src → templates/backend/src}/types/express.d.ts +0 -0
  30. /package/{src → templates/backend/src}/types/index.ts +0 -0
  31. /package/{src → templates/backend/src}/utils/response.ts +0 -0
  32. /package/{src → templates/backend/src}/views/emails/notification.html +0 -0
  33. /package/{src → templates/backend/src}/views/emails/resetPassword.html +0 -0
  34. /package/{src → templates/backend/src}/views/emails/verification.html +0 -0
  35. /package/{src → templates/backend/src}/views/emails/welcome.html +0 -0
  36. /package/{tsconfig.json → templates/backend/tsconfig.json} +0 -0
  37. /package/{vercel.json → templates/backend/vercel.json} +0 -0
package/package.json CHANGED
@@ -1,35 +1,26 @@
1
1
  {
2
2
  "name": "create-arktos",
3
- "version": "1.5.0",
4
- "description": "🚀 A modern Node.js backend boilerplate with TypeScript, Express, JWT authentication, Prisma ORM, PostgreSQL, and Resend email service. Includes complete authentication flow, security middleware, and database management.",
5
- "main": "bin/cli.js",
6
- "bin": {
7
- "create-arktos": "./bin/cli.js"
8
- },
3
+ "version": "2.0.0",
4
+ "type": "module",
5
+ "description": "🚀 Production-ready Node.js & TypeScript backend boilerplate generator with Express, JWT, Prisma ORM, PostgreSQL (Neon), and Resend",
6
+ "license": "BSL-1.1",
9
7
  "files": [
10
- "bin/",
11
- "src/",
12
- "prisma/",
13
- "template.package.json",
14
- ".env.example",
15
- "vercel.json",
16
- "tsconfig.json",
17
- "eslint.config.js",
8
+ "index.js",
9
+ "cli",
10
+ "templates",
18
11
  "README.md",
19
12
  "LICENSE"
20
13
  ],
21
- "scripts": {
22
- "build": "tsc",
23
- "start": "node bin/cli.js",
24
- "dev": "ts-node --esm bin/cli.js",
25
- "test": "echo \"Error: no test specified\" && exit 1",
26
- "lint": "eslint . --ext .ts,.js",
27
- "lint:fix": "eslint . --ext .ts,.js --fix",
28
- "format": "prettier --write .",
29
- "format:check": "prettier --check .",
30
- "typecheck": "tsc --noEmit",
31
- "prepublishOnly": "echo 'Publishing arktos CLI tool...'",
32
- "clean": "rm -rf dist"
14
+ "bin": {
15
+ "create-arktos": "./index.js"
16
+ },
17
+ "engines": {
18
+ "node": ">=18.0.0"
19
+ },
20
+ "author": {
21
+ "name": "Zafer Gök",
22
+ "email": "gok.zaferr@gmail.com",
23
+ "url": "https://github.com/zzafergok"
33
24
  },
34
25
  "keywords": [
35
26
  "nodejs",
@@ -56,16 +47,6 @@
56
47
  "starter",
57
48
  "scaffold"
58
49
  ],
59
- "author": {
60
- "name": "Zafer Gök",
61
- "email": "gok.zaferr@gmail.com",
62
- "url": "https://github.com/zzafergok"
63
- },
64
- "license": "MIT",
65
- "engines": {
66
- "node": ">=18.0.0",
67
- "npm": ">=8.0.0"
68
- },
69
50
  "repository": {
70
51
  "type": "git",
71
52
  "url": "git+https://github.com/zzafergok/arktos.git"
@@ -74,10 +55,6 @@
74
55
  "url": "https://github.com/zzafergok/arktos/issues"
75
56
  },
76
57
  "homepage": "https://github.com/zzafergok/arktos#readme",
77
- "funding": {
78
- "type": "github",
79
- "url": "https://github.com/sponsors/zzafergok"
80
- },
81
58
  "publishConfig": {
82
59
  "access": "public",
83
60
  "registry": "https://registry.npmjs.org/"
@@ -85,24 +62,20 @@
85
62
  "dependencies": {
86
63
  "chalk": "^5.3.0",
87
64
  "commander": "^12.0.0",
88
- "inquirer": "^10.0.0",
65
+ "fs-extra": "^11.2.0",
89
66
  "ora": "^8.0.1",
90
- "fs-extra": "^11.2.0"
67
+ "prompts": "^2.4.2"
91
68
  },
92
69
  "devDependencies": {
93
70
  "@types/fs-extra": "^11.0.4",
94
- "@types/inquirer": "^9.0.7",
95
71
  "@types/node": "^22.0.0",
96
- "@typescript-eslint/eslint-plugin": "^8.0.0",
97
- "@typescript-eslint/parser": "^8.0.0",
98
- "eslint": "^9.0.0",
99
- "eslint-config-prettier": "^9.0.0",
100
- "eslint-plugin-prettier": "^5.0.0",
101
- "prettier": "^3.3.0",
102
- "ts-node": "^10.9.2",
103
- "typescript": "^5.5.0"
72
+ "@types/prompts": "^2.4.9"
104
73
  },
105
- "peerDependencies": {
106
- "typescript": ">=4.7.0"
74
+ "scripts": {
75
+ "start": "node index.js",
76
+ "build": "node -e 'process.exit(0)'",
77
+ "type-check": "node -e 'process.exit(0)'",
78
+ "pack:check": "node scripts/check-tarball-size.mjs",
79
+ "test:smoke": "node scripts/smoke-test-template.mjs"
107
80
  }
108
- }
81
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": true,
5
+ "printWidth": 100,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "bracketSpacing": true,
9
+ "bracketSameLine": false,
10
+ "arrowParens": "avoid",
11
+ "endOfLine": "lf",
12
+ "quoteProps": "as-needed",
13
+ "jsxSingleQuote": true,
14
+ "overrides": [
15
+ {
16
+ "files": "*.json",
17
+ "options": {
18
+ "tabWidth": 2
19
+ }
20
+ }
21
+ ]
22
+ }
23
+ EOF < /dev/null
@@ -0,0 +1,34 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters:
4
+
5
+ Licensor: Zafer Gök
6
+ Licensed Work: Arktos, including the create-arktos CLI generator, backend architectures, templates, and associated documentation.
7
+ Additional Use Grant: You may use the Licensed Work free of charge for non-commercial, evaluation, educational, internal development, and testing purposes. Any production deployment, commercial offering, commercial client deliverables, or providing the Licensed Work (or modified versions thereof) as a paid backend service or competing product requires a separate commercial license agreement with the Licensor.
8
+ Change Date: 2030-01-01
9
+ Change License: Apache License, Version 2.0 (or at your option, MIT License)
10
+
11
+ Notice:
12
+
13
+ The Business Source License 1.1 (the "License") is not an Open Source license.
14
+ However, the Licensor pledges to grant an Open Source license on the Change Date.
15
+
16
+ Text of the License:
17
+
18
+ 1. Grant of License.
19
+ Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-commercial use of the Licensed Work, subject to the Additional Use Grant and other conditions set forth herein.
20
+
21
+ 2. Additional Use Grant.
22
+ As specified in the Parameters above, you are permitted to use the Licensed Work free of charge exclusively under the conditions defined in the Additional Use Grant. Use of the Licensed Work outside the Additional Use Grant without obtaining a commercial license from the Licensor is strictly prohibited.
23
+
24
+ 3. Commercial Inquiries.
25
+ To obtain a commercial license for production, commercial, or enterprise use, contact the Licensor at gok.zaferr@gmail.com or visit https://github.com/zzafergok/arktos.
26
+
27
+ 4. Change Date and Change License.
28
+ Effective on the Change Date specified in the Parameters above, the Licensor hereby grants you a license to the Licensed Work under the Change License specified in the Parameters above, without the restrictions of this License.
29
+
30
+ 5. Attribution and Notice.
31
+ You must retain all copyright notices, trademarks, and this License notice in all copies or substantial portions of the Licensed Work.
32
+
33
+ 6. Disclaimer of Warranties.
34
+ THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE LICENSOR OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
package/bin/cli.js DELETED
@@ -1,332 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { execSync } = require('child_process');
6
-
7
- const TEMPLATE_DIR = path.join(__dirname, '../src');
8
- const ROOT_DIR = path.join(__dirname, '..');
9
-
10
- function createProject(projectName) {
11
- console.log(`🚀 Creating Arktos project: ${projectName}`);
12
- console.log();
13
-
14
- // Validate project name
15
- if (!projectName || !/^[a-zA-Z0-9-_]+$/.test(projectName)) {
16
- console.error('❌ Invalid project name. Use only letters, numbers, hyphens, and underscores.');
17
- process.exit(1);
18
- }
19
-
20
- // Check if directory already exists
21
- if (fs.existsSync(projectName)) {
22
- console.error(`❌ Directory '${projectName}' already exists.`);
23
- process.exit(1);
24
- }
25
-
26
- // Always use TypeScript template
27
- const packageTemplate = 'template.package.json';
28
-
29
- try {
30
- // Create project directory
31
- console.log('📁 Creating project directory...');
32
- fs.mkdirSync(projectName);
33
-
34
- // Copy src directory
35
- console.log('📋 Copying TypeScript source files...');
36
- const targetSrcDir = path.join(projectName, 'src');
37
- copyDir(TEMPLATE_DIR, targetSrcDir);
38
-
39
- // Copy prisma directory
40
- console.log('🗄️ Copying database schema...');
41
- const prismaDir = path.join(ROOT_DIR, 'prisma');
42
- const targetPrismaDir = path.join(projectName, 'prisma');
43
- if (fs.existsSync(prismaDir)) {
44
- copyDir(prismaDir, targetPrismaDir);
45
- }
46
-
47
- // Copy template config files
48
- console.log('📝 Copying configuration files...');
49
- copyTemplateFiles(projectName);
50
-
51
- // Copy and update package.json
52
- console.log('🔧 Updating project configuration...');
53
- const templatePackageJsonPath = path.join(ROOT_DIR, packageTemplate);
54
- const targetPackageJsonPath = path.join(projectName, 'package.json');
55
-
56
- if (fs.existsSync(templatePackageJsonPath)) {
57
- const packageJson = JSON.parse(fs.readFileSync(templatePackageJsonPath, 'utf8'));
58
-
59
- // Update project name
60
- packageJson.name = projectName;
61
-
62
- fs.writeFileSync(targetPackageJsonPath, JSON.stringify(packageJson, null, 2));
63
- }
64
-
65
-
66
- console.log('✅ Project created successfully!');
67
- console.log();
68
- console.log('🎯 Next steps:');
69
- console.log(` cd ${projectName}`);
70
- console.log(' npm install');
71
- console.log(' cp .env.example .env');
72
- console.log(' # Edit .env with your database and API keys');
73
- console.log(' npx prisma migrate dev');
74
- console.log(' npm run dev');
75
- console.log();
76
- console.log('📚 Documentation:');
77
- console.log(' • Backend API: http://localhost:3001');
78
- console.log(' • Setup your Neon database: https://neon.tech');
79
- console.log(' • Setup Resend for emails: https://resend.com');
80
- console.log(' • Deploy on Vercel: https://vercel.com');
81
- console.log();
82
- console.log('🔧 Available commands:');
83
- console.log(' npm run dev - Start development server');
84
- console.log(' npm run build - Build for production');
85
- console.log(' npm run start - Start production server');
86
- console.log(' npm run db:studio - Open Prisma Studio');
87
- console.log();
88
- console.log('Happy coding! 🎉');
89
-
90
- } catch (error) {
91
- console.error('❌ Error creating project:', error.message);
92
-
93
- // Cleanup on error
94
- try {
95
- if (fs.existsSync(projectName)) {
96
- fs.rmSync(projectName, { recursive: true, force: true });
97
- }
98
- } catch (cleanupError) {
99
- console.error('❌ Error during cleanup:', cleanupError.message);
100
- }
101
-
102
- process.exit(1);
103
- }
104
- }
105
-
106
- function copyDir(src, dest) {
107
- // Create destination directory
108
- if (!fs.existsSync(dest)) {
109
- fs.mkdirSync(dest, { recursive: true });
110
- }
111
-
112
- // Read source directory
113
- const entries = fs.readdirSync(src, { withFileTypes: true });
114
-
115
- for (const entry of entries) {
116
- const srcPath = path.join(src, entry.name);
117
- const destPath = path.join(dest, entry.name);
118
-
119
- if (entry.isDirectory()) {
120
- // Recursively copy subdirectories
121
- copyDir(srcPath, destPath);
122
- } else {
123
- // Copy files
124
- fs.copyFileSync(srcPath, destPath);
125
- }
126
- }
127
- }
128
-
129
- function copyTemplateFiles(dest) {
130
- // Create common config files
131
- const configFiles = {
132
- '.gitignore': `# Dependencies
133
- node_modules/
134
- npm-debug.log*
135
- yarn-debug.log*
136
- yarn-error.log*
137
-
138
- # Environment variables
139
- .env
140
- .env.local
141
- .env.development.local
142
- .env.test.local
143
- .env.production.local
144
-
145
- # Build outputs
146
- dist/
147
- build/
148
-
149
- # Logs
150
- logs/
151
- *.log
152
-
153
- # Runtime data
154
- pids
155
- *.pid
156
- *.seed
157
- *.pid.lock
158
-
159
- # Coverage directory used by tools like istanbul
160
- coverage/
161
-
162
- # OS generated files
163
- .DS_Store
164
- .DS_Store?
165
- ._*
166
- .Spotlight-V100
167
- .Trashes
168
- ehthumbs.db
169
- Thumbs.db
170
-
171
- # IDE files
172
- .vscode/
173
- .idea/
174
- *.swp
175
- *.swo
176
- *~
177
-
178
- # Prisma
179
- prisma/migrations/dev.db*
180
-
181
- # Temporary files
182
- *.tmp
183
- *.temp
184
- .cache/
185
-
186
- # Vercel
187
- .vercel
188
-
189
- # TypeScript
190
- *.tsbuildinfo`,
191
- '.prettierrc': `{
192
- "semi": true,
193
- "trailingComma": "es5",
194
- "singleQuote": true,
195
- "printWidth": 80,
196
- "tabWidth": 2,
197
- "useTabs": false,
198
- "bracketSpacing": true,
199
- "arrowParens": "avoid",
200
- "endOfLine": "lf"
201
- }`,
202
- 'README.md': `# ${path.basename(dest)} API
203
-
204
- A modern Node.js backend API built with Arktos boilerplate.
205
-
206
- ## 🚀 Features
207
-
208
- - **TypeScript**: Full TypeScript support with strict type checking
209
- - **Express.js**: Fast, unopinionated web framework
210
- - **Authentication**: Complete JWT-based authentication system
211
- - **Database**: Prisma ORM with PostgreSQL (Neon serverless)
212
- - **Email Service**: Resend integration for transactional emails
213
- - **Security**: Helmet, CORS, rate limiting, and security middleware
214
- - **Validation**: Zod-based request validation
215
- - **Logging**: Winston logger with file rotation
216
- - **Error Handling**: Comprehensive error handling and responses
217
- - **API Documentation**: Structured API responses
218
- - **Deployment Ready**: Vercel configuration included
219
-
220
- ## 📋 Prerequisites
221
-
222
- - Node.js 18+ and npm 8+
223
- - PostgreSQL database (recommend [Neon](https://neon.tech/) for serverless)
224
- - Resend account for email service
225
-
226
- ## 🛠️ Installation
227
-
228
- 1. **Install dependencies**
229
- \`\`\`bash
230
- npm install
231
- \`\`\`
232
-
233
- 2. **Environment Setup**
234
- \`\`\`bash
235
- cp .env.example .env
236
- \`\`\`
237
- Fill in your environment variables in \`.env\`
238
-
239
- 3. **Database Setup**
240
- \`\`\`bash
241
- # Generate Prisma client
242
- npx prisma generate
243
-
244
- # Run database migrations
245
- npx prisma migrate dev
246
- \`\`\`
247
-
248
- 4. **Start Development Server**
249
- \`\`\`bash
250
- npm run dev
251
- \`\`\`
252
-
253
- ## 🔧 Available Scripts
254
-
255
- - \`npm run dev\` - Start development server with hot reload
256
- - \`npm run build\` - Build for production
257
- - \`npm start\` - Start production server
258
- - \`npm run type-check\` - Run TypeScript type checking
259
- - \`npm run lint\` - Run ESLint
260
- - \`npm run db:studio\` - Open Prisma Studio
261
-
262
- Happy coding! 🎉`
263
- };
264
-
265
- // Write config files
266
- for (const [fileName, content] of Object.entries(configFiles)) {
267
- fs.writeFileSync(path.join(dest, fileName), content);
268
- }
269
-
270
- // Copy template files from root
271
- const templateFiles = ['.env.example', 'vercel.json', 'tsconfig.json', 'eslint.config.js'];
272
-
273
- for (const templateFile of templateFiles) {
274
- const srcPath = path.join(ROOT_DIR, templateFile);
275
- const destPath = path.join(dest, templateFile);
276
-
277
- if (fs.existsSync(srcPath)) {
278
- fs.copyFileSync(srcPath, destPath);
279
- }
280
- }
281
-
282
- }
283
-
284
- function showHelp() {
285
- console.log();
286
- console.log('🏛️ Arktos - Modern Node.js Backend Boilerplate');
287
- console.log();
288
- console.log('Usage:');
289
- console.log(' npx create-arktos <project-name>');
290
- console.log();
291
- console.log('Example:');
292
- console.log(' npx create-arktos my-awesome-api');
293
- console.log();
294
- console.log('Features:');
295
- console.log(' ✅ Express.js server with modern middleware');
296
- console.log(' ✅ JWT authentication with refresh tokens');
297
- console.log(' ✅ Prisma ORM with PostgreSQL (Neon)');
298
- console.log(' ✅ Email service with Resend');
299
- console.log(' ✅ User authentication and management');
300
- console.log(' ✅ Login logging and security features');
301
- console.log(' ✅ Rate limiting and security headers');
302
- console.log(' ✅ Comprehensive error handling');
303
- console.log(' ✅ Winston logging');
304
- console.log(' ✅ ESLint and Prettier configuration');
305
- console.log(' ✅ Vercel deployment ready');
306
- console.log();
307
- console.log('Options:');
308
- console.log(' -h, --help Show this help message');
309
- console.log(' -v, --version Show version');
310
- console.log();
311
- }
312
-
313
- function showVersion() {
314
- const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'));
315
- console.log(packageJson.version);
316
- }
317
-
318
- // Main CLI logic
319
- const args = process.argv.slice(2);
320
-
321
- if (args.length === 0 || args[0] === '-h' || args[0] === '--help') {
322
- showHelp();
323
- process.exit(0);
324
- }
325
-
326
- if (args[0] === '-v' || args[0] === '--version') {
327
- showVersion();
328
- process.exit(0);
329
- }
330
-
331
- const projectName = args[0];
332
- createProject(projectName);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes