# Get started with the CLI

## Create a new project

Create a new folder for your project, `my-project`. Change into it, and set `AMCS_CONTENT` to the folder that should store your content.

```console
mkdir -p my-project
cd my-project
export ACMS_CONTENT=$PWD/content
```

## Create a restaurant collection type

```console
acms collection add restaurant <<'EOF'
{
  "name": "Biscotte Restaurant",
  "description": "Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers."
}
EOF
```

Take note of the `$fileName` in the output. Note that it should be different for you.

```json
{
    "$id": "9474f0eb-06d7-4fd8-b89e-0ce996962508",
    "description": "Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.",
    "name": "Biscotte Restaurant"
}
```

## Create a category collection type

```console
acms collection add category <<'EOF'
{
  "name": "French Food",
  "restaurant": { "$ref": "restaurant/9474f0eb-06d7-4fd8-b89e-0ce996962508" }
}
EOF
```

```console
acms collection add category <<'EOF'
{
  "name": "Brunch",
  "restaurant": { "$ref": "restaurant/9474f0eb-06d7-4fd8-b89e-0ce996962508" }
}
EOF
```

## Query the API

```console
curl 'http://localhost:8081/api/query' --data '
  SELECT
    {
      name: restaurant.name,
      description: restaurant.description,
      category: {
        category: category.name
      }
    }
  FROM
    restaurant
  LEFT JOIN
    category
  ON
    category.restaurant == restaurant.$id
' | jq .
```

```json
[
  {
    "category": {
      "category": null
    },
    "description": "Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.",
    "name": "Biscotte Restaurant"
  }
]
```