nb init

Initialize the current workspace so coding agents can connect to and use NocoBase. nb init can connect an existing app or install a new app from Docker, npm, or Git.

Usage

nb init [flags]

Notes

nb init supports three prompt modes:

  • Default mode: fill in setup details step by step in the terminal.
  • --ui: open a local browser form for the setup wizard.
  • --yes: skip prompts and use flags plus defaults. This mode requires --env <envName> and creates a new local app.

By default, nb init installs or updates NocoBase AI coding skills during initialization or resume. Use --skip-skills to skip this step when skills are managed separately, or when running in CI or offline environments.

If initialization is interrupted after env configuration has been saved, resume it with:

nb init --env app1 --resume

Parameters

ParameterTypeDescription
--yes, -ybooleanSkip prompts and use flags plus defaults
--env, -estringEnv name for this setup; required with --yes and --resume
--uibooleanOpen the browser-based setup wizard; cannot be used with --yes
--verbosebooleanShow verbose command output
--skip-skillsbooleanSkip installing or updating NocoBase AI coding skills during init
--ui-hoststringLocal service bind address for --ui, default 127.0.0.1
--ui-portintegerLocal service port for --ui; 0 means auto-assign
--localestringCLI prompt and UI language: en-US or zh-CN
--api-base-url, -ustringNocoBase API URL, including the /api prefix
--auth-type, -astringAuthentication type: token or oauth
--access-token, -tstringAPI key or access token used with token authentication
--resumebooleanReuse saved workspace env config and continue initialization
--lang, -lstringLanguage for the installed NocoBase app
--force, -fbooleanReconfigure an existing env and replace conflicting runtime resources when needed
--app-root-pathstringLocal npm/Git app source directory, default ./<envName>/source/
--app-portstringLocal app port, default 13000; --yes mode auto-selects an available port
--storage-pathstringDirectory for uploaded files and managed database data, default ./<envName>/storage/
--root-usernamestringInitial admin username
--root-emailstringInitial admin email
--root-passwordstringInitial admin password
--root-nicknamestringInitial admin nickname
--builtin-db, --no-builtin-dbbooleanWhether to create a CLI-managed built-in database
--db-dialectstringDatabase dialect: postgres, mysql, mariadb, or kingbase
--builtin-db-imagestringBuilt-in database container image
--db-hoststringDatabase host
--db-portstringDatabase port
--db-databasestringDatabase name
--db-userstringDatabase user
--db-passwordstringDatabase password
--fetch-sourcebooleanDownload app files or pull the Docker image before installation
--source, -sstringHow to obtain NocoBase: docker, npm, or git
--version, -vstringVersion parameter: npm version, Docker image tag, or Git ref
--replace, -rbooleanReplace the target directory if it already exists
--dev-dependencies, -DbooleanWhether npm/Git installs devDependencies
--output-dir, -ostringDownload target directory, or directory for the Docker tarball
--git-urlstringGit repository URL
--docker-registrystringDocker image repository name without tag
--docker-platformstringDocker image platform: auto, linux/amd64, or linux/arm64
--docker-save, --no-docker-savebooleanWhether to save the pulled Docker image as a tarball
--npm-registrystringRegistry used for npm/Git downloads and dependency installation
--build, --no-buildbooleanWhether to build after npm/Git dependency installation
--build-dtsbooleanWhether to generate TypeScript declaration files during npm/Git build

Examples

nb init
nb init --ui
nb init --env app1 --yes
nb init --env app1 --yes --skip-skills
nb init --env app1 --resume
nb init --env app1 --resume --skip-skills
nb init --env app1 --yes --source docker --version alpha
nb init --env app1 --yes --source npm --version alpha --app-port 13080
nb init --env app1 --yes --source git --version fix/cli-v2
nb init --ui --ui-port 3000