create-nexwire 4.2.4 → 4.3.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/README.md +20 -8
- package/express/.env +1 -1
- package/express/.vscode/extensions.json +6 -0
- package/express/.vscode/settings.json +37 -26
- package/express/biome.json +99 -66
- package/express/package.json +31 -29
- package/express/src/config/database.ts +48 -29
- package/express/src/config/index.ts +83 -83
- package/express/src/config/openapi.ts +6 -24
- package/express/src/config/queue.ts +30 -30
- package/express/src/config/validate.ts +50 -40
- package/express/src/database/migrations/sqlite/0000_init.sql +47 -47
- package/express/src/database/migrations/sqlite/meta/0000_snapshot.json +1 -1
- package/express/src/database/migrations/sqlite/meta/_journal.json +1 -1
- package/express/src/database/schema.ts +2 -2
- package/express/src/framework/cache/cache.ts +40 -8
- package/express/src/framework/circuit-breaker/cb.ts +88 -60
- package/express/src/framework/database/connection.ts +52 -27
- package/express/src/framework/events/dispatcher.ts +61 -49
- package/express/src/framework/facade.ts +46 -3
- package/express/src/framework/http/app.ts +28 -22
- package/express/src/framework/http/logger.ts +27 -16
- package/express/src/framework/http/openapi.ts +9 -11
- package/express/src/framework/modules/routes.ts +26 -21
- package/express/src/framework/notification/channels/broadcast.ts +15 -0
- package/express/src/framework/notification/channels/mail.ts +40 -0
- package/express/src/framework/notification/contracts.ts +29 -0
- package/express/src/framework/notification/index.ts +19 -94
- package/express/src/framework/notification/registry.ts +15 -0
- package/express/src/framework/providers/adapter.ts +27 -17
- package/express/src/framework/queue/queue.ts +43 -44
- package/express/src/framework/realtime/broadcast.ts +29 -5
- package/express/src/framework/realtime/socket.ts +149 -119
- package/express/src/framework/redis/client.ts +148 -151
- package/express/src/framework/runtime/server-adapter.ts +39 -34
- package/express/src/framework/scheduler/lock.ts +128 -116
- package/express/src/framework/server.ts +33 -49
- package/express/src/framework/session/session.ts +69 -14
- package/express/src/framework/storage/storage.ts +744 -785
- package/express/src/framework/support/mail.ts +15 -7
- package/express/src/providers/notification.ts +4 -0
- package/express/src/resources/src/components/Checkbox.vue +32 -29
- package/express/src/resources/src/components/Input.vue +243 -223
- package/express/src/resources/src/components/InputGroup.vue +147 -145
- package/express/src/resources/src/components/InputPasswordToggle.vue +229 -213
- package/express/src/resources/src/components/Modal.vue +71 -55
- package/express/src/resources/src/components/Refresh.vue +19 -0
- package/express/src/resources/src/helpers/assets.ts +51 -0
- package/express/src/resources/src/layouts/Layout/Header.vue +124 -105
- package/express/src/resources/src/main.ts +3 -1
- package/express/src/resources/src/plugins/gum.ts +1 -1
- package/express/src/resources/src/plugins/pulse.ts +157 -147
- package/express/src/resources/src/stores/auth.ts +184 -164
- package/express/src/resources/vite.config.ts +54 -36
- package/express/src/storage/database/nexwire.sqlite +0 -0
- package/express/src/storage/logs/app.log +0 -0
- package/express/src/storage/logs/fatal.log +0 -0
- package/express/src/types/global.d.ts +32 -26
- package/hono/.env +1 -1
- package/hono/.vscode/extensions.json +6 -0
- package/hono/.vscode/settings.json +37 -26
- package/hono/biome.json +25 -2
- package/hono/package.json +25 -23
- package/hono/src/config/database.ts +48 -29
- package/hono/src/config/index.ts +83 -83
- package/hono/src/config/openapi.ts +6 -24
- package/hono/src/config/queue.ts +30 -30
- package/hono/src/config/validate.ts +50 -40
- package/hono/src/database/migrations/sqlite/0000_init.sql +47 -47
- package/hono/src/database/migrations/sqlite/meta/0000_snapshot.json +1 -1
- package/hono/src/database/migrations/sqlite/meta/_journal.json +1 -1
- package/hono/src/database/schema.ts +2 -2
- package/hono/src/framework/cache/cache.ts +40 -8
- package/hono/src/framework/circuit-breaker/cb.ts +88 -60
- package/hono/src/framework/database/connection.ts +52 -27
- package/hono/src/framework/events/dispatcher.ts +61 -49
- package/hono/src/framework/facade.ts +38 -1
- package/hono/src/framework/http/openapi.ts +7 -9
- package/hono/src/framework/notification/channels/broadcast.ts +15 -0
- package/hono/src/framework/notification/channels/mail.ts +40 -0
- package/hono/src/framework/notification/contracts.ts +29 -0
- package/hono/src/framework/notification/index.ts +19 -94
- package/hono/src/framework/notification/registry.ts +15 -0
- package/hono/src/framework/providers/adapter.ts +27 -17
- package/hono/src/framework/queue/queue.ts +43 -44
- package/hono/src/framework/realtime/broadcast.ts +29 -5
- package/hono/src/framework/realtime/socket.ts +217 -196
- package/hono/src/framework/redis/client.ts +148 -151
- package/hono/src/framework/scheduler/lock.ts +128 -116
- package/hono/src/framework/server.ts +27 -29
- package/hono/src/framework/session/session.ts +62 -14
- package/hono/src/framework/storage/storage.ts +744 -785
- package/hono/src/framework/support/mail.ts +56 -48
- package/hono/src/providers/notification.ts +4 -0
- package/hono/src/resources/src/components/Checkbox.vue +32 -29
- package/hono/src/resources/src/components/Input.vue +243 -234
- package/hono/src/resources/src/components/InputGroup.vue +147 -149
- package/hono/src/resources/src/components/InputPasswordToggle.vue +229 -222
- package/hono/src/resources/src/components/Modal.vue +71 -55
- package/hono/src/resources/src/components/Refresh.vue +19 -0
- package/hono/src/resources/src/helpers/assets.ts +51 -0
- package/hono/src/resources/src/layouts/Layout/Header.vue +124 -105
- package/hono/src/resources/src/main.ts +3 -1
- package/hono/src/resources/src/plugins/gum.ts +1 -1
- package/hono/src/resources/src/plugins/pulse.ts +157 -147
- package/hono/src/resources/src/stores/auth.ts +184 -164
- package/hono/src/resources/vite.config.ts +54 -36
- package/hono/src/storage/database/nexwire.sqlite +0 -0
- package/hono/src/storage/logs/app.log +0 -0
- package/hono/src/storage/logs/fatal.log +0 -0
- package/hono/src/types/global.d.ts +32 -26
- package/package.json +2 -2
- package/src/index.js +139 -14
package/README.md
CHANGED
|
@@ -27,22 +27,34 @@ nexwire ships that stack **already connected**. Auth reads the database. Enqueue
|
|
|
27
27
|
|
|
28
28
|
## Quick Start
|
|
29
29
|
|
|
30
|
-
###
|
|
30
|
+
### Choose a backend
|
|
31
|
+
|
|
32
|
+
The CLI asks which backend to scaffold when you don't pass `--engine`:
|
|
31
33
|
|
|
32
34
|
```bash
|
|
33
35
|
npm create nexwire@latest my-app
|
|
34
|
-
cd my-app
|
|
35
|
-
npm install
|
|
36
|
-
npm run maker dev
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
```
|
|
39
|
+
Choose a backend:
|
|
40
|
+
❯ Hono Hono-based HTTP layer and OpenAPI
|
|
41
|
+
Express Express-based HTTP layer and OpenAPI
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Arrow keys to move, `1`/`2` to jump, Enter to confirm. Press Enter to accept the default (**Hono**). Point at a specific one and the prompt is skipped:
|
|
40
45
|
|
|
41
46
|
```bash
|
|
47
|
+
# Hono (default)
|
|
48
|
+
npm create nexwire@latest my-app
|
|
49
|
+
|
|
50
|
+
# Express
|
|
42
51
|
npm create nexwire@latest my-app -- --engine=express
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For CI or scripts, `-y` / `--yes` skips every prompt and accepts the defaults (a project name is still required):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm create nexwire@latest my-app -- --yes
|
|
46
58
|
```
|
|
47
59
|
|
|
48
60
|
Your API is live at `http://localhost:3000`, Scalar docs at `/api-docs`, and the Vue frontend at `http://localhost:5173`.
|
package/express/.env
CHANGED
|
@@ -37,7 +37,7 @@ UI=true
|
|
|
37
37
|
# Set true to enable OpenAPI / Scalar docs at /api-docs
|
|
38
38
|
OPEN_API=true
|
|
39
39
|
# Set false to disable Socket.IO realtime server
|
|
40
|
-
SOCKET=
|
|
40
|
+
SOCKET=false
|
|
41
41
|
# Set false to disable browser security headers (CSP, HSTS, X-Frame)
|
|
42
42
|
SECURITY_HEADERS=true
|
|
43
43
|
|
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.defaultFormatter": "biomejs.biome",
|
|
3
|
-
"[typescript]": {
|
|
4
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
5
|
-
},
|
|
6
|
-
"[typescriptreact]": {
|
|
7
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
8
|
-
},
|
|
9
|
-
"[javascript]": {
|
|
10
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
11
|
-
},
|
|
12
|
-
"[javascriptreact]": {
|
|
13
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
14
|
-
},
|
|
15
|
-
"[json]": {
|
|
16
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
17
|
-
},
|
|
18
|
-
"[jsonc]": {
|
|
19
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
20
|
-
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
3
|
+
"[typescript]": {
|
|
4
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
5
|
+
},
|
|
6
|
+
"[typescriptreact]": {
|
|
7
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
8
|
+
},
|
|
9
|
+
"[javascript]": {
|
|
10
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
11
|
+
},
|
|
12
|
+
"[javascriptreact]": {
|
|
13
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
14
|
+
},
|
|
15
|
+
"[json]": {
|
|
16
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
17
|
+
},
|
|
18
|
+
"[jsonc]": {
|
|
19
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
20
|
+
},
|
|
21
|
+
"[vue]": {
|
|
22
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
23
|
+
},
|
|
24
|
+
"[css]": {
|
|
25
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
26
|
+
},
|
|
27
|
+
"[scss]": {
|
|
28
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
29
|
+
},
|
|
30
|
+
"editor.codeActionsOnSave": {
|
|
31
|
+
"source.organizeImports.biome": "explicit",
|
|
32
|
+
"source.fixAll.biome": "explicit"
|
|
33
|
+
},
|
|
34
|
+
"files.eol": "\n",
|
|
35
|
+
"files.trimTrailingWhitespace": true,
|
|
36
|
+
"files.insertFinalNewline": true
|
|
37
|
+
}
|
package/express/biome.json
CHANGED
|
@@ -1,66 +1,99 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
|
-
"vcs": {
|
|
4
|
-
"enabled": true,
|
|
5
|
-
"clientKind": "git",
|
|
6
|
-
"useIgnoreFile": true
|
|
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
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"html": {
|
|
9
|
+
"experimentalFullSupportEnabled": true,
|
|
10
|
+
"formatter": {
|
|
11
|
+
"enabled": true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"formatter": {
|
|
15
|
+
"indentStyle": "space",
|
|
16
|
+
"indentWidth": 2,
|
|
17
|
+
"lineWidth": 140,
|
|
18
|
+
"bracketSameLine": false
|
|
19
|
+
},
|
|
20
|
+
"files": {
|
|
21
|
+
"includes": [
|
|
22
|
+
"**",
|
|
23
|
+
"!**/node_modules"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"linter": {
|
|
27
|
+
"rules": {
|
|
28
|
+
"preset": "recommended",
|
|
29
|
+
"a11y": {
|
|
30
|
+
"noLabelWithoutControl": "off",
|
|
31
|
+
"useButtonType": "off",
|
|
32
|
+
"useSemanticElements": "off",
|
|
33
|
+
"noStaticElementInteractions": "off",
|
|
34
|
+
"useKeyWithClickEvents": "off",
|
|
35
|
+
"useValidAnchor": "off",
|
|
36
|
+
"useAnchorContent": "off",
|
|
37
|
+
"noDistractingElements": "off"
|
|
38
|
+
},
|
|
39
|
+
"correctness": {
|
|
40
|
+
"noUnusedVariables": "off",
|
|
41
|
+
"useVueValidTemplateRoot": "off",
|
|
42
|
+
"noUnusedImports": "off"
|
|
43
|
+
},
|
|
44
|
+
"complexity": {
|
|
45
|
+
"noUselessEscapeInRegex": "off",
|
|
46
|
+
"noImportantStyles": "off"
|
|
47
|
+
},
|
|
48
|
+
"style": {
|
|
49
|
+
"noNonNullAssertion": "off",
|
|
50
|
+
"useVueMultiWordComponentNames": "off",
|
|
51
|
+
"useImportType": "off"
|
|
52
|
+
},
|
|
53
|
+
"suspicious": {
|
|
54
|
+
"noEmptyBlockStatements": "off",
|
|
55
|
+
"noExplicitAny": "off",
|
|
56
|
+
"noRedeclare": "off",
|
|
57
|
+
"noAssignInExpressions": "off",
|
|
58
|
+
"useIterableCallbackReturn": "off"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"javascript": {
|
|
63
|
+
"formatter": {
|
|
64
|
+
"quoteStyle": "double",
|
|
65
|
+
"semicolons": "always",
|
|
66
|
+
"trailingCommas": "none"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"overrides": [
|
|
70
|
+
{
|
|
71
|
+
"includes": [
|
|
72
|
+
"**/*.{js,mjs,cjs,ts,tsx,vue}"
|
|
73
|
+
],
|
|
74
|
+
"javascript": {
|
|
75
|
+
"globals": [
|
|
76
|
+
"exports",
|
|
77
|
+
"location"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"assist": {
|
|
83
|
+
"actions": {
|
|
84
|
+
"source": {
|
|
85
|
+
"organizeImports": {
|
|
86
|
+
"level": "on",
|
|
87
|
+
"options": {
|
|
88
|
+
"groups": [
|
|
89
|
+
":NODE:",
|
|
90
|
+
":PACKAGE:",
|
|
91
|
+
":ALIAS:",
|
|
92
|
+
":PATH:"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
package/express/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexwire-express",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
3
|
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
6
5
|
"bin": {
|
|
7
6
|
"maker": "./src/framework/maker-cli/index.mjs"
|
|
8
7
|
},
|
|
8
|
+
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "npm run build:all",
|
|
11
11
|
"build:all": "npm run build:backend && npm run build:ui",
|
|
12
12
|
"build:backend": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
|
|
13
|
-
"build:ui": "node src/framework/maker-cli/runtime/build-ui.mjs",
|
|
13
|
+
"build:ui": "npm run typecheck:ui && node src/framework/maker-cli/runtime/build-ui.mjs",
|
|
14
|
+
"typecheck:ui": "vue-tsc --noEmit -p src/resources/tsconfig.json",
|
|
14
15
|
"dev": "node src/framework/maker-cli/index.mjs dev",
|
|
15
16
|
"backend": "node src/framework/maker-cli/index.mjs serve --src",
|
|
16
17
|
"ui": "node src/framework/maker-cli/index.mjs ui:dev",
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
"@scalar/express-api-reference": "^0.10.19",
|
|
38
39
|
"@socket.io/admin-ui": "^0.5.1",
|
|
39
40
|
"@socket.io/redis-adapter": "^8.3.0",
|
|
40
|
-
"@unhead/vue": "^3.4.3",
|
|
41
41
|
"@types/multer": "^2.2.0",
|
|
42
|
+
"@unhead/vue": "^3.4.3",
|
|
42
43
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
43
44
|
"@vuepic/vue-datepicker": "^14.0.0",
|
|
44
45
|
"@vueuse/core": "^14.4.0",
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"jsonwebtoken": "^9.0.2",
|
|
65
66
|
"lodash-es": "^4.18.1",
|
|
66
67
|
"luxon": "^3.7.2",
|
|
67
|
-
"maildev": "^
|
|
68
|
+
"maildev": "^2.2.1",
|
|
68
69
|
"morgan": "^1.10.0",
|
|
69
70
|
"multer": "^2.5.0",
|
|
70
71
|
"mysql2": "^3.23.3",
|
|
@@ -82,6 +83,24 @@
|
|
|
82
83
|
"vue-select": "^4.0.0-beta.6",
|
|
83
84
|
"zod": "^4.6.7"
|
|
84
85
|
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@biomejs/biome": "^2.5.7",
|
|
88
|
+
"@types/bootstrap": "^5.2.11",
|
|
89
|
+
"@types/cookie-parser": "^1.4.7",
|
|
90
|
+
"@types/cors": "^2.8.17",
|
|
91
|
+
"@types/express": "^5.0.6",
|
|
92
|
+
"@types/jsonwebtoken": "^9.0.7",
|
|
93
|
+
"@types/lodash-es": "^4.17.12",
|
|
94
|
+
"@types/morgan": "^1.9.9",
|
|
95
|
+
"@types/node": "^25.9.9",
|
|
96
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
97
|
+
"drizzle-kit": "^0.31.11",
|
|
98
|
+
"tsc-alias": "^1.9.9",
|
|
99
|
+
"tsx": "^4.23.15",
|
|
100
|
+
"typescript": "^6.0.3",
|
|
101
|
+
"vitest": "^5.0.5",
|
|
102
|
+
"vue-tsc": "^3.3.13"
|
|
103
|
+
},
|
|
85
104
|
"overrides": {
|
|
86
105
|
"@esbuild-kit/core-utils": {
|
|
87
106
|
"esbuild": "^0.25.12"
|
|
@@ -100,34 +119,17 @@
|
|
|
100
119
|
"bcryptjs": "^3.0.3"
|
|
101
120
|
}
|
|
102
121
|
},
|
|
122
|
+
"engines": {
|
|
123
|
+
"bun": ">=1.3",
|
|
124
|
+
"node": ">=22.12.0",
|
|
125
|
+
"pnpm": ">=11",
|
|
126
|
+
"yarn": ">=4"
|
|
127
|
+
},
|
|
103
128
|
"allowScripts": {
|
|
104
129
|
"@parcel/watcher": true,
|
|
105
130
|
"esbuild": true,
|
|
106
131
|
"msgpackr-extract": true,
|
|
107
132
|
"redis-commander": true,
|
|
108
133
|
"vue-demi": true
|
|
109
|
-
},
|
|
110
|
-
"devDependencies": {
|
|
111
|
-
"@biomejs/biome": "^2.5.7",
|
|
112
|
-
"@types/bootstrap": "^5.2.11",
|
|
113
|
-
"@types/cookie-parser": "^1.4.7",
|
|
114
|
-
"@types/cors": "^2.8.17",
|
|
115
|
-
"@types/express": "^5.0.6",
|
|
116
|
-
"@types/jsonwebtoken": "^9.0.7",
|
|
117
|
-
"@types/lodash-es": "^4.17.12",
|
|
118
|
-
"@types/morgan": "^1.9.9",
|
|
119
|
-
"@types/node": "^25.9.9",
|
|
120
|
-
"@vitest/coverage-v8": "^5.0.5",
|
|
121
|
-
"drizzle-kit": "^0.31.11",
|
|
122
|
-
"tsc-alias": "^1.9.9",
|
|
123
|
-
"tsx": "^4.23.15",
|
|
124
|
-
"typescript": "^6.0.3",
|
|
125
|
-
"vitest": "^5.0.5"
|
|
126
|
-
},
|
|
127
|
-
"engines": {
|
|
128
|
-
"node": ">=22.12.0",
|
|
129
|
-
"bun": ">=1.3",
|
|
130
|
-
"pnpm": ">=11",
|
|
131
|
-
"yarn": ">=4"
|
|
132
134
|
}
|
|
133
|
-
}
|
|
135
|
+
}
|
|
@@ -1,29 +1,48 @@
|
|
|
1
|
-
import { env } from "@/env.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Why: Database connection settings
|
|
5
|
-
* When: Database bootstrap and dialect detection.
|
|
6
|
-
* Where: src/config/database.ts.
|
|
7
|
-
* How:
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { env } from "@/env.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Why: Database connection settings.
|
|
5
|
+
* When: Database bootstrap and dialect detection.
|
|
6
|
+
* Where: src/config/database.ts.
|
|
7
|
+
* How: Only DATABASE_URL is required. Pool settings use generic,
|
|
8
|
+
* provider-agnostic defaults.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const rawUrl = env.DATABASE_URL;
|
|
12
|
+
|
|
13
|
+
export const databaseConfig = {
|
|
14
|
+
// If it's sqlite, convert "sqlite:./db.sqlite" to "file:./db.sqlite"
|
|
15
|
+
url: rawUrl.startsWith("sqlite:") ? `file:${rawUrl.slice("sqlite:".length)}` : rawUrl,
|
|
16
|
+
|
|
17
|
+
/** Generic, sensible pool defaults for any provider */
|
|
18
|
+
pool: {
|
|
19
|
+
max: 10,
|
|
20
|
+
idleTimeout: 20000, // ms
|
|
21
|
+
connectTimeout: 10000, // ms
|
|
22
|
+
keepAlive: true
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Default to true. If a provider (like a pooler) doesn't support it,
|
|
27
|
+
* they usually indicate this in the connection string or require the user
|
|
28
|
+
* to handle it at the driver level.
|
|
29
|
+
*/
|
|
30
|
+
prepare: true,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Require TLS for MySQL and PostgreSQL connections. Set this to true, or
|
|
34
|
+
* append `?sslmode=require` to DATABASE_URL if your provider documents that.
|
|
35
|
+
*/
|
|
36
|
+
ssl: false
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type DatabaseConfig = typeof databaseConfig;
|
|
40
|
+
|
|
41
|
+
export function detectDialectFrom(url: string): "sqlite" | "mysql" | "postgresql" {
|
|
42
|
+
const value = url.toLowerCase();
|
|
43
|
+
if (value.startsWith("mysql")) return "mysql";
|
|
44
|
+
if (value.startsWith("postgres")) return "postgresql";
|
|
45
|
+
return "sqlite";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const databaseDialect = detectDialectFrom(rawUrl);
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { type AppConfig, appConfig } from "./app.js";
|
|
2
|
-
import { type AuthConfig, authConfig } from "./auth.js";
|
|
3
|
-
import { type CacheConfig, cacheConfig } from "./cache.js";
|
|
4
|
-
import { type CookieConfig, cookieConfig } from "./cookie.js";
|
|
5
|
-
import { type CorsConfig, corsConfig } from "./cors.js";
|
|
6
|
-
import { type DatabaseConfig, databaseConfig } from "./database.js";
|
|
7
|
-
import { type JwtConfig, jwtConfig } from "./jwt.js";
|
|
8
|
-
import { type LoggingConfig, loggingConfig } from "./logging.js";
|
|
9
|
-
import { type MailConfig, mailConfig } from "./mail.js";
|
|
10
|
-
import { type OpenApiConfig, openApiConfig } from "./openapi.js";
|
|
11
|
-
import { type QueueConfig, queueConfig } from "./queue.js";
|
|
12
|
-
import { type RateLimitConfig, rateLimitConfig } from "./rateLimit.js";
|
|
13
|
-
import { type RealtimeConfig, realtimeConfig } from "./realtime.js";
|
|
14
|
-
import { type RedisConfig, redisConfig } from "./redis.js";
|
|
15
|
-
import { type SecurityConfig, securityConfig } from "./security.js";
|
|
16
|
-
import { type SessionConfig, sessionConfig } from "./session.js";
|
|
17
|
-
import { type StorageConfig, storageConfig } from "./storage.js";
|
|
18
|
-
|
|
19
|
-
export { appConfig } from "./app.js";
|
|
20
|
-
export { authConfig } from "./auth.js";
|
|
21
|
-
export { cacheConfig } from "./cache.js";
|
|
22
|
-
export { cookieConfig } from "./cookie.js";
|
|
23
|
-
export { corsConfig } from "./cors.js";
|
|
24
|
-
export { databaseConfig } from "./database.js";
|
|
25
|
-
export { jwtConfig } from "./jwt.js";
|
|
26
|
-
export { loggingConfig } from "./logging.js";
|
|
27
|
-
export { mailConfig } from "./mail.js";
|
|
28
|
-
export { openApiConfig } from "./openapi.js";
|
|
29
|
-
export { queueConfig } from "./queue.js";
|
|
30
|
-
export { rateLimitConfig } from "./rateLimit.js";
|
|
31
|
-
export { realtimeConfig } from "./realtime.js";
|
|
32
|
-
export { redisConfig } from "./redis.js";
|
|
33
|
-
export { securityConfig } from "./security.js";
|
|
34
|
-
export { sessionConfig } from "./session.js";
|
|
35
|
-
export { storageConfig } from "./storage.js";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Why: Single import point for every config domain.
|
|
39
|
-
* When: Application code needs configuration values.
|
|
40
|
-
* Where: Imported as `import { config } from "@/config/index.js"`.
|
|
41
|
-
* How: Aggregates per-domain config objects; individual files remain the
|
|
42
|
-
* place to edit each setting.
|
|
43
|
-
*/
|
|
44
|
-
export const config = {
|
|
45
|
-
app: appConfig,
|
|
46
|
-
auth: authConfig,
|
|
47
|
-
cache: cacheConfig,
|
|
48
|
-
cookie: cookieConfig,
|
|
49
|
-
cors: corsConfig,
|
|
50
|
-
database: databaseConfig,
|
|
51
|
-
jwt: jwtConfig,
|
|
52
|
-
logging: loggingConfig,
|
|
53
|
-
mail: mailConfig,
|
|
54
|
-
openApi: openApiConfig,
|
|
55
|
-
queue: queueConfig,
|
|
56
|
-
rateLimit: rateLimitConfig,
|
|
57
|
-
realtime: realtimeConfig,
|
|
58
|
-
redis: redisConfig,
|
|
59
|
-
session: sessionConfig,
|
|
60
|
-
security: securityConfig,
|
|
61
|
-
storage: storageConfig
|
|
62
|
-
} as const;
|
|
63
|
-
|
|
64
|
-
export type Config = typeof config;
|
|
65
|
-
export type {
|
|
66
|
-
AppConfig,
|
|
67
|
-
AuthConfig,
|
|
68
|
-
CacheConfig,
|
|
69
|
-
CookieConfig,
|
|
70
|
-
CorsConfig,
|
|
71
|
-
DatabaseConfig,
|
|
72
|
-
JwtConfig,
|
|
73
|
-
LoggingConfig,
|
|
74
|
-
MailConfig,
|
|
75
|
-
OpenApiConfig,
|
|
76
|
-
QueueConfig,
|
|
77
|
-
RateLimitConfig,
|
|
78
|
-
RealtimeConfig,
|
|
79
|
-
RedisConfig,
|
|
80
|
-
SecurityConfig,
|
|
81
|
-
SessionConfig,
|
|
82
|
-
StorageConfig
|
|
83
|
-
};
|
|
1
|
+
import { type AppConfig, appConfig } from "./app.js";
|
|
2
|
+
import { type AuthConfig, authConfig } from "./auth.js";
|
|
3
|
+
import { type CacheConfig, cacheConfig } from "./cache.js";
|
|
4
|
+
import { type CookieConfig, cookieConfig } from "./cookie.js";
|
|
5
|
+
import { type CorsConfig, corsConfig } from "./cors.js";
|
|
6
|
+
import { type DatabaseConfig, databaseConfig } from "./database.js";
|
|
7
|
+
import { type JwtConfig, jwtConfig } from "./jwt.js";
|
|
8
|
+
import { type LoggingConfig, loggingConfig } from "./logging.js";
|
|
9
|
+
import { type MailConfig, mailConfig } from "./mail.js";
|
|
10
|
+
import { type OpenApiConfig, openApiConfig } from "./openapi.js";
|
|
11
|
+
import { type QueueConfig, queueConfig } from "./queue.js";
|
|
12
|
+
import { type RateLimitConfig, rateLimitConfig } from "./rateLimit.js";
|
|
13
|
+
import { type RealtimeConfig, realtimeConfig } from "./realtime.js";
|
|
14
|
+
import { type RedisConfig, redisConfig } from "./redis.js";
|
|
15
|
+
import { type SecurityConfig, securityConfig } from "./security.js";
|
|
16
|
+
import { type SessionConfig, sessionConfig } from "./session.js";
|
|
17
|
+
import { type StorageConfig, storageConfig } from "./storage.js";
|
|
18
|
+
|
|
19
|
+
export { appConfig } from "./app.js";
|
|
20
|
+
export { authConfig } from "./auth.js";
|
|
21
|
+
export { cacheConfig } from "./cache.js";
|
|
22
|
+
export { cookieConfig } from "./cookie.js";
|
|
23
|
+
export { corsConfig } from "./cors.js";
|
|
24
|
+
export { databaseConfig, databaseDialect, detectDialectFrom } from "./database.js";
|
|
25
|
+
export { jwtConfig } from "./jwt.js";
|
|
26
|
+
export { loggingConfig } from "./logging.js";
|
|
27
|
+
export { mailConfig } from "./mail.js";
|
|
28
|
+
export { openApiConfig } from "./openapi.js";
|
|
29
|
+
export { queueConfig } from "./queue.js";
|
|
30
|
+
export { rateLimitConfig } from "./rateLimit.js";
|
|
31
|
+
export { realtimeConfig } from "./realtime.js";
|
|
32
|
+
export { redisConfig } from "./redis.js";
|
|
33
|
+
export { securityConfig } from "./security.js";
|
|
34
|
+
export { sessionConfig } from "./session.js";
|
|
35
|
+
export { storageConfig } from "./storage.js";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Why: Single import point for every config domain.
|
|
39
|
+
* When: Application code needs configuration values.
|
|
40
|
+
* Where: Imported as `import { config } from "@/config/index.js"`.
|
|
41
|
+
* How: Aggregates per-domain config objects; individual files remain the
|
|
42
|
+
* place to edit each setting.
|
|
43
|
+
*/
|
|
44
|
+
export const config = {
|
|
45
|
+
app: appConfig,
|
|
46
|
+
auth: authConfig,
|
|
47
|
+
cache: cacheConfig,
|
|
48
|
+
cookie: cookieConfig,
|
|
49
|
+
cors: corsConfig,
|
|
50
|
+
database: databaseConfig,
|
|
51
|
+
jwt: jwtConfig,
|
|
52
|
+
logging: loggingConfig,
|
|
53
|
+
mail: mailConfig,
|
|
54
|
+
openApi: openApiConfig,
|
|
55
|
+
queue: queueConfig,
|
|
56
|
+
rateLimit: rateLimitConfig,
|
|
57
|
+
realtime: realtimeConfig,
|
|
58
|
+
redis: redisConfig,
|
|
59
|
+
session: sessionConfig,
|
|
60
|
+
security: securityConfig,
|
|
61
|
+
storage: storageConfig
|
|
62
|
+
} as const;
|
|
63
|
+
|
|
64
|
+
export type Config = typeof config;
|
|
65
|
+
export type {
|
|
66
|
+
AppConfig,
|
|
67
|
+
AuthConfig,
|
|
68
|
+
CacheConfig,
|
|
69
|
+
CookieConfig,
|
|
70
|
+
CorsConfig,
|
|
71
|
+
DatabaseConfig,
|
|
72
|
+
JwtConfig,
|
|
73
|
+
LoggingConfig,
|
|
74
|
+
MailConfig,
|
|
75
|
+
OpenApiConfig,
|
|
76
|
+
QueueConfig,
|
|
77
|
+
RateLimitConfig,
|
|
78
|
+
RealtimeConfig,
|
|
79
|
+
RedisConfig,
|
|
80
|
+
SecurityConfig,
|
|
81
|
+
SessionConfig,
|
|
82
|
+
StorageConfig
|
|
83
|
+
};
|