express-genix 1.1.4 → 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.
- package/LICENSE +21 -0
- package/README.md +204 -259
- package/index.js +229 -113
- package/lib/cleanup.js +41 -129
- package/lib/features.js +239 -0
- package/lib/generator.js +286 -204
- package/lib/utils.js +43 -91
- package/package.json +81 -63
- package/templates/cicd/github-actions.yml.ejs +70 -0
- package/templates/config/database.mongo.js.ejs +29 -33
- package/templates/config/database.postgres.js.ejs +41 -40
- package/templates/config/database.prisma.js.ejs +26 -0
- package/templates/config/redis.js.ejs +28 -0
- package/templates/config/schema.prisma.ejs +20 -0
- package/templates/config/swagger.js.ejs +30 -0
- package/templates/config/websocket.js.ejs +62 -0
- package/templates/controllers/authController.js.ejs +152 -129
- package/templates/controllers/exampleController.js.ejs +92 -152
- package/templates/controllers/userController.js.ejs +52 -60
- package/templates/core/Dockerfile.ejs +41 -31
- package/templates/core/README.md.ejs +191 -179
- package/templates/core/app.js.ejs +114 -64
- package/templates/core/docker-compose.yml.ejs +59 -47
- package/templates/core/dockerignore.ejs +7 -0
- package/templates/core/env.ejs +25 -19
- package/templates/core/env.example.ejs +26 -0
- package/templates/core/eslintrc.json.ejs +50 -20
- package/templates/core/gitignore.ejs +51 -51
- package/templates/core/healthcheck.js.ejs +24 -24
- package/templates/core/jest.config.js.ejs +19 -22
- package/templates/core/package.json.ejs +70 -33
- package/templates/core/prettierrc.json.ejs +11 -11
- package/templates/core/server.js.ejs +64 -48
- package/templates/core/tsconfig.json.ejs +19 -0
- package/templates/middleware/auth.js.ejs +80 -66
- package/templates/middleware/cache.js.ejs +67 -0
- package/templates/middleware/errorHandler.js.ejs +50 -46
- package/templates/middleware/requestId.js.ejs +9 -0
- package/templates/middleware/validation.js.ejs +109 -47
- package/templates/migrations/create-users.js.ejs +50 -0
- package/templates/migrations/seed-users.js.ejs +34 -0
- package/templates/migrations/sequelizerc.ejs +8 -0
- package/templates/models/User.mongo.js.ejs +29 -29
- package/templates/models/User.postgres.js.ejs +40 -40
- package/templates/models/index.mongo.js.ejs +7 -7
- package/templates/models/index.postgres.js.ejs +11 -11
- package/templates/routes/authRoutes.js.ejs +222 -13
- package/templates/routes/exampleRoutes.js.ejs +100 -12
- package/templates/routes/index.js.ejs +34 -24
- package/templates/routes/userRoutes.js.ejs +78 -15
- package/templates/services/authService.js.ejs +111 -35
- package/templates/services/exampleService.js.ejs +112 -112
- package/templates/services/userService.mongodb.js.ejs +33 -33
- package/templates/services/userService.postgres.js.ejs +30 -30
- package/templates/services/userService.prisma.js.ejs +36 -0
- package/templates/tests/auth.test.js.ejs +83 -66
- package/templates/tests/example.test.js.ejs +109 -112
- package/templates/tests/setup.js.ejs +11 -11
- package/templates/tests/users.test.js.ejs +42 -42
- package/templates/utils/envValidator.js.ejs +23 -0
- package/templates/utils/errors.js.ejs +12 -12
- package/templates/utils/logger.js.ejs +37 -28
- package/templates/utils/response.js.ejs +28 -0
- package/templates/utils/validators.js.ejs +34 -34
- package/templates/config/swagger.json.ejs +0 -194
- package/templates/core/index.js.ejs +0 -24
|
@@ -1,48 +1,60 @@
|
|
|
1
|
-
# templates/core/docker-compose.yml.ejs
|
|
2
|
-
version: '3.8'
|
|
3
|
-
|
|
4
|
-
services:
|
|
5
|
-
app:
|
|
6
|
-
build: .
|
|
7
|
-
ports:
|
|
8
|
-
- "3000:3000"
|
|
9
|
-
environment:
|
|
10
|
-
- NODE_ENV=production
|
|
11
|
-
env_file:
|
|
12
|
-
- .env<% if (hasDatabase) { %>
|
|
13
|
-
depends_on:
|
|
14
|
-
- <%= db === 'mongodb' ? 'mongodb' : 'postgres' %><% } %>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
# templates/core/docker-compose.yml.ejs
|
|
2
|
+
version: '3.8'
|
|
3
|
+
|
|
4
|
+
services:
|
|
5
|
+
app:
|
|
6
|
+
build: .
|
|
7
|
+
ports:
|
|
8
|
+
- "3000:3000"
|
|
9
|
+
environment:
|
|
10
|
+
- NODE_ENV=production
|
|
11
|
+
env_file:
|
|
12
|
+
- .env<% if (hasDatabase) { %>
|
|
13
|
+
depends_on:
|
|
14
|
+
- <%= db === 'mongodb' ? 'mongodb' : 'postgres' %><% } %><% if (hasRedis) { %>
|
|
15
|
+
- redis<% } %>
|
|
16
|
+
restart: unless-stopped
|
|
17
|
+
networks:
|
|
18
|
+
- app-network
|
|
19
|
+
|
|
20
|
+
<% if (db === 'mongodb') { %> mongodb:
|
|
21
|
+
image: mongo:7-jammy
|
|
22
|
+
ports:
|
|
23
|
+
- "27017:27017"
|
|
24
|
+
environment:
|
|
25
|
+
- MONGO_INITDB_DATABASE=<%= projectName %>
|
|
26
|
+
volumes:
|
|
27
|
+
- mongodb_data:/data/db
|
|
28
|
+
restart: unless-stopped
|
|
29
|
+
networks:
|
|
30
|
+
- app-network<% } else if (db === 'postgresql') { %> postgres:
|
|
31
|
+
image: postgres:15-alpine
|
|
32
|
+
ports:
|
|
33
|
+
- "5432:5432"
|
|
34
|
+
environment:
|
|
35
|
+
- POSTGRES_DB=<%= projectName %>
|
|
36
|
+
- POSTGRES_USER=postgres
|
|
37
|
+
- POSTGRES_PASSWORD=postgres
|
|
38
|
+
volumes:
|
|
39
|
+
- postgres_data:/var/lib/postgresql/data
|
|
40
|
+
restart: unless-stopped
|
|
41
|
+
networks:
|
|
42
|
+
- app-network<% } %>
|
|
43
|
+
|
|
44
|
+
<% if (hasRedis) { %> redis:
|
|
45
|
+
image: redis:7-alpine
|
|
46
|
+
ports:
|
|
47
|
+
- "6379:6379"
|
|
48
|
+
volumes:
|
|
49
|
+
- redis_data:/data
|
|
50
|
+
restart: unless-stopped
|
|
51
|
+
networks:
|
|
52
|
+
- app-network
|
|
53
|
+
<% } %>
|
|
54
|
+
<% if (hasDatabase || hasRedis) { %>volumes:<% } %>
|
|
55
|
+
<% if (hasDatabase) { %> <%= db === 'mongodb' ? 'mongodb_data:' : 'postgres_data:' %><% } %>
|
|
56
|
+
<% if (hasRedis) { %> redis_data:<% } %>
|
|
57
|
+
|
|
58
|
+
networks:
|
|
59
|
+
app-network:
|
|
48
60
|
driver: bridge
|
package/templates/core/env.ejs
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
# Server Configuration
|
|
2
|
-
NODE_ENV=development
|
|
3
|
-
PORT=3000
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
# Server Configuration
|
|
2
|
+
NODE_ENV=development
|
|
3
|
+
PORT=3000
|
|
4
|
+
CORS_ORIGIN=*
|
|
5
|
+
<% if (hasAuth) { %>
|
|
6
|
+
# JWT Configuration — These secrets were auto-generated. NEVER commit to version control.
|
|
7
|
+
JWT_SECRET=<%= jwtSecret %>
|
|
8
|
+
JWT_REFRESH_SECRET=<%= jwtRefreshSecret %>
|
|
9
|
+
JWT_EXPIRE=15m
|
|
10
|
+
JWT_REFRESH_EXPIRE=7d
|
|
11
|
+
<% } %><% if (hasRedis) { %>
|
|
12
|
+
# Redis (token blacklist store)
|
|
13
|
+
REDIS_URL=redis://localhost:6379
|
|
14
|
+
<% } %><% if (db === 'mongodb') { %>
|
|
15
|
+
# Database
|
|
16
|
+
MONGO_URI=mongodb://localhost:27017/<%= projectName %>
|
|
17
|
+
<% } %><% if (db === 'postgresql' || isPrisma) { %>
|
|
18
|
+
# Database
|
|
19
|
+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/<%= projectName %>
|
|
20
|
+
<% } %>
|
|
21
|
+
# Rate Limiting
|
|
22
|
+
RATE_LIMIT_WINDOW_MS=900000
|
|
23
|
+
RATE_LIMIT_MAX=100
|
|
24
|
+
|
|
25
|
+
# Logging
|
|
20
26
|
LOG_LEVEL=info
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Server Configuration
|
|
2
|
+
NODE_ENV=development
|
|
3
|
+
PORT=3000
|
|
4
|
+
CORS_ORIGIN=*
|
|
5
|
+
<% if (hasAuth) { %>
|
|
6
|
+
# JWT Configuration — Generate strong secrets for production!
|
|
7
|
+
JWT_SECRET=CHANGE_ME_generate_a_64_char_hex_secret
|
|
8
|
+
JWT_REFRESH_SECRET=CHANGE_ME_generate_a_64_char_hex_secret
|
|
9
|
+
JWT_EXPIRE=15m
|
|
10
|
+
JWT_REFRESH_EXPIRE=7d
|
|
11
|
+
<% } %><% if (hasRedis) { %>
|
|
12
|
+
# Redis (token blacklist store)
|
|
13
|
+
REDIS_URL=redis://localhost:6379
|
|
14
|
+
<% } %><% if (db === 'mongodb') { %>
|
|
15
|
+
# Database
|
|
16
|
+
MONGO_URI=mongodb://localhost:27017/<%= projectName %>
|
|
17
|
+
<% } %><% if (db === 'postgresql' || isPrisma) { %>
|
|
18
|
+
# Database
|
|
19
|
+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/<%= projectName %>
|
|
20
|
+
<% } %>
|
|
21
|
+
# Rate Limiting
|
|
22
|
+
RATE_LIMIT_WINDOW_MS=900000
|
|
23
|
+
RATE_LIMIT_MAX=100
|
|
24
|
+
|
|
25
|
+
# Logging
|
|
26
|
+
LOG_LEVEL=info
|
|
@@ -1,20 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
<% if (isTypescript) { %>{
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"],
|
|
4
|
+
"plugins": ["@typescript-eslint"],
|
|
5
|
+
"env": {
|
|
6
|
+
"node": true,
|
|
7
|
+
"jest": true
|
|
8
|
+
},
|
|
9
|
+
"settings": {
|
|
10
|
+
"import/resolver": {
|
|
11
|
+
"node": {
|
|
12
|
+
"extensions": [".js", ".ts"]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"rules": {
|
|
17
|
+
"no-console": "off",
|
|
18
|
+
"consistent-return": "off",
|
|
19
|
+
"func-names": "off",
|
|
20
|
+
"object-shorthand": "off",
|
|
21
|
+
"no-process-exit": "off",
|
|
22
|
+
"no-param-reassign": "off",
|
|
23
|
+
"no-return-await": "off",
|
|
24
|
+
"no-underscore-dangle": "off",
|
|
25
|
+
"class-methods-use-this": "off",
|
|
26
|
+
"import/extensions": ["error", "ignorePackages", { "ts": "never", "js": "never" }],
|
|
27
|
+
"prefer-destructuring": ["error", { "object": true, "array": false }],
|
|
28
|
+
"no-unused-vars": "off",
|
|
29
|
+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "req|res|next|val" }]
|
|
30
|
+
}
|
|
31
|
+
}<% } else { %>{
|
|
32
|
+
"extends": ["airbnb-base"],
|
|
33
|
+
"env": {
|
|
34
|
+
"node": true,
|
|
35
|
+
"jest": true
|
|
36
|
+
},
|
|
37
|
+
"rules": {
|
|
38
|
+
"no-console": "off",
|
|
39
|
+
"consistent-return": "off",
|
|
40
|
+
"func-names": "off",
|
|
41
|
+
"object-shorthand": "off",
|
|
42
|
+
"no-process-exit": "off",
|
|
43
|
+
"no-param-reassign": "off",
|
|
44
|
+
"no-return-await": "off",
|
|
45
|
+
"no-underscore-dangle": "off",
|
|
46
|
+
"class-methods-use-this": "off",
|
|
47
|
+
"prefer-destructuring": ["error", { "object": true, "array": false }],
|
|
48
|
+
"no-unused-vars": ["error", { "argsIgnorePattern": "req|res|next|val" }]
|
|
49
|
+
}
|
|
50
|
+
}<% } %>
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
// templates/core/gitignore.ejs
|
|
2
|
-
# Dependencies
|
|
3
|
-
node_modules/
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
|
|
8
|
-
# Environment variables
|
|
9
|
-
.env
|
|
10
|
-
.env.local
|
|
11
|
-
.env.development.local
|
|
12
|
-
.env.test.local
|
|
13
|
-
.env.production.local
|
|
14
|
-
|
|
15
|
-
# Build outputs
|
|
16
|
-
dist/
|
|
17
|
-
build/
|
|
18
|
-
|
|
19
|
-
# Logs
|
|
20
|
-
logs/
|
|
21
|
-
*.log
|
|
22
|
-
|
|
23
|
-
# Runtime data
|
|
24
|
-
pids/
|
|
25
|
-
*.pid
|
|
26
|
-
*.seed
|
|
27
|
-
*.pid.lock
|
|
28
|
-
|
|
29
|
-
# Coverage directory used by tools like istanbul
|
|
30
|
-
coverage/
|
|
31
|
-
*.lcov
|
|
32
|
-
|
|
33
|
-
# OS generated files
|
|
34
|
-
.DS_Store
|
|
35
|
-
.DS_Store?
|
|
36
|
-
._*
|
|
37
|
-
.Spotlight-V100
|
|
38
|
-
.Trashes
|
|
39
|
-
ehthumbs.db
|
|
40
|
-
Thumbs.db
|
|
41
|
-
|
|
42
|
-
# IDE files
|
|
43
|
-
.vscode/
|
|
44
|
-
.idea/
|
|
45
|
-
*.swp
|
|
46
|
-
*.swo
|
|
47
|
-
*~
|
|
48
|
-
|
|
49
|
-
# Temporary files
|
|
50
|
-
tmp/
|
|
51
|
-
temp/
|
|
1
|
+
// templates/core/gitignore.ejs
|
|
2
|
+
# Dependencies
|
|
3
|
+
node_modules/
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
|
|
8
|
+
# Environment variables
|
|
9
|
+
.env
|
|
10
|
+
.env.local
|
|
11
|
+
.env.development.local
|
|
12
|
+
.env.test.local
|
|
13
|
+
.env.production.local
|
|
14
|
+
|
|
15
|
+
# Build outputs
|
|
16
|
+
dist/
|
|
17
|
+
build/
|
|
18
|
+
|
|
19
|
+
# Logs
|
|
20
|
+
logs/
|
|
21
|
+
*.log
|
|
22
|
+
|
|
23
|
+
# Runtime data
|
|
24
|
+
pids/
|
|
25
|
+
*.pid
|
|
26
|
+
*.seed
|
|
27
|
+
*.pid.lock
|
|
28
|
+
|
|
29
|
+
# Coverage directory used by tools like istanbul
|
|
30
|
+
coverage/
|
|
31
|
+
*.lcov
|
|
32
|
+
|
|
33
|
+
# OS generated files
|
|
34
|
+
.DS_Store
|
|
35
|
+
.DS_Store?
|
|
36
|
+
._*
|
|
37
|
+
.Spotlight-V100
|
|
38
|
+
.Trashes
|
|
39
|
+
ehthumbs.db
|
|
40
|
+
Thumbs.db
|
|
41
|
+
|
|
42
|
+
# IDE files
|
|
43
|
+
.vscode/
|
|
44
|
+
.idea/
|
|
45
|
+
*.swp
|
|
46
|
+
*.swo
|
|
47
|
+
*~
|
|
48
|
+
|
|
49
|
+
# Temporary files
|
|
50
|
+
tmp/
|
|
51
|
+
temp/
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
// templates/core/healthcheck.js.ejs
|
|
2
|
-
const http = require('http');
|
|
3
|
-
|
|
4
|
-
const options = {
|
|
5
|
-
host: 'localhost',
|
|
6
|
-
port: process.env.PORT || 3000,
|
|
7
|
-
path: '/health',
|
|
8
|
-
timeout: 2000,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const request = http.request(options, (res) => {
|
|
12
|
-
console.log(`STATUS: ${res.statusCode}`);
|
|
13
|
-
if (res.statusCode === 200) {
|
|
14
|
-
process.exit(0);
|
|
15
|
-
} else {
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
request.on('error', (err) => {
|
|
21
|
-
console.log('ERROR:', err);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
});
|
|
24
|
-
|
|
1
|
+
// templates/core/healthcheck.js.ejs
|
|
2
|
+
const http = require('http');
|
|
3
|
+
|
|
4
|
+
const options = {
|
|
5
|
+
host: 'localhost',
|
|
6
|
+
port: process.env.PORT || 3000,
|
|
7
|
+
path: '/health',
|
|
8
|
+
timeout: 2000,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const request = http.request(options, (res) => {
|
|
12
|
+
console.log(`STATUS: ${res.statusCode}`);
|
|
13
|
+
if (res.statusCode === 200) {
|
|
14
|
+
process.exit(0);
|
|
15
|
+
} else {
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
request.on('error', (err) => {
|
|
21
|
+
console.log('ERROR:', err);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
25
|
request.end();
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'src
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
],
|
|
21
|
-
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
|
|
22
|
-
testTimeout: 10000,
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'node',
|
|
3
|
+
roots: ['<rootDir>/src', '<rootDir>/tests'],
|
|
4
|
+
testMatch: [
|
|
5
|
+
'**/__tests__/**/*.<%= isTypescript ? '{js,ts}' : 'js' %>',
|
|
6
|
+
'**/?(*.)+(spec|test).<%= isTypescript ? '{js,ts}' : 'js' %>',
|
|
7
|
+
],
|
|
8
|
+
collectCoverageFrom: [
|
|
9
|
+
'src/**/*.<%= isTypescript ? '{js,ts}' : 'js' %>',
|
|
10
|
+
'!src/server.<%= isTypescript ? 'ts' : 'js' %>',
|
|
11
|
+
'!src/config/**',
|
|
12
|
+
],<% if (isTypescript) { %>
|
|
13
|
+
transform: {
|
|
14
|
+
'^.+\\.ts$': 'ts-jest',
|
|
15
|
+
},<% } %>
|
|
16
|
+
coverageDirectory: 'coverage',
|
|
17
|
+
coverageReporters: ['text', 'lcov', 'html'],
|
|
18
|
+
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
|
|
19
|
+
testTimeout: 10000,
|
|
23
20
|
};
|
|
@@ -1,33 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= projectName %>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "<% if (isTypescript) { %>dist/server.js<% } else { %>src/server.js<% } %>",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "<% if (isTypescript) { %>node dist/server.js<% } else { %>node src/server.js<% } %>",
|
|
7
|
+
"dev": "<% if (isTypescript) { %>tsx watch src/server.ts<% } else { %>nodemon src/server.js<% } %>",
|
|
8
|
+
"test": "jest --coverage",
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"lint:fix": "eslint . --fix",
|
|
11
|
+
"format": "prettier --write .",
|
|
12
|
+
"format:check": "prettier --check ."<% if (isTypescript) { %>,
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"start:prod": "npm run build && node dist/server.js"<% } %><% if (isPrisma) { %>,
|
|
15
|
+
"prisma:generate": "prisma generate",
|
|
16
|
+
"prisma:migrate": "prisma migrate dev",
|
|
17
|
+
"prisma:studio": "prisma studio"<% } %><% if (db === 'postgresql') { %>,
|
|
18
|
+
"db:migrate": "npx sequelize-cli db:migrate",
|
|
19
|
+
"db:migrate:undo": "npx sequelize-cli db:migrate:undo",
|
|
20
|
+
"db:seed": "npx sequelize-cli db:seed:all",
|
|
21
|
+
"db:create": "npx sequelize-cli db:create"<% } %>
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"express": "^4.21.0",
|
|
25
|
+
"dotenv": "^16.4.5",
|
|
26
|
+
"cors": "^2.8.5",
|
|
27
|
+
"helmet": "^8.0.0",
|
|
28
|
+
"morgan": "^1.10.0"<% if (hasRateLimit) { %>,
|
|
29
|
+
"express-rate-limit": "^7.4.1"<% } %><% if (hasSwagger) { %>,
|
|
30
|
+
"swagger-jsdoc": "^6.2.8",
|
|
31
|
+
"swagger-ui-express": "^5.0.1"<% } %><% if (hasAuth) { %>,
|
|
32
|
+
"jsonwebtoken": "^9.0.2",
|
|
33
|
+
"bcryptjs": "^2.4.3",
|
|
34
|
+
"validator": "^13.12.0",
|
|
35
|
+
"zod": "^3.23.0"<% } %><% if (db === 'mongodb') { %>,
|
|
36
|
+
"mongoose": "^8.8.0"<% } %><% if (db === 'postgresql') { %>,
|
|
37
|
+
"pg": "^8.13.0",
|
|
38
|
+
"sequelize": "^6.37.0"<% } %><% if (isPrisma) { %>,
|
|
39
|
+
"@prisma/client": "^5.22.0"<% } %><% if (hasWebsocket) { %>,
|
|
40
|
+
"socket.io": "^4.8.0"<% } %><% if (hasRedis) { %>,
|
|
41
|
+
"ioredis": "^5.4.0"<% } %><% if (hasRequestId) { %>,
|
|
42
|
+
"uuid": "^10.0.0"<% } %><% if (logger === 'winston') { %>,
|
|
43
|
+
"winston": "^3.15.0"<% } %><% if (logger === 'pino') { %>,
|
|
44
|
+
"pino": "^9.5.0",
|
|
45
|
+
"pino-pretty": "^13.0.0"<% } %>
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {<% if (!isTypescript) { %>
|
|
48
|
+
"nodemon": "^3.1.7",<% } %><% if (isTypescript) { %>
|
|
49
|
+
"tsx": "^4.19.0",
|
|
50
|
+
"typescript": "^5.6.0",
|
|
51
|
+
"@types/node": "^22.0.0",
|
|
52
|
+
"@types/express": "^5.0.0",
|
|
53
|
+
"@types/cors": "^2.8.17",
|
|
54
|
+
"@types/morgan": "^1.9.9"<% if (hasAuth) { %>,
|
|
55
|
+
"@types/jsonwebtoken": "^9.0.7",
|
|
56
|
+
"@types/bcryptjs": "^2.4.6",
|
|
57
|
+
"@types/validator": "^13.12.0"<% } %><% if (hasSwagger) { %>,
|
|
58
|
+
"@types/swagger-jsdoc": "^6.0.4",
|
|
59
|
+
"@types/swagger-ui-express": "^4.1.6"<% } %><% if (hasRequestId) { %>,
|
|
60
|
+
"@types/uuid": "^10.0.0"<% } %>,<% } %>
|
|
61
|
+
"jest": "^29.7.0",
|
|
62
|
+
"supertest": "^7.0.0",
|
|
63
|
+
"eslint": "^8.57.0",
|
|
64
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
65
|
+
"eslint-plugin-import": "^2.31.0",
|
|
66
|
+
"prettier": "^3.4.0"<% if (isPrisma) { %>,
|
|
67
|
+
"prisma": "^5.22.0"<% } %><% if (db === 'postgresql') { %>,
|
|
68
|
+
"sequelize-cli": "^6.6.2"<% } %>
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"semi": true,
|
|
3
|
-
"trailingComma": "es5",
|
|
4
|
-
"singleQuote": true,
|
|
5
|
-
"printWidth": 80,
|
|
6
|
-
"tabWidth": 2,
|
|
7
|
-
"useTabs": false,
|
|
8
|
-
"bracketSpacing": true,
|
|
9
|
-
"bracketSameLine": false,
|
|
10
|
-
"arrowParens": "always",
|
|
11
|
-
"endOfLine": "lf"
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"trailingComma": "es5",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 80,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"bracketSpacing": true,
|
|
9
|
+
"bracketSameLine": false,
|
|
10
|
+
"arrowParens": "always",
|
|
11
|
+
"endOfLine": "lf"
|
|
12
12
|
}
|