The Neon CLI is a command-line interface that lets you manage Neon Serverless Postgres directly from the terminal. For the complete documentation, see Neon CLI.
- Node.js 18.0 or higher (for npm installation)
- macOS, Linux, or Windows operating system
Choose one of the following installation methods:
npm i -g neonctl
brew install neonctl
Download the latest binary file from our releases page.
You can upgrade your Neon CLI installation using the same method you used to install it:
npm
npm update -g neonctl
Homebrew
brew upgrade neonctl
Binary Download the latest binary file from our releases page and replace your existing binary.
There are two ways to authenticate with Neon:
neonctl auth
This command launches a browser window where you can authorize the Neon CLI to access your Neon account.
neonctl projects list --api-key <neon_api_key>
For information about obtaining a Neon API key, see Authentication in the Neon API Reference.
The Neon CLI supports autocompletion to enhance your productivity. To set it up:
- Generate the completion script:
neonctl completion
- Follow the instructions provided by the command to configure autocompletion for your shell.
For detailed instructions, see Neon CLI commands — completion.
Command | Subcommands | Description | Example |
---|---|---|---|
auth | Authenticate | neonctl auth |
|
projects | list , create , update , delete , get |
Manage projects | neonctl projects list |
ip-allow | list , add , remove , reset |
Manage IP Allow | neonctl ip-allow list |
me | Show current user | neonctl me |
|
branches | list , create , rename , add-compute , set-default , delete , get |
Manage branches | neonctl branches list |
databases | list , create , delete |
Manage databases | neonctl databases list |
roles | list , create , delete |
Manage roles | neonctl roles list |
operations | list |
Manage operations | neonctl operations list |
connection-string | Get connection string | neonctl connection-string |
|
set-context | Set context for session | neonctl set-context |
|
completion | Generate completion script | neonctl completion |
Global options can be used with any Neon CLI command:
Option | Description | Type | Default |
---|---|---|---|
-o, --output | Set output format (json , yaml , or table ) |
string | table |
--config-dir | Path to configuration directory | string | /home/<user>/.config/neonctl |
--api-key | Neon API key | string | "" |
--analytics | Manage analytics | boolean | true |
-v, --version | Show version number | boolean | - |
-h, --help | Show help | boolean | - |
-o, --output
neonctl me --output json # Get user info in JSON format neonctl projects list --output yaml # List projects in YAML format
-h, --help
neonctl --help # General help neonctl branches --help # Command-specific help neonctl branches create --help # Subcommand help
To run the CLI locally:
- Build the CLI:
npm run build
- For continuous development:
npm run watch
- Test local changes:
node dist <command> # Example: node dist branches --help
- Fork the repository and create your branch from
main
- Install dependencies:
npm install
- Make your changes and add tests if needed
- Update documentation as necessary
- Submit a pull request
For more detailed documentation, visit our Neon CLI Documentation.