Use the CLI
The Northflank CLI client allows you to interact with Northflank via the command line. The CLI client can be installed using either NPM or Yarn:
npm i -g @northflank/cli, or
yarn global add @northflank/cli
Once installed, authenticate yourself using the
northflank login command. You will need to create an API token in your account/team settings in the Northflank application . If you are a member of a team an API token template must have been created by a member with permissions.
The CLI client is fully interactive, meaning that it will ask for any parameters needed along the way. However, you always have the option to pass in any required parameters in your commands. For example, after entering the command
northflank get service details you will be prompted to enter a project ID and a service ID. You can achieve the same result in a single step by using the command
northflank get service details --project <PROJECT_ID> --service <SERVICE_ID> .
Contexts allow you to separate different Northflank accounts and preferences when using the CLI client.
For example, you may have a context for your personal Northflank account, and a different context for a team account.
Contexts are created with the
northflank login command. You will be guided through the process of naming the context and supplying a token, or you can pass these values in as arguments. See
northflank login --help for the full list of options. Once logged in, the active context will be switched automatically.
Users can generate a personal API token in their account settings in the Northflank application . Team members can generate an API token in that team's settings, provided an API token template has been created by a member with permissions.
Once created, contexts can be viewed with
northflank context list and switched to with
northflank context use <CONTEXT_NAME>.
To set a default project or service within a context, you can use the command
northflank context use project|service <PROJECT_ID|SERVICE_ID> and you will no longer need to supply a project/service in your commands to use the defaults.
When creating resources on Northflank, you can do so interactively, or you can supply a resource definition. This can be done using the
-i option followed by a JSON/YAML string, or by using the
-f option followed by the path to a JSON/YAML file containing the definition.
The resource definitions are equivalent to the API request bodies you will find in this documentation.
You can get help at any time by using the
--help flag. This includes getting help with specific commands, for example
northflank create project --help will return helpful information about creating a project.
To see a handy tree view of all possible commands, you can run
There are a few CLI-specific commands that do not have an API equivalent, and therefore do not appear alongside API endpoints in this documentation.
These commands are:
- Port-forwarding for Northflank services and addons. For example
northflank forward serviceallows you to select a service and port forward it so it is available from your localhost.