CLI Usage & Installation
The MoroJS CLI is published as @morojs/cli. The recommended way to use it is with npx, which requires no installation. You can also install it globally if you prefer.
Prerequisites
- Node.js 18+ installed
- npm, yarn, or pnpm package manager
- Git (for version control)
- TypeScript knowledge (recommended)
Usage
Run with npx (Recommended)
No install needed
bash
This is the standard way to use the MoroJS CLI. Anywhere you see a command in the docs, you can prefix it with npx and run it directly — no install required.
Two ways to run init
Interactive mode
Run with no flags to get guided prompts for every option. Hit Enter on any prompt to take the recommended default.
No flags
bash
Non-interactive mode
Pass any flag (or --fast) and the CLI skips every prompt. Defaults fill in the rest:runtime=node,validation=zod,database=none.
Any flag, or --fast
bash
Global Installation (Optional)
If you use the CLI frequently, install it globally so you can call it asmorojs-cli (or the short aliasmoro) directly:
npm
bash
yarn
bash
pnpm
bash
Once installed you can run any command asmoro <command> instead ofnpx @morojs/cli <command>.
Pick a Package Manager for Your Project
init auto-detects the package manager that invoked the CLI (via npm_config_user_agent), so pnpm dlx @morojs/cli init my-apigenerates pnpm-flavoured scripts and runs pnpm installfor you. Override explicitly with --package-manager:
Generate a pnpm project
bash
Generate a yarn project
bash
Why no bun? MoroJS targets the Node.js runtime (it depends on uWebSockets.js' native N-API bindings). Bun-as-runtime isn't officially supported yet, so we don't advertise it as an option here.
Verify It Works
Check version
bash
View help
bash
Success!
If you see the version number and help output, the CLI is ready to use.
Updating the CLI
Keep your CLI up to date to access the latest features and improvements:
npm
bash
yarn
bash
pnpm
bash
Troubleshooting
Common Issues
Permission errors on macOS/Linux
If you get permission errors, you may need to use sudo or configure npm to use a different directory:
Fix permissions
bash
Command not found
If the command is not found after installation, check that your global npm bin directory is in your PATH:
Check npm path
bash
Node.js version issues
Ensure you're using Node.js 18 or higher. Check your version with:
Check Node version
bash