exisjs 0.9.1 → 0.10.0-alpha.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 +3 -0
- package/bin/exis.js +76 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +2 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +16 -2
- package/dist/config/types.d.ts.map +1 -1
- package/dist/docs/content/README.md +1 -0
- package/dist/docs/content/cli/commands.mdx +23 -1
- package/dist/docs/content/cli/usage.mdx +2 -1
- package/dist/docs/content/config.mdx +50 -4
- package/dist/docs/content/deployment.mdx +163 -0
- package/dist/docs/content/installation.mdx +1 -1
- package/dist/docs/content/introduction.mdx +3 -0
- package/dist/docs/content/validation.mdx +34 -12
- package/dist/docs/reference/config.mdx +3 -1
- package/dist/docs/reference/sanitize.mdx +129 -134
- package/dist/docs/reference/validator.mdx +12 -3
- package/dist/internal.d.ts +16 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +45 -0
- package/dist/internal.js.map +1 -0
- package/dist/{cli → lib}/resolve-aliases.d.ts.map +1 -1
- package/dist/{cli → lib}/resolve-aliases.js.map +1 -1
- package/dist/lib/start-command.d.ts +11 -0
- package/dist/lib/start-command.d.ts.map +1 -0
- package/dist/lib/start-command.js +79 -0
- package/dist/lib/start-command.js.map +1 -0
- package/dist/lib/start-server.js +4 -2
- package/dist/lib/start-server.js.map +1 -1
- package/dist/middleware/backpressure.d.ts +5 -0
- package/dist/middleware/backpressure.d.ts.map +1 -1
- package/dist/middleware/backpressure.js +66 -36
- package/dist/middleware/backpressure.js.map +1 -1
- package/dist/router/route-scanner.d.ts +12 -4
- package/dist/router/route-scanner.d.ts.map +1 -1
- package/dist/router/route-scanner.js +65 -51
- package/dist/router/route-scanner.js.map +1 -1
- package/dist/sanitize/index.d.ts +29 -3
- package/dist/sanitize/index.d.ts.map +1 -1
- package/dist/sanitize/index.js +91 -32
- package/dist/sanitize/index.js.map +1 -1
- package/dist/server/adapters/bun-adapter.d.ts +1 -1
- package/dist/server/adapters/bun-adapter.d.ts.map +1 -1
- package/dist/server/adapters/bun-adapter.js.map +1 -1
- package/dist/server/app.d.ts.map +1 -1
- package/dist/server/app.js +24 -1
- package/dist/server/app.js.map +1 -1
- package/dist/server/bootstrapper.d.ts.map +1 -1
- package/dist/server/bootstrapper.js +4 -2
- package/dist/server/bootstrapper.js.map +1 -1
- package/dist/server/cluster.d.ts.map +1 -1
- package/dist/server/cluster.js +3 -0
- package/dist/server/cluster.js.map +1 -1
- package/dist/server/metrics.d.ts +43 -0
- package/dist/server/metrics.d.ts.map +1 -0
- package/dist/server/metrics.js +254 -0
- package/dist/server/metrics.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +31 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/validator/builder.d.ts +32 -17
- package/dist/validator/builder.d.ts.map +1 -1
- package/dist/validator/builder.js +84 -25
- package/dist/validator/builder.js.map +1 -1
- package/dist/validator/compile.d.ts +7 -2
- package/dist/validator/compile.d.ts.map +1 -1
- package/dist/validator/compile.js +85 -54
- package/dist/validator/compile.js.map +1 -1
- package/dist/validator/engine.d.ts +58 -7
- package/dist/validator/engine.d.ts.map +1 -1
- package/dist/validator/engine.js +436 -522
- package/dist/validator/engine.js.map +1 -1
- package/dist/validator/error.d.ts.map +1 -1
- package/dist/validator/error.js +7 -0
- package/dist/validator/error.js.map +1 -1
- package/dist/validator/index.d.ts +4 -1
- package/dist/validator/index.d.ts.map +1 -1
- package/dist/validator/index.js +5 -1
- package/dist/validator/index.js.map +1 -1
- package/dist/validator/rules.d.ts +66 -7
- package/dist/validator/rules.d.ts.map +1 -1
- package/dist/validator/rules.js +435 -109
- package/dist/validator/rules.js.map +1 -1
- package/dist/validator/tex-types.d.ts +15 -0
- package/dist/validator/tex-types.d.ts.map +1 -1
- package/dist/validator/tex-types.js +127 -64
- package/dist/validator/tex-types.js.map +1 -1
- package/dist/validator/tex.d.ts +1 -1
- package/dist/validator/tex.d.ts.map +1 -1
- package/dist/validator/text.d.ts +2 -0
- package/dist/validator/text.d.ts.map +1 -1
- package/dist/validator/text.js +31 -13
- package/dist/validator/text.js.map +1 -1
- package/dist/validator/types.d.ts +22 -0
- package/dist/validator/types.d.ts.map +1 -1
- package/package.json +81 -9
- package/dist/cli/commands/build.d.ts +0 -11
- package/dist/cli/commands/build.d.ts.map +0 -1
- package/dist/cli/commands/build.js +0 -344
- package/dist/cli/commands/build.js.map +0 -1
- package/dist/cli/commands/clean.d.ts +0 -5
- package/dist/cli/commands/clean.d.ts.map +0 -1
- package/dist/cli/commands/clean.js +0 -30
- package/dist/cli/commands/clean.js.map +0 -1
- package/dist/cli/commands/dev.d.ts +0 -21
- package/dist/cli/commands/dev.d.ts.map +0 -1
- package/dist/cli/commands/dev.js +0 -842
- package/dist/cli/commands/dev.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -2
- package/dist/cli/commands/doctor.d.ts.map +0 -1
- package/dist/cli/commands/doctor.js +0 -228
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/exports.d.ts +0 -2
- package/dist/cli/commands/exports.d.ts.map +0 -1
- package/dist/cli/commands/exports.js +0 -48
- package/dist/cli/commands/exports.js.map +0 -1
- package/dist/cli/commands/generate.d.ts +0 -33
- package/dist/cli/commands/generate.d.ts.map +0 -1
- package/dist/cli/commands/generate.js +0 -469
- package/dist/cli/commands/generate.js.map +0 -1
- package/dist/cli/commands/init.d.ts +0 -2
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -37
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/repl.d.ts +0 -6
- package/dist/cli/commands/repl.d.ts.map +0 -1
- package/dist/cli/commands/repl.js +0 -75
- package/dist/cli/commands/repl.js.map +0 -1
- package/dist/cli/commands/run.d.ts +0 -7
- package/dist/cli/commands/run.d.ts.map +0 -1
- package/dist/cli/commands/run.js +0 -101
- package/dist/cli/commands/run.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -8
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/commands/start.js +0 -155
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/test.d.ts +0 -8
- package/dist/cli/commands/test.d.ts.map +0 -1
- package/dist/cli/commands/test.js +0 -165
- package/dist/cli/commands/test.js.map +0 -1
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -268
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/manifest.d.ts +0 -4
- package/dist/cli/manifest.d.ts.map +0 -1
- package/dist/cli/manifest.js +0 -489
- package/dist/cli/manifest.js.map +0 -1
- package/dist/cli/routes.d.ts +0 -17
- package/dist/cli/routes.d.ts.map +0 -1
- package/dist/cli/routes.js +0 -317
- package/dist/cli/routes.js.map +0 -1
- package/dist/cli/utils.d.ts +0 -24
- package/dist/cli/utils.d.ts.map +0 -1
- package/dist/cli/utils.js +0 -54
- package/dist/cli/utils.js.map +0 -1
- package/dist/lib/inspect-routes.d.ts +0 -2
- package/dist/lib/inspect-routes.d.ts.map +0 -1
- package/dist/lib/inspect-routes.js +0 -150
- package/dist/lib/inspect-routes.js.map +0 -1
- package/dist/lib/start-repl.d.ts +0 -2
- package/dist/lib/start-repl.d.ts.map +0 -1
- package/dist/lib/start-repl.js +0 -120
- package/dist/lib/start-repl.js.map +0 -1
- package/dist/sanitize/sanitize.d.ts +0 -33
- package/dist/sanitize/sanitize.d.ts.map +0 -1
- package/dist/sanitize/sanitize.js +0 -104
- package/dist/sanitize/sanitize.js.map +0 -1
- /package/dist/{cli → lib}/resolve-aliases.d.ts +0 -0
- /package/dist/{cli → lib}/resolve-aliases.js +0 -0
package/README.md
CHANGED
|
@@ -14,8 +14,11 @@ Install `exisjs` via npm:
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npm install exisjs
|
|
17
|
+
npm install -D @exisjs/cli typescript
|
|
17
18
|
```
|
|
18
19
|
|
|
20
|
+
The `exisjs` command (`dev`, `build`, `test`) is in [`@exisjs/cli`](https://www.npmjs.com/package/@exisjs/cli), a development dependency; production installs only need `exisjs`.
|
|
21
|
+
|
|
19
22
|
Or initialize a new project using the scaffolding CLI:
|
|
20
23
|
|
|
21
24
|
```bash
|
package/bin/exis.js
CHANGED
|
@@ -1,2 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
// `exisjs start` runs here, from the runtime, so production installs need no
|
|
3
|
+
// development tools. Every other command is in @exisjs/cli; this binary
|
|
4
|
+
// forwards to it.
|
|
5
|
+
const fs = require('node:fs')
|
|
6
|
+
const path = require('node:path')
|
|
7
|
+
|
|
8
|
+
const [command, ...args] = process.argv.slice(2)
|
|
9
|
+
|
|
10
|
+
if (command === 'start') {
|
|
11
|
+
const options = {}
|
|
12
|
+
const names = {
|
|
13
|
+
'-p': 'port',
|
|
14
|
+
'--port': 'port',
|
|
15
|
+
'-H': 'host',
|
|
16
|
+
'--host': 'host',
|
|
17
|
+
'-e': 'entry',
|
|
18
|
+
'--entry': 'entry',
|
|
19
|
+
}
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
const [flag, inline] = args[i].split('=')
|
|
22
|
+
if (flag === '-h' || flag === '--help') {
|
|
23
|
+
console.log(
|
|
24
|
+
'Usage: exisjs start [--port <port>] [--host <host>] [--entry <file>]'
|
|
25
|
+
)
|
|
26
|
+
process.exit(0)
|
|
27
|
+
}
|
|
28
|
+
const name = names[flag]
|
|
29
|
+
if (!name) {
|
|
30
|
+
console.error(`Unknown option for exisjs start: ${args[i]}`)
|
|
31
|
+
process.exit(1)
|
|
32
|
+
}
|
|
33
|
+
options[name] = inline ?? args[++i]
|
|
34
|
+
}
|
|
35
|
+
require('../dist/lib/start-command.js')
|
|
36
|
+
.startBuiltServer(options)
|
|
37
|
+
.catch((err) => {
|
|
38
|
+
console.error(err)
|
|
39
|
+
process.exit(1)
|
|
40
|
+
})
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let cli
|
|
45
|
+
try {
|
|
46
|
+
cli = require.resolve('@exisjs/cli/bin/exisjs.js', {
|
|
47
|
+
paths: [process.cwd(), __dirname],
|
|
48
|
+
})
|
|
49
|
+
} catch {
|
|
50
|
+
console.error(
|
|
51
|
+
`\n \`exisjs ${command ?? ''}\` is in the @exisjs/cli package, which is not installed.\n` +
|
|
52
|
+
' Install it as a development dependency:\n\n' +
|
|
53
|
+
' npm install -D @exisjs/cli\n\n' +
|
|
54
|
+
' (`exisjs start` needs only exisjs, so production installs can leave it out.)\n'
|
|
55
|
+
)
|
|
56
|
+
process.exit(1)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// One line, only for projects that rely on the package installed through
|
|
60
|
+
// the runtime instead of listing it themselves
|
|
61
|
+
try {
|
|
62
|
+
const pkg = JSON.parse(
|
|
63
|
+
fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8')
|
|
64
|
+
)
|
|
65
|
+
const listed =
|
|
66
|
+
pkg.devDependencies?.['@exisjs/cli'] || pkg.dependencies?.['@exisjs/cli']
|
|
67
|
+
if (!listed && command !== 'migrate' && !process.env.EXIS_NO_CLI_NOTICE) {
|
|
68
|
+
console.error(
|
|
69
|
+
'\x1b[33m[exis]\x1b[0m The CLI moved to @exisjs/cli; exisjs 0.11 stops installing it. ' +
|
|
70
|
+
'Run \x1b[36mnpx exisjs migrate\x1b[0m to update this project.'
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
// no package.json: nothing to suggest
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
require(cli)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAA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AAA;IACvB,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC3B,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC3B,GAAG,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IACvB,iBAAiB,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAA;IACnD,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,qBAAqB,CAAC,EAAE,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAC3D,aAAa,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAC3C,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,cAmD3B,CAAA;AAID,wBAAgB,WAAW,CACzB,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,UAAU,GACnB,cAAc,CAyChB;AAWD,wBAAsB,UAAU,CAC9B,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,cAAc,CAAC,CA0FzB"}
|
package/dist/config/config.js
CHANGED
|
@@ -50,7 +50,8 @@ exports.defaultConfig = {
|
|
|
50
50
|
helmet: { enabled: true },
|
|
51
51
|
trustProxy: false,
|
|
52
52
|
bodyLimit: 10 * 1024 * 1024,
|
|
53
|
-
|
|
53
|
+
// Only an explicit NODE_ENV=development exposes error details; `exisjs dev` sets it
|
|
54
|
+
env: process.env.NODE_ENV ?? 'production',
|
|
54
55
|
compression: false,
|
|
55
56
|
keepAlive: false,
|
|
56
57
|
server: 'auto', // Auto-detect backend
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";;;;;;AAOA,oCAEC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";;;;;;AAOA,oCAEC;AAkFD,kCA4CC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,EAAE,CAC1C,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,qBAAa,CAAA;AACtB,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -97,6 +97,11 @@ export interface DevConfig {
|
|
|
97
97
|
extensions?: string[];
|
|
98
98
|
/** Debounce interval in milliseconds before reloading the server */
|
|
99
99
|
debounceMs?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Load each route file on its first request (default `true`). Set to `false`
|
|
102
|
+
* to load every route at startup, as `exisjs start` does.
|
|
103
|
+
*/
|
|
104
|
+
lazyRoutes?: boolean;
|
|
100
105
|
}
|
|
101
106
|
export interface ExisConfig {
|
|
102
107
|
port?: number;
|
|
@@ -138,11 +143,20 @@ export interface ExisConfig {
|
|
|
138
143
|
* 'auto' will use Bun if detected, otherwise Node.
|
|
139
144
|
*/
|
|
140
145
|
server?: 'auto' | 'node' | 'bun' | 'uws';
|
|
146
|
+
/**
|
|
147
|
+
* Limits how many requests the app handles at once. Requests over
|
|
148
|
+
* `maxConcurrent` wait in this process (up to `maxQueue`, for at most
|
|
149
|
+
* `timeoutMs`), then get 503. Unknown keys and drivers stop the start.
|
|
150
|
+
*/
|
|
141
151
|
queue?: {
|
|
142
|
-
|
|
152
|
+
/** Only `'memory'`: waiting requests live in this process */
|
|
153
|
+
driver?: 'memory';
|
|
154
|
+
/** Requests handled at once. Default 1000 */
|
|
143
155
|
maxConcurrent?: number;
|
|
156
|
+
/** Requests allowed to wait. Default 500 */
|
|
144
157
|
maxQueue?: number;
|
|
145
|
-
|
|
158
|
+
/** How long a request may wait, in ms. Default 10000 */
|
|
159
|
+
timeoutMs?: number;
|
|
146
160
|
};
|
|
147
161
|
watch?: WatchConfig;
|
|
148
162
|
dev?: DevConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAk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CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAA;IAExC;;;;OAIG;IACH,KAAK,CAAC,EAAE;QACN,6DAA6D;QAC7D,MAAM,CAAC,EAAE,QAAQ,CAAA;QACjB,6CAA6C;QAC7C,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,4CAA4C;QAC5C,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,wDAAwD;QACxD,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,kBAAkB,CAAC,EAAE,CAAA;IAC7C,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;QACrB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;QAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,CAAA;CACF"}
|
|
@@ -33,6 +33,7 @@ Documentation follows the [Diátaxis Framework](https://diataxis.fr/), separatin
|
|
|
33
33
|
- [`cron.mdx`](./cron.mdx): Background task scheduling (`cron()` and `@Cron()`) with drift correction and overlap protection.
|
|
34
34
|
- [`swagger.mdx`](./swagger.mdx): Automatic OpenAPI 3.1 schema extraction, Swagger UI (`/docs`), and JSON documentation endpoints.
|
|
35
35
|
- [`testing.mdx`](./testing.mdx): Test harness (`createTestContext`, `createTestApp`), mocking utilities (`ex`), and CLI test runner.
|
|
36
|
+
- [`deployment.mdx`](./deployment.mdx): Docker images, build-time secrets (`--skip-env-check`), graceful shutdown, health checks and migrations.
|
|
36
37
|
- [`config.mdx`](./config.mdx): Global configuration options in `exis.config.ts`, lifecycle phases, clustering, and file watcher settings.
|
|
37
38
|
- [`exisjs-mcp.mdx`](./exisjs-mcp.mdx): Model Context Protocol (MCP) server integration for IDE AI assistants.
|
|
38
39
|
|
|
@@ -55,6 +55,10 @@ npx exisjs build [options]
|
|
|
55
55
|
### Type-checking on deployment hosts
|
|
56
56
|
Some hosts (Render, Heroku and others) install with `NODE_ENV=production`, which leaves out `devDependencies` such as `@types/node`. When `@types/*` packages listed in your `devDependencies` are not installed, `exisjs build` skips the type-check with a warning and still compiles. To keep the type-check on the host, set the install command to `npm install --include=dev`.
|
|
57
57
|
|
|
58
|
+
The same applies to the CLI itself: `exisjs build` comes from `@exisjs/cli`, a development dependency. Build where development dependencies are installed (a Docker build stage, or `npm install --include=dev` on the host), then install production dependencies only for the running server.
|
|
59
|
+
|
|
60
|
+
`exisjs build` also writes `.exis/server/main.js`, the production entry: `node .exis/server/main.js` starts the server in that one process, with `NODE_ENV=production` unless set otherwise.
|
|
61
|
+
|
|
58
62
|
### Build Outputs
|
|
59
63
|
- Compiles application source code into the specified `outDir`.
|
|
60
64
|
- Emits pre-computed route manifests (`.exis/routes-manifest.js`) for O(1) route discovery at runtime.
|
|
@@ -81,7 +85,9 @@ npx exisjs cl [options]
|
|
|
81
85
|
|
|
82
86
|
## `exisjs start`
|
|
83
87
|
|
|
84
|
-
Starts the
|
|
88
|
+
Starts the built server in the current process (the same as `node .exis/server/main.js`), with `NODE_ENV=production`. The server receives `SIGINT` / `SIGTERM` itself and shuts down gracefully.
|
|
89
|
+
|
|
90
|
+
`exisjs start` is part of the `exisjs` runtime package, not of `@exisjs/cli`: it works in production installs that leave out development dependencies (`npm ci --omit=dev`), so `"start": "exisjs start"` and `npm start` work on every platform. The other commands need `@exisjs/cli`.
|
|
85
91
|
|
|
86
92
|
```bash
|
|
87
93
|
npx exisjs start [options]
|
|
@@ -97,6 +103,22 @@ npx exisjs start [options]
|
|
|
97
103
|
|
|
98
104
|
---
|
|
99
105
|
|
|
106
|
+
## `exisjs migrate`
|
|
107
|
+
|
|
108
|
+
Updates a project created before 0.10 to the current layout:
|
|
109
|
+
|
|
110
|
+
- adds `@exisjs/cli` to `devDependencies` (and `typescript`, if the project has a `tsconfig.json` but did not list it);
|
|
111
|
+
- lists the `Dockerfile` lines to change (it does not edit the `Dockerfile`).
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx exisjs migrate # writes package.json
|
|
115
|
+
npx exisjs migrate --dry-run # only shows the changes
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Then run `npm install`. Running it again changes nothing.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
100
122
|
## `exisjs generate`
|
|
101
123
|
|
|
102
124
|
Scaffolds framework components and files according to ExisJS file conventions.
|
|
@@ -68,6 +68,7 @@ Applications initialized with `npx exisjs init` include standard npm lifecycle s
|
|
|
68
68
|
"exisjs": "^1.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
+
"@exisjs/cli": "^0.10.0",
|
|
71
72
|
"typescript": "^5.0.0"
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -82,7 +83,7 @@ npm run dev
|
|
|
82
83
|
# Compile TypeScript and build route manifests
|
|
83
84
|
npm run build
|
|
84
85
|
|
|
85
|
-
# Start production server
|
|
86
|
+
# Start the production server (one process, no CLI needed)
|
|
86
87
|
npm run start
|
|
87
88
|
|
|
88
89
|
# Run native test runner
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Configuration"
|
|
3
3
|
description: "Global runtime configuration, phases, environment loading, server engine selection, and cluster options in exis.config.ts."
|
|
4
|
-
nextUrl: "/docs/
|
|
5
|
-
nextTitle: "
|
|
4
|
+
nextUrl: "/docs/deployment"
|
|
5
|
+
nextTitle: "Deploying with Docker"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Configuration (`exis.config.ts`)
|
|
@@ -152,6 +152,7 @@ export default defineConfig({
|
|
|
152
152
|
| `errors` | `{ legacyFields?: boolean }` | `{}` | `legacyFields: true` adds the pre-0.9 duplicate fields to error bodies. Deprecated. |
|
|
153
153
|
| `compression` | `boolean` | `false` | Gzip/Brotli HTTP response compression. |
|
|
154
154
|
| `bodyLimit` | `number` | `10485760` (10MB) | Maximum request payload body size in bytes. |
|
|
155
|
+
| `env` | `'development' \| 'production' \| 'test'` | `NODE_ENV`, else `'production'` | Only `development` sends error messages and stack traces to clients and loads routes lazily. `exisjs dev` sets it; a server started with plain `node` or `tsx` and no `NODE_ENV` runs as production. |
|
|
155
156
|
| `blockSuspiciousProbes` | `boolean \| BlockProbesOptions` | `false` | Blocks known vulnerability scanners and malicious probes (`.php`, `wp-admin`). |
|
|
156
157
|
| `etag` | `boolean` | `false` | Weak ETags on successful GET/HEAD responses, with `304 Not Modified` for a matching `If-None-Match`. See [Caching & Conditional Requests](/docs/responses#caching--conditional-requests-etag-304-412). |
|
|
157
158
|
| `transformResponse` | `boolean \| Function` | `false` | Standardizes handler response payload envelopes. |
|
|
@@ -165,7 +166,7 @@ export default defineConfig({
|
|
|
165
166
|
| `asyncContext` | `boolean` | `false` | Enables `AsyncLocalStorage` context tracking (`getContext()`). |
|
|
166
167
|
| `docs` / `swagger` | `boolean \| SwaggerConfig` | `{ enabled: false }` | OpenAPI 3.1 specification and Swagger UI endpoint generation. Served in every environment when enabled; the project template uses `enabled: process.env.NODE_ENV !== 'production'` so published API docs do not help attackers. |
|
|
167
168
|
| `healthcheck` | `boolean \| HealthCheckConfig` | `{ enabled: false }` | `path` (`/_health`): liveness, runs `checks`. `readyPath` (`/_ready`, `false` to disable): readiness, `503` unless `checks` pass, registered databases are healthy and the app is not shutting down. |
|
|
168
|
-
| `metrics` | `boolean \| MetricsConfig` | `{ enabled: false }` | Prometheus metrics endpoint (`path: '/metrics'`). |
|
|
169
|
+
| `metrics` | `boolean \| MetricsConfig` | `{ enabled: false }` | Prometheus metrics endpoint (`path: '/metrics'`). See [Prometheus Metrics](#prometheus-metrics). |
|
|
169
170
|
| `telemetry` | `boolean \| TelemetryConfig` | `{ enabled: false }` | OpenTelemetry tracing and metrics export. |
|
|
170
171
|
|
|
171
172
|
### Concurrency & Clustering
|
|
@@ -181,6 +182,24 @@ export default defineConfig({
|
|
|
181
182
|
})
|
|
182
183
|
```
|
|
183
184
|
|
|
185
|
+
#### Limiting concurrent requests (`queue`)
|
|
186
|
+
|
|
187
|
+
`queue` caps how many requests the app handles at once, so a traffic spike slows down instead of exhausting memory or the database pool:
|
|
188
|
+
|
|
189
|
+
```typescript filename="exis.config.ts"
|
|
190
|
+
export default defineConfig({
|
|
191
|
+
queue: {
|
|
192
|
+
maxConcurrent: 500, // handled at once (default 1000)
|
|
193
|
+
maxQueue: 200, // may wait for a free slot (default 500)
|
|
194
|
+
timeoutMs: 10_000, // longest wait (default 10 s)
|
|
195
|
+
},
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
A request over the limit waits in this process; when `maxQueue` is full, or the wait exceeds `timeoutMs`, it gets `503 Service Unavailable`. A client that disconnects frees its place. The limit is per process (per worker in cluster mode).
|
|
200
|
+
|
|
201
|
+
The only `driver` is `'memory'`. Any other driver, unknown keys and invalid numbers stop the server at start-up with a message naming the option. ExisJS has no shared or durable queue yet, so a setting that pretended to provide one would be silently ignored.
|
|
202
|
+
|
|
184
203
|
---
|
|
185
204
|
|
|
186
205
|
## File Watcher & Development Configuration
|
|
@@ -200,7 +219,8 @@ export default defineConfig({
|
|
|
200
219
|
|
|
201
220
|
dev: {
|
|
202
221
|
usePolling: false, // Set to true for network mounts or WSL
|
|
203
|
-
interval: 100
|
|
222
|
+
interval: 100,
|
|
223
|
+
lazyRoutes: true // false loads every route at startup, as in production
|
|
204
224
|
}
|
|
205
225
|
})
|
|
206
226
|
```
|
|
@@ -213,6 +233,32 @@ ExisJS automatically excludes build output and temp folders from triggering watc
|
|
|
213
233
|
|
|
214
234
|
---
|
|
215
235
|
|
|
236
|
+
## Prometheus Metrics
|
|
237
|
+
|
|
238
|
+
Set `metrics: { enabled: true }` (or `metrics: true`) to serve request and process metrics in the Prometheus text format at `GET /metrics` (change it with `path`).
|
|
239
|
+
|
|
240
|
+
```typescript filename="exis.config.ts"
|
|
241
|
+
export default defineConfig({
|
|
242
|
+
metrics: { enabled: true, path: '/metrics' },
|
|
243
|
+
})
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
| Metric | Type | Labels |
|
|
247
|
+
| :--- | :--- | :--- |
|
|
248
|
+
| `http_requests_total` | counter | `method`, `route`, `status` |
|
|
249
|
+
| `http_request_duration_seconds` | histogram (5 ms to 10 s) | `method`, `route` |
|
|
250
|
+
| `http_requests_in_flight` | gauge | |
|
|
251
|
+
| `process_resident_memory_bytes`, `nodejs_heap_used_bytes` | gauge | `worker` in cluster mode |
|
|
252
|
+
| `nodejs_eventloop_lag_p99_seconds` | gauge | `worker` in cluster mode |
|
|
253
|
+
| `process_start_time_seconds` | gauge | `worker` in cluster mode |
|
|
254
|
+
|
|
255
|
+
- **`route` is the route pattern** (`/users/:id`), never the requested URL, so the number of series stays bounded. Requests that match no route are counted under `(unmatched)`.
|
|
256
|
+
- **Status `499`** counts requests whose client disconnected before the response finished.
|
|
257
|
+
- **Cluster mode:** a scrape can reach any worker; that worker collects the numbers of every worker through the primary process, so the request counters are always the whole server's. Memory and event-loop lag are reported per worker.
|
|
258
|
+
- **Keep the endpoint private.** It lists every route of the API. Expose it only on an internal network, or block it at the proxy for public traffic.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
216
262
|
## Plugin Integration
|
|
217
263
|
|
|
218
264
|
Plugins extend framework capabilities by intercepting server configuration or registering global routes:
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Deploying with Docker"
|
|
3
|
+
description: "Build an ExisJS app into a small production image, keep secrets out of the build, run the server as one process that shuts down gracefully, and wire up health checks."
|
|
4
|
+
nextUrl: "/docs/exisjs-mcp"
|
|
5
|
+
nextTitle: "AI Integration (MCP)"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Deploying with Docker
|
|
9
|
+
|
|
10
|
+
This page builds an ExisJS app into a production image that:
|
|
11
|
+
|
|
12
|
+
- builds without secrets, because container platforms provide them only when the container runs;
|
|
13
|
+
- refuses to start when a required secret is missing;
|
|
14
|
+
- runs the server as one process that stops gracefully on `docker stop` and on every redeploy;
|
|
15
|
+
- contains no build tools: no TypeScript, esbuild or CLI.
|
|
16
|
+
|
|
17
|
+
The Dockerfile below was tested end to end with an app created by `npm create exisjs`.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## The Dockerfile
|
|
22
|
+
|
|
23
|
+
```dockerfile filename="Dockerfile"
|
|
24
|
+
# syntax=docker/dockerfile:1
|
|
25
|
+
|
|
26
|
+
# ── Build: full toolchain ────────────────────────────────────────────────────
|
|
27
|
+
FROM node:24-slim AS build
|
|
28
|
+
WORKDIR /app
|
|
29
|
+
COPY package*.json ./
|
|
30
|
+
RUN npm ci
|
|
31
|
+
COPY . .
|
|
32
|
+
# Secrets are injected when the container runs, not while the image builds
|
|
33
|
+
RUN npx exisjs build --skip-env-check
|
|
34
|
+
|
|
35
|
+
# ── Runtime: production dependencies only ────────────────────────────────────
|
|
36
|
+
FROM node:24-slim
|
|
37
|
+
WORKDIR /app
|
|
38
|
+
ENV NODE_ENV=production PORT=3000
|
|
39
|
+
COPY package*.json ./
|
|
40
|
+
RUN npm ci --omit=dev --omit=optional && npm cache clean --force
|
|
41
|
+
COPY --from=build /app/.exis ./.exis
|
|
42
|
+
USER node
|
|
43
|
+
EXPOSE 3000
|
|
44
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
|
|
45
|
+
CMD node -e "fetch('http://127.0.0.1:3000/health').then(r => process.exit(r.ok ? 0 : 1), () => process.exit(1))"
|
|
46
|
+
CMD ["node_modules/.bin/exisjs", "start"]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`exisjs build` writes everything the server needs into `.exis/`: the compiled code, the route manifest, the compiled `exis.config` and `main.js`, the entry that starts the server. The runtime image needs only `.exis/`, `package.json` and the production dependencies; it contains no source files.
|
|
50
|
+
|
|
51
|
+
- **`--omit=optional`** keeps the CLI out of the image. Until 0.11, `exisjs` lists `@exisjs/cli` as an optional dependency so that projects created before 0.10 keep working. If you use the uWebSockets.js engine (`server: 'uws'`), list `uWebSockets.js` in your own `dependencies`, since it is optional too.
|
|
52
|
+
- **`npm ci`** in the build stage installs `devDependencies`, which include `@exisjs/cli` and `typescript`.
|
|
53
|
+
|
|
54
|
+
Add a `.dockerignore`, so local files never reach the image. **`.env` must be in it**, or your local secrets are copied into every image layer:
|
|
55
|
+
|
|
56
|
+
```text filename=".dockerignore"
|
|
57
|
+
node_modules
|
|
58
|
+
.exis
|
|
59
|
+
dist
|
|
60
|
+
.git
|
|
61
|
+
.env
|
|
62
|
+
.env.*
|
|
63
|
+
!.env.example
|
|
64
|
+
*.log
|
|
65
|
+
coverage
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Secrets: `--skip-env-check`
|
|
71
|
+
|
|
72
|
+
`exisjs build` loads your route files to check them, and a route that imports `tex.env` validates the environment while it loads. In a Docker build the secrets don't exist yet, so a plain `RUN npx exisjs build` fails:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
✗ BUILD_VALIDATION_FAILED: Validation Error: DATABASE_URL: Expected value, received undefined
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`--skip-env-check` skips that check **for the build only**. When the container starts, `tex.env` validates the real environment, and a missing or invalid value stops the server with exit code 1:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
[ExisJS] the routes manifest failed to load, so the server will not start:
|
|
82
|
+
Validation Error: DATABASE_URL: Expected value, received undefined
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Pass the secrets when you run the container (`docker run -e DATABASE_URL=...`, or your platform's environment settings). Never set `EXIS_SKIP_ENV_CHECK` in the runtime environment: it is the build flag, and would let the server start with placeholder values.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## One process, graceful shutdown
|
|
90
|
+
|
|
91
|
+
`exisjs start` comes with the `exisjs` runtime, so the image needs no CLI, and it runs the server in its own process: Node is PID 1 in the container and receives `SIGTERM` directly. (`node .exis/server/main.js`, written by `exisjs build`, does the same.)
|
|
92
|
+
|
|
93
|
+
In the `CMD`, call the binary itself rather than `npm start`: with npm in between, a redeploy's `SIGTERM` shows up as `npm error signal SIGTERM`, and some platforms stop the container early when they detach its input. `npm start` with `"start": "exisjs start"` works too, for platforms that only run npm scripts.
|
|
94
|
+
|
|
95
|
+
On `docker stop`:
|
|
96
|
+
|
|
97
|
+
1. The server stops accepting new connections, and the readiness probe (`/_ready`, if enabled) answers `503`.
|
|
98
|
+
2. Requests in progress finish.
|
|
99
|
+
3. `onClose` hooks run and registered databases disconnect.
|
|
100
|
+
4. The process exits with code 0.
|
|
101
|
+
|
|
102
|
+
ExisJS waits up to 10 seconds for this, and Docker also waits 10 seconds by default before it kills the container. If your requests can take longer, raise both: `docker stop -t 60` / `stop_grace_period: 60s` in Compose, and the platform's equivalent.
|
|
103
|
+
|
|
104
|
+
With `cluster: { workers }` set, that process is the cluster primary and forks the workers itself.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Health checks
|
|
109
|
+
|
|
110
|
+
The project template has a `GET /health` route, which the `HEALTHCHECK` above calls. `node:24-slim` has no `curl`, so the check uses Node's `fetch`.
|
|
111
|
+
|
|
112
|
+
For a load balancer or Kubernetes, turn on the built-in probes instead:
|
|
113
|
+
|
|
114
|
+
```typescript filename="exis.config.ts"
|
|
115
|
+
export default defineConfig({
|
|
116
|
+
healthcheck: { enabled: true }, // GET /_health (liveness) and GET /_ready (readiness)
|
|
117
|
+
})
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Point the load balancer, or the Kubernetes `readinessProbe`, at `/_ready`: it answers `503` while a registered database is down and during shutdown. Use `/_health` only to decide whether to restart the container.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Database migrations and scripts
|
|
125
|
+
|
|
126
|
+
The runtime image has no source files and no CLI, so run one-off tasks from the build stage, which has the whole project and toolchain:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
docker build --target build -t my-api:build .
|
|
130
|
+
docker run --rm -e DATABASE_URL="$DATABASE_URL" my-api:build npx exisjs run scripts/migrate.ts
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Run it as a separate step of your deployment, before the new version starts.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Projects created before 0.10
|
|
138
|
+
|
|
139
|
+
Run `npx exisjs migrate` once. It adds `@exisjs/cli` to `devDependencies` and lists the Dockerfile lines to change (`--omit=optional`, and a `CMD` that goes through `npm start`). `"start": "exisjs start"` stays as it is: it now runs the server in its own process, without the CLI.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Platform notes
|
|
144
|
+
|
|
145
|
+
- **Pin the Node.js version.** Use an explicit image (`node:24-slim`). Builders that pick Node for you, such as Nixpacks, may default to an older version than your dependencies need; set it explicitly (for Nixpacks, `nodejs_22` or later in `nixpacks.toml`).
|
|
146
|
+
- **Builds on the host.** Platforms that build without a Dockerfile must install `devDependencies` for the build (`npm install --include=dev`), because `exisjs build` comes from `@exisjs/cli`.
|
|
147
|
+
- **Start command.** On platforms that ask for a start command instead of a Dockerfile `CMD`, enter `npx exisjs start` or `npm start`.
|
|
148
|
+
- **Long requests behind a CDN.** A proxy such as Cloudflare ends requests after about 100 seconds, whatever the server allows. Serve long-running endpoints from a hostname that is not proxied.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Image size
|
|
153
|
+
|
|
154
|
+
Measured with an app created by `npm create exisjs`, on `node:24-slim`:
|
|
155
|
+
|
|
156
|
+
| | Before 0.10 | 0.10 |
|
|
157
|
+
| :--- | ---: | ---: |
|
|
158
|
+
| Production `node_modules` | 45 MB | 8 MB |
|
|
159
|
+
| Build tooling in it (`typescript`, `esbuild`, `tsx`, the CLI) | 34 MB | none |
|
|
160
|
+
| Image | 274 MB | 237 MB |
|
|
161
|
+
| Node processes in the container | 2 | 1 |
|
|
162
|
+
|
|
163
|
+
Most of the remaining image is the `node:24-slim` base. The production install is checked in CI on every change, against a size budget that fails if build tooling returns.
|
|
@@ -139,7 +139,7 @@ To install ExisJS into an existing repository without scaffolding:
|
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
141
|
npm install exisjs
|
|
142
|
-
npm install -D typescript @types/node prettier
|
|
142
|
+
npm install -D @exisjs/cli typescript @types/node prettier
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
### Step 2: Configure `tsconfig.json`
|
|
@@ -224,8 +224,11 @@ Install the framework into an existing Node.js project:
|
|
|
224
224
|
|
|
225
225
|
```bash
|
|
226
226
|
npm install exisjs
|
|
227
|
+
npm install -D @exisjs/cli typescript
|
|
227
228
|
```
|
|
228
229
|
|
|
230
|
+
`exisjs` is the runtime your server needs in production; `@exisjs/cli` is the `exisjs` command (dev server, build, tests), a development tool.
|
|
231
|
+
|
|
229
232
|
Create an application configuration file:
|
|
230
233
|
|
|
231
234
|
```typescript filename="exis.config.ts"
|