# Instances

Source: https://docs.myhub.host/instances

## Deploy a staging copy

From your app's project folder:

```sh
hub deploy --instance staging
```

Hub creates a separate instance and prints its URL. Production stays unchanged.

To set variables before its first deployment, create an empty instance of an existing app with `hub app my-app instance create staging`, then [set its environment](https://docs.myhub.host/environment) using `my-app/staging`. Deploy to it with `hub deploy --name my-app --instance staging`. The separate create command is optional when deploying directly.

## Work with staging

List the app's instances:

```sh
hub app my-app instance list
```

Use `app/instance` in app commands:

```sh
hub app my-app/staging open
hub app my-app/staging logs
```

Each instance has its own releases, variables, access settings, and volumes. Staging does not copy production data. An [app invitation](https://docs.myhub.host/access#invite-someone-to-one-app) grants access across the app's instances.

An app name alone targets `prod` for operations such as logs and status. &#x2A;*Deletion is different:** `hub app my-app rm` deletes the app and every instance; `hub app my-app/staging rm` deletes only staging.

Deleting and recreating an instance with the same name gives it separate volumes. It never adopts retained data from the deleted instance, and the CLI and dashboard do not offer a restore operation. See [storage and deletion](https://docs.myhub.host/deploy/storage#remove-an-app).

Check your [allowance](https://docs.myhub.host/limits) before adding an instance.

## Remove an instance

```sh
hub app my-app instance remove staging
```

This removes only `staging`. In an interactive terminal, Hub asks you to confirm removal, then asks separately whether to delete its data volumes.

To remove it without prompts and retain its volumes:

```sh
hub app my-app instance remove staging --yes
```

To delete its volumes too, use `--delete-data`. This flag also skips both confirmation prompts:

```sh
hub app my-app instance remove staging --delete-data
```

Deleting volumes permanently removes the instance's stored data. Check the instance name and [back up data you need](https://docs.myhub.host/deploy/storage) before confirming.

[Deployment options](https://docs.myhub.host/cli/deploy)