Documentation previewThese docs are actively being built. Some pages may change as the framework and examples are finalized.
Skip to content

CLI Reference

This page lists common GoForj CLI commands and generated App command patterns.

Use workflow pages for full context.

Project Commands

CommandPurpose
forj newCreate a new GoForj Project through the interactive wizard.
forj buildRun generation, Wire, API indexing, then go build.
forj build:api-indexBuild 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 devRun App development lifecycles and custom watches from .goforj.yml.
forj generateRefresh 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:

bash
forj marketplace route:list
forj marketplace build
forj marketplace worker

The 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.

PreferredCanonicalPurpose
apprunRun enabled App runtimes together.
apihttp:serveRun the HTTP runtime.
workerqueue:workRun queue workers.
schedulerschedule:runRun the scheduler runtime.
route:listroute:listList registered HTTP routes.
migratemigrateRun database migrations.
migrate:rollbackmigrate:rollbackRoll back recent migrations.
dbdb:shellOpen a database shell for a configured connection.
cachecache:shellOpen a Redis shell for a configured cache store.
make:eventmake:eventGenerate an event type.
make:jobmake:jobGenerate a queue job and wire it into jobs.
make:schedulemake:scheduleGenerate a scheduled task and wire it into the scheduler.
make:modelmake:modelGenerate a model and repository when database support is enabled.

Examples:

bash
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 worker

For 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:

CommandPurpose
forj backup:planShow the database and storage backup plan.
forj backup:createCreate a native manifest-backed backup set.
forj backup:listList 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-runPrint the restore plan without changing data.
forj backup:restore --from <source> --confirm restore-productionPerform an explicitly confirmed destructive restore.
forj backup:pruneRemove completed sets outside the retention policy.
forj backup:statusReport the newest local backup and its age.

Prefix the command to operate on a named App:

bash
forj marketplace backup:plan
forj marketplace backup:create

Use --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:

bash
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:

bash
forj cache
forj cache sessions
forj cache --method compose
forj cache --print
forj cache --exec "PING"
forj cache -- PING
forj cache sessions -- GET user:1

App and resource generation are project-level forj commands:

bash
forj make:app marketplace
forj make:controller users
forj make:command reports:reconcile
forj make:migration create_users

To register generated code into a named app, prefix the command:

bash
forj marketplace make:controller checkout
forj marketplace make:job sync-catalog --queue sync
forj marketplace make:model order

The 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:

bash
forj make:controller users --remove
forj make:command reports:reconcile --remove
forj make:migration create_users --remove

Use --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:

CommandPurpose
forj test:render -sRender a disposable App, build it, and run tests.
forj test:integrationRun framework and rendered integration suites.
forj test:openapiValidate generated OpenAPI behavior.