> ## Documentation Index
> Fetch the complete documentation index at: https://thenile.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Command line interface for managing Nile databases

<img height="200" noZoom src="https://mintcdn.com/nile/SZ6JYQiPYP1_QgSP/images/intro-cli.gif?s=1ffdfd1e27205e9aad715f735dcd1c1e" data-path="images/intro-cli.gif" />

## Installation

```bash Terminal Installation theme={null}
# Using npm (recommended)
npm install -g niledatabase

# Using yarn
yarn global add niledatabase

# Using bun
bun install -g niledatabase
```

## Getting Started with Nile CLI

Nile CLI is a powerful command-line tool that helps you manage your Nile databases directly from your terminal. With Nile CLI, you can:

* Create and manage databases across multiple regions
* Handle multi-tenant applications with built-in tenant management
* Connect to your databases using standard PostgreSQL tools
* Manage workspaces and configurations

The code is available on [Github](https://github.com/niledatabase/cli). You are welcome to contribute to the project.

```bash Quick Start theme={null}
# Verify installation
nile --version

# Login to Nile
nile connect login

# List your databases
nile db list
```

## Authentication

There are three ways to authenticate with Nile:

1. **Browser-based Authentication** (Recommended)
2. **API Key Authentication**
3. **Environment Variables**

```bash Authentication Methods [expandable] theme={null}
# 1. Browser-based Authentication
nile connect login

# 2. API Key Authentication
nile --api-key YOUR_API_KEY db list
# or save it in config
nile config --api-key YOUR_API_KEY

# 3. Environment Variables
export NILE_API_KEY=YOUR_API_KEY
nile db list
```

## Basic Configuration

Before using the CLI, you should set up your workspace and default database:

```bash Basic Setup {2-3} theme={null}
# Set your workspace
nile config --workspace your-workspace

# Set your default database
nile config --db your-database

# Verify your configuration
nile config
```

## Output Formats

The CLI supports multiple output formats for easy integration with other tools:

```bash Output Examples theme={null}
# Human-readable format (default)
nile db list

# JSON format
nile --format json db list

# CSV format
nile --format csv db list
```

## Platform Requirements

The CLI requires:

* Node.js v16 or later
* npm, yarn, or bun package manager
* PostgreSQL command line tools (for database connections)

```bash Version Check Commands theme={null}
# Check Node.js version
node --version

# Check npm version
npm --version

# Check PostgreSQL tools
psql --version
```

## Common Workflows

Here are some common workflows to get you started:

### Setting Up a New Database

```bash Database Setup Example {3} theme={null}
# List available regions
nile db regions

# Create a new database
nile db create --name mydb --region AWS_US_WEST_2

# Connect to your database
nile db psql --name mydb
```

### Managing Tenants

```bash Tenant Management Examples [expandable] theme={null}
# Create a new tenant
nile tenants create --name "My Tenant"

# List all tenants
nile tenants list

# Update a tenant
nile tenants update --id tenant-123 --new_name "Updated Name"

# Delete a tenant
nile tenants delete --id tenant-123

# Show tenant details
nile tenants show --id tenant-123
```

## Getting Help

The CLI includes comprehensive help for all commands:

```bash Help Examples theme={null}
# Show general help
nile --help

# Show help for specific command
nile db --help

# Show help for subcommand
nile tenants create --help
```

## Debugging

When things go wrong, use the debug flag for detailed output:

```bash Debug Commands {2,5} theme={null}
# Enable debug output
nile --debug db list

# Check connection status
nile connect status --debug

# View configuration
nile config
```
