Skip to content

CLI

The HonestJS CLI (@honestjs/cli) scaffolds projects and generates files. Install it globally:

bash
bun add -g @honestjs/cli

Aliases: honestjs, honest, hnjs.

Commands

new

Create a new HonestJS project from a template.

bash
honestjs new [project-name]

Options:

OptionDescription
-t, --template <template>Template name (barebone, blank, mvc) or local path (./path, ~/path)
-p, --package-manager <manager>Package manager: bun, npm, yarn, pnpm
--typescriptUse TypeScript (default)
--no-typescriptSkip TypeScript
--eslintAdd ESLint configuration
--no-eslintSkip ESLint
--prettierAdd Prettier configuration
--no-prettierSkip Prettier
--dockerAdd Docker configuration
--no-dockerSkip Docker
--gitInitialize git repository
--no-gitSkip git initialization
--installInstall dependencies after creation
--no-installSkip dependency installation
-y, --yesSkip prompts and use defaults
--offlineUse cached templates only (no network)
--refresh-templatesForce refresh template cache before use

Examples:

bash
honestjs new my-app
honestjs new my-app -t mvc -y
honestjs new my-app --template barebone --package-manager pnpm
# Local templates (repo root or single template dir)
honestjs new my-app --template ./path/to/templates
honestjs new my-app -t ~/company/honest-templates -y

list

List available templates with optional filtering.

bash
honestjs list

Options:

OptionDescription
-j, --jsonOutput in JSON format
-c, --category <category>Filter by category
-t, --tag <tag>Filter by tag
-l, --local <path>List templates from a local path (repo root or single template)
--offlineUse cached templates only (no network)
--refresh-templatesForce refresh template cache before use

Examples:

bash
honestjs list
honestjs list --json
honestjs list --category app
honestjs list --tag minimal
honestjs list --local ./templates

info

Show CLI version, available templates, and environment info.

bash
honestjs info
honestjs info --local ./templates

Options:

OptionDescription
-l, --local <path>Show templates from a local path instead of remote

Displays:

  • CLI version
  • Runtime (Bun or Node.js)
  • Templates repository
  • Available templates
  • Node.js version, platform, architecture
  • Useful links (docs, GitHub, templates, issues)

doctor

Diagnose environment: runtime, git, package managers, template cache, and network.

bash
honestjs doctor

Checks:

  • Runtime – Bun or Node.js (Node >= 18 required)
  • Git – Whether git is installed
  • Package managers – bun, npm, yarn, pnpm
  • Templates – Whether template cache exists (run honestjs list or new first)
  • Network – GitHub API reachability

generate

Generate files from schematics. Alias: g.

bash
honestjs generate <schematic> <name>
honestjs g <schematic> <name>

Schematics:

SchematicAliasDescription
controllercGenerate a controller
servicesGenerate a service
modulemGenerate a module
viewvGenerate a view
middlewarec-mGenerate a middleware
guardc-gGenerate a guard
filterc-fGenerate a filter
pipec-pGenerate a pipe

Options:

OptionDescription
-p, --path <path>Specify the path where the file should be created
-f, --flatCreate files in a flat structure
--forceOverwrite existing files without prompting
--dry-runShow what would be created without writing files
--skip-importSkip importing the generated item
--exportExport the generated item

Examples:

bash
honestjs g controller user
honestjs g service user
honestjs g module users
honestjs g view users
honestjs g middleware logger
honestjs g guard auth
honestjs g filter notfound
honestjs g pipe parseInt
honestjs g controller user --force
honestjs g controller user --dry-run

Output locations:

  • controller usermodules/users/users.controller.ts
  • service usermodules/users/users.service.ts
  • module usersmodules/users/users.module.ts
  • view usersmodules/users/users.view.tsx
  • middleware loggercomponents/logger/logger.middleware.ts
  • guard authcomponents/auth/auth.guard.ts
  • filter notfoundcomponents/notfound/notfound.filter.ts
  • pipe parseIntcomponents/parseint/parseint.pipe.ts

Released under the MIT License.