Skip to content

nika-cli start

Run a Nika application in normal or watch mode.

nika-cli start [file-or-dir]
nika-cli start -a <app>
nika-cli start --watch

Choosing what runs

With no arguments the command runs the [build] cmd from .nika.toml. In a microservice workspace that is the default app's main.go, so you never have to remember each service's path.

Precedence, highest first:

  1. an explicit path argument
  2. the -a / --app flag
  3. workspace.default_app in .nika.toml
  4. an interactive prompt, when the workspace has several apps and no default
nika-cli start                        # the default app
nika-cli start -a micro-grpc          # one specific service
nika-cli start ./apps/api/main.go     # an explicit path
▶️  Starting micro-grpc: go run ./apps/micro-grpc/main.go
✅ SQL Database connected (sqlite3)

Partial app names are accepted when unambiguous, so -a grpc resolves to micro-grpc. Set the default once with:

nika-cli app use api

See Workspaces and nika-cli app.

Normal mode

Normal mode runs the resolved command once in root and returns when the process exits:

nika-cli start
nika-cli start -a api

Watch mode

Watch mode runs the same command and restarts it when an included file changes:

nika-cli start --watch
nika-cli start -a micro-grpc --watch

The default watch settings are:

  • Root: .
  • Command: go run . in a single-app project, the app's main.go in a workspace
  • Delay: 1000 milliseconds
  • Included extension: .go
  • Excluded directories: docs, tmp, vendor, testdata, .git, cache
  • Excluded file pattern: ^\\.

Watch mode supports pre_cmd, post_cmd, environment variables, included extensions, excluded files, excluded directories, and exclude regular expressions — taken from the root [build] section merged with the selected app's [apps.<name>] override. See Configuration.

Press Ctrl+C to stop; the running process is terminated before the CLI exits.