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

# Commands

> List of all commands available

## Creating an app with ShardCloud CLI

Make sure you are [authenticated](/cli/auth) before proceeding. First, in your app directory, create the [.shardcloud](config) file.

1. After creating the .shardcloud file, use the command `shardcloud create`
2. Done
3. Use `shardcloud commit` to commit your current changes to the app whenever you want to update

## Commands available

<Note>
  Commands that interact with applications can be used with an `<app_id>`
  argument. For example: `shardcloud restart <app_id>`. If you omit the
  `<app_id>` and you're not in a directory with a `.shardcloud` file, the CLI
  will prompt you with an interactive selection menu showing all your
  applications. Use the arrow keys to navigate and press Enter to select.
</Note>

| Command | Arg        | Description                                             |
| ------- | ---------- | ------------------------------------------------------- |
| me      | -          | Print the current logged-in user                        |
| backup  | `<app_id>` | Manage app backups                                      |
| commit  | `<app_id>` | Create a commit in the current application              |
| create  | -          | Create an application with the current .shardcloud file |
| login   | -          | Log in to Shard Cloud                                   |
| logout  | -          | Log out                                                 |
| logs    | `<app_id>` | View the logs of your applications                      |
| status  | `<app_id>` | View the status of your applications                    |
| delete  | `<app_id>` | Delete your applications                                |
| start   | `<app_id>` | Start a stopped app                                     |
| stop    | `<app_id>` | Stop a running app                                      |
| restart | `<app_id>` | Restart a running app                                   |
| restore | `<app_id>` | Restore a backup                                        |

***

## Using Commands with Arguments

Commands that interact with applications can be used in three ways:

### Method 1: Using App ID

Specify the application ID directly:

```bash theme={null}
shardcloud restart 550e8400-e29b-41d4-a716-446655440000
shardcloud logs 550e8400-e29b-41d4-a716-446655440000
shardcloud status 550e8400-e29b-41d4-a716-446655440000
shardcloud backup 550e8400-e29b-41d4-a716-446655440000
shardcloud start 550e8400-e29b-41d4-a716-446655440000
shardcloud stop 550e8400-e29b-41d4-a716-446655440000
shardcloud delete 550e8400-e29b-41d4-a716-446655440000
shardcloud restore 550e8400-e29b-41d4-a716-446655440000
```

### Method 2: From Application Directory

If you're in a directory that contains a `.shardcloud` file, you can omit the `<app_id>` and the CLI will automatically use the application configured in that file:

```bash theme={null}
# Navigate to your app directory
cd /path/to/your/app

# Use commands without app_id (uses current directory's app)
shardcloud restart
shardcloud logs
shardcloud status
shardcloud commit
shardcloud backup
```

<Note>
  The `commit` command always uses the current directory's `.shardcloud` file,
  so it doesn't require an `<app_id>` argument.
</Note>

### Method 3: Interactive Selection

If you omit the `<app_id>` and you're not in a directory with a `.shardcloud` file, the CLI will prompt you with an interactive selection menu:

```bash theme={null}
# Run command without app_id and without .shardcloud file
shardcloud restart

# You'll see an interactive menu:
# ? Select an application:
#   > My Discord Bot (550e8400-e29b-41d4-a716-446655440000)
#     My Web App (6ba7b810-9dad-11d1-80b4-00c04fd430c8)
#     My API Server (6ba7b811-9dad-11d1-80b4-00c04fd430c8)
#
# Use ↑/↓ arrow keys to navigate, Enter to select
```

<Note>
  Use the **arrow keys** (↑/↓) to navigate through the list of applications and
  press **Enter** to select the desired application.
</Note>

### Examples

**Restart a specific application:**

```bash theme={null}
shardcloud restart 550e8400-e29b-41d4-a716-446655440000
```

**View logs for an application:**

```bash theme={null}
shardcloud logs 550e8400-e29b-41d4-a716-446655440000
```

**Create a backup before deploying:**

```bash theme={null}
shardcloud backup 550e8400-e29b-41d4-a716-446655440000
shardcloud commit 550e8400-e29b-41d4-a716-446655440000
```

**Check application status:**

```bash theme={null}
shardcloud status 550e8400-e29b-41d4-a716-446655440000
```

**From your application directory:**

```bash theme={null}
cd ~/my-app
shardcloud restart  # Uses app from .shardcloud in current directory
shardcloud logs     # Uses app from .shardcloud in current directory
shardcloud commit   # Always uses current directory
```

**Using interactive selection:**

```bash theme={null}
# Run from any directory without .shardcloud file
shardcloud restart
# CLI will show an interactive menu with all your applications
# Navigate with arrow keys and press Enter to select
```
