ExisJS

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

OptionTypeDefaultDescription
-p, --port <port>number3000Port to listen on (overrides .env and exis.config.ts).
-H, --host <host>stringlocalhostHost address to bind to.
-e, --entry <file>stringsrc/http/server.tsCustom entry file path to bootstrap the application.
--forcebooleanfalseStart 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>.pid stops a second exisjs dev on 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; --force skips the check.

exisjs build

Compiles the TypeScript application to production JavaScript, performs type-checking, and generates static route manifests.

npx exisjs build [options]

Options

OptionTypeDefaultDescription
-o, --out-dir <dir>string.exis/serverOutput directory for compiled JavaScript assets.
--no-cleanbooleanfalseSkip cleaning the output directory prior to compilation.
--skip-env-checkbooleanfalseSkip build-time route and environment validation checks.
--dry-runbooleanfalseCompile and bundle without halting on missing environment variables.
-m, --mode <mode>stringproductionEnvironment 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

OptionTypeDefaultDescription
-a, --allbooleanfalseIn 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

OptionTypeDefaultDescription
-p, --port <port>number3000Port to listen on.
-H, --host <host>string0.0.0.0Host address to bind to.
-e, --entry <file>string.exis/server/src/http/server.jsCustom compiled entry file path.

exisjs migrate

Updates a project created before 0.10 to the current layout:

  • adds @exisjs/cli to devDependencies (and typescript, if the project has a tsconfig.json but did not list it);
  • lists the deployment lines to change, without editing the files: in the Dockerfile, a CMD through npm start, npm ci --omit=dev without --omit=optional, and exisjs build without --skip-env-check; in nixpacks.toml and Procfile, a start command through npm start.
npx exisjs migrate            # writes package.jsonnpx exisjs migrate --dry-run  # only shows the changes

Then 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

ArgumentDescription
<type>The schematic type to generate.
[name]The name of the feature or folder (required for all types except error).

Options

OptionTypeDefaultDescription
-n, --namedbooleanfalseNames generated files using the feature prefix (e.g. user.route.ts, user.schema.ts).
--oopbooleanfalseGenerates using Class-Based (OOP) decorators instead of Functional syntax.

Supported Schematics

SchematicAliasDescriptionOutput Location
crudresourceGenerates full 4-file CRUD slice (schema, service, route, model).src/http/<name>/ & src/models/
modelStandalone database-agnostic TypeScript entity interface.src/models/<Name>.ts
router, c, controllerHTTP route endpoint definition.src/http/<name>/route.ts
servicesInjectable service with pagination utilities.src/http/<name>/service.ts
schemascValidation schemas with tex validators and pagination DTOs.src/http/<name>/schema.ts
boundarybFolder-level boundary middleware configuration.src/http/<name>/boundary.ts
cronjobScheduled cron background task.src/cron/<name>.ts
errorerrGlobal error handler fallback.src/http/error.ts
pluginpReusable ExisJS plugin module.src/plugins/<name>.ts
middlewaremStandalone middleware handler function.src/middleware/<name>.ts
testtIntegration 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

OptionTypeDefaultDescription
-e, --entry <file>stringsrc/http/server.tsCustom entry file path to discover routes from.
-m, --method <method>stringNoneFilter endpoints by HTTP method (e.g. GET, POST).
-f, --filter <keyword>stringNoneFilter endpoints by path, method, or source file keyword.
--jsonbooleanfalseOutput 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 / OptionTypeDescription
[files...]string[]Specific test files or glob patterns to run.
--watchbooleanWatch for file changes and re-execute tests automatically.
-u, --updatebooleanUpdate snapshot assertions.
-e, --entry <file>stringCustom 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

OptionTypeDescription
-e, --env <file>stringPath to a specific environment file to load.
-m, --mode <mode>stringEnvironment 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 push

exisjs console

Starts an interactive Node.js REPL environment loaded with the application context.

npx exisjs console [options]npx exisjs repl [options]

Options

OptionTypeDefaultDescription
-e, --entry <file>stringsrc/http/server.tsCustom entry file to bootstrap REPL context.

exisjs doctor

Runs an end-to-end diagnostic audit of the local project environment.

npx exisjs doctor

Diagnostic 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 info

exisjs exports

Lists all public subpath exports provided by the exisjs package.

npx exisjs exports

exisjs init

Initializes a new ExisJS project interactively in the current working directory.

npx exisjs init