CLI
The Dolph CLI is an essential tool for initializing, developing, and maintaining DolphJS applications. Now completely rewritten in Rust for blazing-fast performance, it automates repetitive tasks such as generating boilerplate code for controllers, services, and components instantly.
Installation
Section titled “Installation”You can install the Dolph CLI globally using your preferred package manager. pnpm is highly recommended.
pnpm add -g @dolphjs/cliBasic Commands
Section titled “Basic Commands”dolph new <project-name>
Section titled “dolph new <project-name>”Scaffolds a new DolphJS project. It sets up the directory structure, handles package manager integrations, and generates a base dolph_config.yaml and entry point based on interactive prompts.
dolph new my-appYou can also use . to generate the project in your current directory:
dolph new .dolph generate
Section titled “dolph generate”Generates new files based on specific options. This is incredibly useful for maintaining a consistent architecture without manually creating and wiring classes.
dolph generate [OPTIONS]Available Generation Flags:
Section titled “Available Generation Flags:”| Flag | Full Option | Description |
|---|---|---|
-a |
--all <NAME> |
Generates all DolphJS files for the named parameter (Controller, Service, Model, etc.) |
-c |
--controller <NAME> |
Generates a DolphJS controller file |
-d |
--dto <NAME> |
Generates a DolphJS dto file |
-e |
--entity <NAME> |
Generates a DolphJS entity file |
-i |
--input <NAME> |
Generates a DolphJS input file |
-k |
--socket <NAME> |
Generate a DolphJS socket service and component |
-m |
--model <NAME> |
Generates a DolphJS models file |
-r |
--route <NAME> |
Generates a DolphJS routes file |
-s |
--service <NAME> |
Generates a DolphJS service file |
-v |
--resolver <NAME> |
Generates a DolphJS resolver file |
-y |
--component <NAME> |
Generates a DolphJS spring component file |
Generating a Full Feature
Section titled “Generating a Full Feature”Instead of generating individual files, you can generate everything required for a domain feature at once.
dolph generate --all users# ordolph generate -a usersThis typically generates a bundled controller, service, model, and routes file for that specific domain depending on your architectural choice.
Generating Individual Files
Section titled “Generating Individual Files”If you only need a specific file:
dolph generate --controller authdolph generate --service authDevelopment & Production
Section titled “Development & Production”The CLI also comes packed with native commands to run and build your DolphJS projects!
dolph watch
Section titled “dolph watch”Starts the DolphJS server in development mode with hot-reloading enabled.
dolph watchdolph build
Section titled “dolph build”Builds your DolphJS TypeScript project into a JavaScript project optimized for production.
dolph builddolph start
Section titled “dolph start”Starts the compiled DolphJS server in production mode.
dolph start