CLI Reference
This page lists common GoForj CLI commands and generated App command patterns.
Use workflow pages for full context.
Project Commands
| Command | Purpose |
|---|---|
forj new | Create a new GoForj Project through the interactive wizard. |
forj build | Run generation, Wire, API indexing, then go build. |
forj build:api-index | Build the active App's API index, diagnostics, and OpenAPI artifacts. |
forj run [<app-command>] | Build an exact temporary App binary, start it with the optional command, then publish prepared API artifacts after the process-start boundary. |
forj dev | Run App development lifecycles and custom watches from .goforj.yml. |
forj generate | Refresh generated component code and derived files. |
forj make:app <name> | Create a named app in the current Project. |
forj make:controller <name> | Generate an HTTP controller and wire it into HTTP. |
forj make:command <name> | Generate an application command and wire it into the App command tree. |
forj make:migration <name> | Generate migration files for supported database drivers. |
Inside a generated Project, forj <command> is the normal default-app development surface. Native GoForj commands take precedence. If no native command matches, GoForj delegates to the default app through the same source-aware path as forj run <command>.
Named apps use an app prefix:
forj marketplace route:list
forj marketplace build
forj marketplace workerThe prefix is part of the ergonomics. It selects the active app for generated App commands and app-aware native commands without forcing you to change directories or pass an --app flag.
Use forj run <command> when you want to force App command execution explicitly, especially for scripts or command names that collide with native GoForj commands. Use ./bin/app <command> for the built binary and deployment/runtime process supervision.
build:api-index --strict rejects warnings as well as errors. Complete build and run commands use --api-index-strict. See API Index for build-tag and publication behavior.
Common App Commands
Run these as forj <command> during development or directly through ./bin/app <command> after build. For named apps, use forj <app> <command> or ./bin/<app> <command>.
Prefer the short aliases in day-to-day commands. The canonical command names remain available.
| Preferred | Canonical | Purpose |
|---|---|---|
app | run | Run enabled App runtimes together. |
api | http:serve | Run the HTTP runtime. |
worker | queue:work | Run queue workers. |
scheduler | schedule:run | Run the scheduler runtime. |
route:list | route:list | List registered HTTP routes. |
migrate | migrate | Run database migrations. |
migrate:rollback | migrate:rollback | Roll back recent migrations. |
db | db:shell | Open a database shell for a configured connection. |
cache | cache:shell | Open a Redis shell for a configured cache store. |
make:event | make:event | Generate an event type. |
make:job | make:job | Generate a queue job and wire it into jobs. |
make:schedule | make:schedule | Generate a scheduled task and wire it into the scheduler. |
make:model | make:model | Generate a model and repository when database support is enabled. |
Examples:
forj app
forj api
forj worker
forj scheduler
forj route:list
forj db
forj cache
forj make:job reports:generate
forj make:schedule reports:daily --every 24h
./bin/app
./bin/app run
./bin/app api
./bin/app worker
./bin/app scheduler
./bin/app db
./bin/app cache
forj marketplace route:list
./bin/marketplace workerFor runtime-capable Apps, bare ./bin/app selects run; CLI-only binaries print root help when no command is supplied. Passing --help or an explicit command retains normal CLI behavior.
These reach the generated App command surface. Short command names use Kong aliases.
Available commands depend on selected components.
Backup Commands
Backup commands are framework-owned operator commands. They use the selected App's resource contract and environment:
| Command | Purpose |
|---|---|
forj backup:plan | Show the database and storage backup plan. |
forj backup:create | Create a native manifest-backed backup set. |
forj backup:list | List completed local or configured remote backup sets. |
forj backup:verify --from <source> | Verify the manifest and every artifact checksum. |
forj backup:restore --from <source> --dry-run | Print the restore plan without changing data. |
forj backup:restore --from <source> --confirm restore-production | Perform an explicitly confirmed destructive restore. |
forj backup:prune | Remove completed sets outside the retention policy. |
forj backup:status | Report the newest local backup and its age. |
Prefix the command to operate on a named App:
forj marketplace backup:plan
forj marketplace backup:createUse --resource to select one database or storage resource. backup:create --portable and backup:restore --portable provide database-neutral SQL transfer when a same-driver native restore is not appropriate.
See Backup and Restore before automating or performing a restore.
Database shell examples:
forj db
forj db analytics
forj db --method compose
forj db --print
forj db --exec "select count(*) from users"
forj db -- --batch -e "select count(*) from users"
forj db analytics -- -c "select count(*) from events"Cache shell examples:
forj cache
forj cache sessions
forj cache --method compose
forj cache --print
forj cache --exec "PING"
forj cache -- PING
forj cache sessions -- GET user:1App and resource generation are project-level forj commands:
forj make:app marketplace
forj make:controller users
forj make:command reports:reconcile
forj make:migration create_usersTo register generated code into a named app, prefix the command:
forj marketplace make:controller checkout
forj marketplace make:job sync-catalog --queue sync
forj marketplace make:model orderThe prefix chooses the registration files. forj marketplace make:controller checkout creates internal/checkout/controller.go, then updates app/marketplace/routes.go and app/marketplace/wire/inject_http_controllers_app.go; unprefixed forj make:controller users creates internal/users/controller.go, then updates the default app's app/routes.go and app/wire/inject_http_controllers_app.go.
File-generating make commands support --open / -o to open the generated file and --no-open to suppress opening. See Opening Generated Files for automatic editor detection and FORJ_MAKE_OPEN configuration.
Make commands also support --remove to delete the generated file or resource config and undo the wiring that the command manages:
forj make:controller users --remove
forj make:command reports:reconcile --remove
forj make:migration create_users --removeUse --dry-run with --remove to preview the changes. See Make Commands for the command-by-command removal behavior.
Maintainer Commands
These are mainly for framework contributors:
| Command | Purpose |
|---|---|
forj test:render -s | Render a disposable App, build it, and run tests. |
forj test:integration | Run framework and rendered integration suites. |
forj test:openapi | Validate generated OpenAPI behavior. |
