Skip to main content
Version: 4.0.0-preview

CLI Overview

The ExpressoTS CLI (@expressots/cli) is a single binary that covers the full lifecycle of an ExpressoTS application: scaffolding, code generation, development, build, production, containerization, CI/CD pipelines, cost estimation, and Studio integration.

Binary namesDescription
expressotsPrimary command
exShort alias, interchangeable with expressots

Requirements

RequirementVersion
Node.js>= 20.18.0
Package mgrnpm, yarn, pnpm, or bun (bun is unavailable on Windows for expressots new)

Installation

npm install -g @expressots/cli

You can also call it without installing globally via npx @expressots/cli .... Most templates pin @expressots/cli as a devDependency, so commands like npm run dev route through the local install.

Command catalogue

The CLI is grouped by what stage of the app's life it serves.

Scaffolding

CommandAliasPurposePage
new(none)Create a new project from a template (application / micro)new
generategScaffold a single resource (controller, use case, DTO, interceptor, event handler, guard, etc.)generate
create(none)Scaffold a standalone provider package skeletonproviders

Running

CommandAliasPurposePage
dev(none)Local dev server with tsx --watch. Optional --container flag for the Docker flow.running
build(none)Compile to JavaScript with tsc. Rewrites alias imports in opinionated projects.running
prod(none)Run the compiled output with noderunning
container-devcdev, docker-devCompose-based dev workflow (start, stop, attach, shell, status, logs).running

Dependencies

CommandPurposePage
addInstall an external provider (detects npm / yarn / pnpm via lockfile)providers
removeUninstall an external providerproviders
scriptsInteractively run any script from package.jsonscripts
studioLaunch ExpressoTS Studio; auto-installs @expressots/studio if missingstudio

Container & deployment

CommandAliasPurposePage
containerizecGenerate Dockerfiles, compose files, Kubernetes manifestscontainerize
profileprof, analyzeLint a Dockerfile or built image and emit optimization recommendationscontainerize
cicdci, pipelineGenerate CI/CD pipelines for GitHub Actions, GitLab CI, CircleCI, Jenkins, Bitbucket, Azurecicd
migratemig, migrationGenerate migration configurations between platforms (Heroku → Railway, Compose → K8s, etc.)migrate
costscost, pricingEstimate and compare cloud deployment costscosts
templatestplManage the CI/CD / Docker / K8s template cachetemplates

Diagnostics

CommandAliasPurposePage
infoiPrint OS, Node, CLI bundle version, and project info from package.jsoninfo
resourcesrPrint the table of all commands and generate schematics (cheat sheet)info
--help(none)yargs-generated help; works on every command (expressots <cmd> --help)(none)

Conventions

These apply across the CLI:

ConventionDetail
No global --versionThe CLI deliberately does not expose expressots --version. Use expressots info or npm list -g @expressots/cli.
expressots.config.ts is requiredFor dev, build, prod, and generate. The CLI walks up from cwd until it finds the file.
tsconfig.build.json with outDirRequired for build and prod. The CLI creates outDir if it doesn't exist.
Strict yargs modeUnknown flags or commands fail fast, no silent typos.
A subcommand is always requiredRunning expressots with no arguments prints the help and exits.
The run command was removedUse dev, build, or prod directly.
Path positional, not --module=expressots g controller auth/user post, not expressots g controller --module=auth user.

expressots.config.ts

Every project the CLI manages keeps its configuration here. Generated by expressots new:

import { ExpressoConfig, Pattern } from "@expressots/shared";

export const config: ExpressoConfig = {
scaffoldPattern: Pattern.KEBAB_CASE,
sourceRoot: "src",
entryPoint: "main",
opinionated: true,
scaffoldSchematics: {
controller: "useCases",
usecase: "useCases",
dto: "useCases",
module: "useCases",
provider: "providers",
entity: "entities",
middleware: "middleware",
interceptor: "interceptors",
event: "events",
handler: "events",
guard: "guards",
config: "config",
},
};

export default config;
FieldPurpose
sourceRootRoot the CLI scaffolds under (must be non-empty)
entryPointThe file name in sourceRoot/ (without .ts) that dev/prod boots
opinionatedWhen true, generate places resources in the scaffoldSchematics folders and build rewrites @alias/* imports to relative paths in the emitted JS
scaffoldPatternNaming convention for generated files: KEBAB_CASE (default), CAMEL_CASE, PASCAL_CASE, LOWER_CASE
scaffoldSchematicsPer-resource folder names. Custom folders are auto-added to tsconfig.json paths (and tsconfig.build.json in opinionated projects)

See Configuration File for the full surface.

Project layout the CLI assumes

my-app/
├── expressots.config.ts # CLI configuration
├── tsconfig.json # editor + dev tsconfig
├── tsconfig.build.json # has `compilerOptions.outDir`; used by `build` / `prod`
├── package.json
└── src/
├── main.ts # entryPoint; calls bootstrap(App)
├── app.ts # extends AppExpress
└── ... # generated into folders driven by scaffoldSchematics

Worked example

# 1. Scaffold a project with the application template, pnpm, and the API preset.
expressots new my-api --template application --package-manager pnpm --preset api

cd my-api

# 2. Scaffold a typed config file.
expressots g cfg app

# 3. Generate a full CRUD slice (controller + usecase + dto + module wiring).
expressots g s users/create post
expressots g s users/list get
expressots g s users/update put
expressots g s users/delete delete

# 4. Add an interceptor for response logging.
expressots g i Logging --priority 5

# 5. Add a domain event + handler.
expressots g ev UserCreated
expressots g h EmailWelcome --event UserCreated --priority 20

# 6. Run dev.
expressots dev

# 7. Build and run prod.
expressots build && expressots prod

Next