CLI Commands
The ExisJS CLI provides tools for local development, production compilation, scaffolding, testing, database scripting, and environment auditing.
exisjs dev
Starts the development server with live file watching, TypeScript transpilation, and automatic port collision avoidance.
npx exisjs dev [options]Options
| Option | Type | Default | Description |
|---|---|---|---|
-p, --port <port> | number | 3000 | Port to listen on (overrides .env and exis.config.ts). |
-H, --host <host> | string | localhost | Host address to bind to. |
-e, --entry <file> | string | src/http/server.ts | Custom entry file path to bootstrap the application. |
--force | boolean | false | Start even if a dev server for the same port appears to be running. |
Behavior
- Port Collision Detection: If the specified port is in use, the CLI automatically increments to the next open port.
- One server per port:
.exis/dev-<port>.pidstops a secondexisjs devon the same port. A second instance on another port (--port 4010, for example against a test database) is allowed. A lock left by a crashed process is ignored once its port is free;--forceskips the check.
exisjs build
Compiles the TypeScript application to production JavaScript, performs type-checking, and generates static route manifests.
npx exisjs build [options]Options
| Option | Type | Default | Description |
|---|---|---|---|
-o, --out-dir <dir> | string | .exis/server | Output directory for compiled JavaScript assets. |
--no-clean | boolean | false | Skip cleaning the output directory prior to compilation. |
--skip-env-check | boolean | false | Skip build-time route and environment validation checks. |
--dry-run | boolean | false | Compile and bundle without halting on missing environment variables. |
-m, --mode <mode> | string | production | Environment mode to load (e.g. production, staging). |
Type-checking on deployment hosts
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.
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.
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.
Build Outputs
- Compiles application source code into the specified
outDir. - Emits pre-computed route manifests (
.exis/routes-manifest.js) for O(1) route discovery at runtime. - Generates TypeScript environment definitions (
.exis/exis.d.ts).
exisjs clean
Removes temporary build artifacts, compiled files, and cached manifests.
npx exisjs clean [options]npx exisjs cl [options]Options
| Option | Type | Default | Description |
|---|---|---|---|
-a, --all | boolean | false | In addition to .exis/, also remove the dist/ directory. |
exisjs start
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.
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.
npx exisjs start [options]Options
| Option | Type | Default | Description |
|---|---|---|---|
-p, --port <port> | number | 3000 | Port to listen on. |
-H, --host <host> | string | 0.0.0.0 | Host address to bind to. |
-e, --entry <file> | string | .exis/server/src/http/server.js | Custom compiled entry file path. |
exisjs migrate
Updates a project created before 0.10 to the current layout:
- adds
@exisjs/clitodevDependencies(andtypescript, if the project has atsconfig.jsonbut did not list it); - lists the deployment lines to change, without editing the files: in the
Dockerfile, aCMDthroughnpm start,npm ci --omit=devwithout--omit=optional, andexisjs buildwithout--skip-env-check; innixpacks.tomlandProcfile, a start command throughnpm start.
npx exisjs migrate # writes package.jsonnpx exisjs migrate --dry-run # only shows the changesThen run npm install. Running it again changes nothing.
exisjs generate
Scaffolds framework components and files according to ExisJS file conventions.
npx exisjs generate <type> [name] [options]npx exisjs g <type> [name] [options]Arguments
| Argument | Description |
|---|---|
<type> | The schematic type to generate. |
[name] | The name of the feature or folder (required for all types except error). |
Options
| Option | Type | Default | Description |
|---|---|---|---|
-n, --named | boolean | false | Names generated files using the feature prefix (e.g. user.route.ts, user.schema.ts). |
--oop | boolean | false | Generates using Class-Based (OOP) decorators instead of Functional syntax. |
Supported Schematics
| Schematic | Alias | Description | Output Location |
|---|---|---|---|
crud | resource | Generates full 4-file CRUD slice (schema, service, route, model). | src/http/<name>/ & src/models/ |
model | Standalone database-agnostic TypeScript entity interface. | src/models/<Name>.ts | |
route | r, c, controller | HTTP route endpoint definition. | src/http/<name>/route.ts |
service | s | Injectable service with pagination utilities. | src/http/<name>/service.ts |
schema | sc | Validation schemas with tex validators and pagination DTOs. | src/http/<name>/schema.ts |
boundary | b | Folder-level boundary middleware configuration. | src/http/<name>/boundary.ts |
cron | job | Scheduled cron background task. | src/cron/<name>.ts |
error | err | Global error handler fallback. | src/http/error.ts |
plugin | p | Reusable ExisJS plugin module. | src/plugins/<name>.ts |
middleware | m | Standalone middleware handler function. | src/middleware/<name>.ts |
test | t | Integration test file using node:test and exisjs/testing. | tests/<name>.test.ts |
exisjs routes
Inspects and displays the complete application routing table in formatted tabular output or raw JSON.
npx exisjs routes [options]Options
| Option | Type | Default | Description |
|---|---|---|---|
-e, --entry <file> | string | src/http/server.ts | Custom entry file path to discover routes from. |
-m, --method <method> | string | None | Filter endpoints by HTTP method (e.g. GET, POST). |
-f, --filter <keyword> | string | None | Filter endpoints by path, method, or source file keyword. |
--json | boolean | false | Output routes and middleware metadata in JSON format. |
exisjs test
Runs the test suite using the integrated Node.js test runner (node:test).
npx exisjs test [files...] [options]Arguments & Options
| Argument / Option | Type | Description |
|---|---|---|
[files...] | string[] | Specific test files or glob patterns to run. |
--watch | boolean | Watch for file changes and re-execute tests automatically. |
-u, --update | boolean | Update snapshot assertions. |
-e, --entry <file> | string | Custom entry file path to bootstrap before test execution. |
exisjs run
Executes standalone scripts, migration utilities, or third-party CLI tools with ExisJS .env files automatically loaded into process.env.
npx exisjs run <scriptOrCmd> [args...] [options]npx exisjs exec <scriptOrCmd> [args...] [options]Options
| Option | Type | Description |
|---|---|---|
-e, --env <file> | string | Path to a specific environment file to load. |
-m, --mode <mode> | string | Environment mode to load (e.g. production, staging, development). |
Examples
# Execute a TypeScript seed scriptnpx exisjs run src/database/seed.ts
# Run an external database CLI with ExisJS environment loadednpx exisjs run prisma migrate deploynpx exisjs run drizzle-kit pushexisjs console
Starts an interactive Node.js REPL environment loaded with the application context.
npx exisjs console [options]npx exisjs repl [options]Options
| Option | Type | Default | Description |
|---|---|---|---|
-e, --entry <file> | string | src/http/server.ts | Custom entry file to bootstrap REPL context. |
exisjs doctor
Runs an end-to-end diagnostic audit of the local project environment.
npx exisjs doctorDiagnostic Checks
- Runtime Environment: Validates Node.js version compatibility (Node.js 20+).
- Project Structure: Verifies
package.json,tsconfig.json, and application entry points. - Route Integrity: Audits
src/http/directory for naming conventions and orphan files.
exisjs info
Prints runtime environment details, including ExisJS version, Node.js version, platform, and operating system architecture.
npx exisjs infoexisjs exports
Lists all public subpath exports provided by the exisjs package.
npx exisjs exportsexisjs init
Initializes a new ExisJS project interactively in the current working directory.
npx exisjs init