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

# Introduction

A phidata template creates a **Workspace**, which is just an umbrella term for your codebase.

## Create new workspace

Run `phi ws create` to create a new workspace using a phidata template

<CodeGroup>
  ```bash Create Workspace theme={null}
  phi ws create
  ```

  ```bash Create AI App theme={null}
  phi ws create -t ai-app -n ai-app
  ```

  ```bash Create AI Api theme={null}
  phi ws create -t api-app -n api-app
  ```

  ```bash Create Django App theme={null}
  phi ws create -t django-app -n web-app
  ```
</CodeGroup>

<br />

<Note>
  `phi` will ask for a workspace template and name if not provided.
</Note>

## Setup existing workspace

Run `phi ws setup` to setup an existing directory as a phidata workspace

<CodeGroup>
  ```bash terminal theme={null}
  phi ws setup
  ```

  ```bash with debug logs theme={null}
  phi ws setup -d
  ```
</CodeGroup>

## Start workspace

Run `phi ws up` to create workspace resources

<CodeGroup>
  ```bash terminal theme={null}
  phi ws up
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker
  ```

  ```bash full options theme={null}
  phi ws up --env dev --infra docker
  ```

  ```bash short options theme={null}
  phi ws up -e dev -i docker
  ```
</CodeGroup>

## Stop workspace

Run `phi ws down` to delete workspace resources

<CodeGroup>
  ```bash terminal theme={null}
  phi ws down
  ```

  ```bash shorthand theme={null}
  phi ws down dev:docker
  ```

  ```bash full options theme={null}
  phi ws down --env dev --infra docker
  ```

  ```bash short options theme={null}
  phi ws down -e dev -i docker
  ```
</CodeGroup>

## Patch workspace

Run `phi ws patch` to update workspace resources

<CodeGroup>
  ```bash terminal theme={null}
  phi ws patch
  ```

  ```bash shorthand theme={null}
  phi ws patch dev:docker
  ```

  ```bash full options theme={null}
  phi ws patch --env dev --infra docker
  ```

  ```bash short options theme={null}
  phi ws patch -e dev -i docker
  ```
</CodeGroup>

<br />

<Note>
  The `patch` command in under development for some resources. Use `restart` if needed
</Note>

## Restart workspace

Run `phi ws restart` to stop resources and start them again

<CodeGroup>
  ```bash terminal theme={null}
  phi ws restart
  ```

  ```bash shorthand theme={null}
  phi ws restart dev:docker
  ```

  ```bash full options theme={null}
  phi ws restart --env dev --infra docker
  ```

  ```bash short options theme={null}
  phi ws restart -e dev -i docker
  ```
</CodeGroup>

## Command Options

<Note>Run `phi ws up --help` to view all options</Note>

### Environment (`--env`)

Use the `--env` or `-e` flag to filter the environment (dev/prd)

<CodeGroup>
  ```bash flag theme={null}
  phi ws up --env dev
  ```

  ```bash shorthand theme={null}
  phi ws up dev
  ```

  ```bash short options theme={null}
  phi ws up -e dev
  ```
</CodeGroup>

### Infra (`--infra`)

Use the `--infra` or `-i` flag to filter the infra (docker/aws/k8s)

<CodeGroup>
  ```bash flag theme={null}
  phi ws up --infra docker
  ```

  ```bash shorthand theme={null}
  phi ws up :docker
  ```

  ```bash short options theme={null}
  phi ws up -i docker
  ```
</CodeGroup>

### Group (`--group`)

Use the `--group` or `-g` flag to filter by resource group.

<CodeGroup>
  ```bash flag theme={null}
  phi ws up --group app
  ```

  ```bash full options theme={null}
  phi ws up \
    --env dev \
    --infra docker \
    --group app
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker:app
  ```

  ```bash short options theme={null}
  phi ws up \
    -e dev \
    -i docker \
    -g app
  ```
</CodeGroup>

### Name (`--name`)

Use the `--name` or `-n` flag to filter by resource name

<CodeGroup>
  ```bash flag theme={null}
  phi ws up --name app
  ```

  ```bash full options theme={null}
  phi ws up \
    --env dev \
    --infra docker \
    --name app
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker::app
  ```

  ```bash short options theme={null}
  phi ws up \
    -e dev \
    -i docker \
    -n app
  ```
</CodeGroup>

### Type (`--type`)

Use the `--type` or `-t` flag to filter by resource type.

<CodeGroup>
  ```bash flag theme={null}
  phi ws up --type container
  ```

  ```bash full options theme={null}
  phi ws up \
    --env dev \
    --infra docker \
    --type container
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker:app::container
  ```

  ```bash short options theme={null}
  phi ws up \
    -e dev \
    -i docker \
    -t container
  ```
</CodeGroup>

### Dry Run (`--dry-run`)

The `--dry-run` or `-dr` flag can be used to **dry-run** the command. `phi ws up -dr` will only print resources, not create them.

<CodeGroup>
  ```bash flag theme={null}
  phi ws up --dry-run
  ```

  ```bash full options theme={null}
  phi ws up \
    --env dev \
    --infra docker \
    --dry-run
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker -dr
  ```

  ```bash short options theme={null}
  phi ws up \
    -e dev \
    -i docker \
    -dr
  ```
</CodeGroup>

### Show Debug logs (`--debug`)

Use the `--debug` or `-d` flag to show debug logs.

<CodeGroup>
  ```bash flag theme={null}
  phi ws up -d
  ```

  ```bash full options theme={null}
  phi ws up \
    --env dev \
    --infra docker \
    -d
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker -d
  ```

  ```bash short options theme={null}
  phi ws up \
    -e dev \
    -i docker \
    -d
  ```
</CodeGroup>

### Force recreate images & containers (`-f`)

Use the `--force` or `-f` flag to force recreate images & containers

<CodeGroup>
  ```bash flag theme={null}
  phi ws up -f
  ```

  ```bash full options theme={null}
  phi ws up \
    --env dev \
    --infra docker \
    -f
  ```

  ```bash shorthand theme={null}
  phi ws up dev:docker -f
  ```

  ```bash short options theme={null}
  phi ws up \
    -e dev \
    -i docker \
    -f
  ```
</CodeGroup>
