> ## 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.

# Managing Workspaces

Workspaces in Nile help you organize your databases and resources. This guide covers the commands available for managing workspaces.

```bash theme={null}
nile workspace [command] [options]
```

Available commands:

* `list` - View all available workspaces
* `show` - Display current workspace details

## Setting Active Workspace

Before using workspace commands, you can set your active workspace:

```bash theme={null}
nile config --workspace <workspaceName>
```

You can also use the `NILE_WORKSPACE` environment variable:

```bash Environment Variable theme={null}
export NILE_WORKSPACE=production
```

## Listing Workspaces

The `list` command shows all workspaces you have access to.

```bash theme={null}
nile workspace list [options]
```

### Options

| Flag       | Description                      | Default |
| ---------- | -------------------------------- | ------- |
| `--format` | Output format (human, json, csv) | human   |

### Examples

```bash List Examples theme={null}
# Basic list
nile workspace list

# JSON format
nile workspace list --format json

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

<img height="100" src="https://mintcdn.com/nile/SZ6JYQiPYP1_QgSP/images/nileworkspacelist.png?fit=max&auto=format&n=SZ6JYQiPYP1_QgSP&q=85&s=1c7d3a00f0125be1bded1f79a0e0c494" data-path="images/nileworkspacelist.png" />

## Showing Current Workspace

The `show` command displays details about your current workspace.

```bash theme={null}
nile workspace show [options]
```

### Options

| Flag       | Description                      | Default |
| ---------- | -------------------------------- | ------- |
| `--format` | Output format (human, json, csv) | human   |

### Examples

```bash Show Examples theme={null}
# Show current workspace
nile workspace show

# JSON format
nile workspace show --format json

# CSV format
nile workspace show --format csv
```

### Sample Output

<img height="100" src="https://mintcdn.com/nile/SZ6JYQiPYP1_QgSP/images/nileworkspaceshow.png?fit=max&auto=format&n=SZ6JYQiPYP1_QgSP&q=85&s=9022226cee43b7dfcbf3823c5b22aa86" data-path="images/nileworkspaceshow.png" />

## Common Workflows

### Setting Up Development Environment

```bash Development Setup theme={null}
# 1. List available workspaces
nile workspace list

# 2. Set active workspace
nile config --workspace development

# 3. Verify workspace
nile workspace show

# 4. List databases in workspace
nile db list
```

### Workspace Verification

```bash Verification Workflow theme={null}
# 1. Check current workspace
nile workspace show

# 2. List all workspaces
nile workspace list

# 3. Verify access
nile db list  # Lists databases in current workspace
```

## Common Issues

### No Active Workspace

When no workspace is selected:

```bash No Workspace theme={null}
# Try command without workspace
nile db list
Error: No workspace specified

# Solution: Set workspace
nile config --workspace development
```

### Authentication Issues

When authentication is required:

```bash Auth Issues theme={null}
# Authentication error
nile workspace list
Error: Authentication required

# Solution: Login first
nile connect login
```

### Invalid Workspace

When workspace doesn't exist:

```bash Invalid Workspace theme={null}
# Try invalid workspace
nile config --workspace nonexistent
Error: Workspace 'nonexistent' not found

# Solution: List available workspaces
nile workspace list
```

## Best Practices

1. **Environment Variables**: Use environment variables for different contexts:

   ```bash theme={null}
   # Development
   export NILE_WORKSPACE=development

   # Production
   export NILE_WORKSPACE=production
   ```

2. **Configuration File**: Set default workspace in configuration:

   ```bash theme={null}
   nile config --workspace default-workspace
   ```

3. **Verification**: Always verify workspace before critical operations:
   ```bash theme={null}
   nile workspace show
   ```

## Related Commands

* `nile config` - Configure CLI settings
* `nile db list` - List databases in workspace
* `nile connect` - Authentication management
* `nile tenants` - Tenant management within workspace
