# Quix CLI Quickstart

In this guide you will use the Quix CLI to **create a simple streaming pipeline**, and test it locally by running it in Docker. The pipeline generates telemetry data from a car and processes it to **send an event** whenever the driver applies a **hard brake**.

You will learn how to:

1. **Install Quix CLI**: Get the CLI tool up and running on your local machine.
2. **Verify Dependencies**: Ensure you have all necessary tools like Docker and Git.
3. **Initialize a Quix Project**: Set up your project directory and configuration files.
4. **Create Source and Transform Applications**: Build applications to produce and process data.
5. **Run and Manage Your Pipeline**: Run your pipeline locally using Docker and manage it through the Quix CLI.

By the end of this guide, you'll have a fully functional data pipeline running locally. Let's get started!

## Prerequisites

This guide assumes you have the following installed in your local machine:

- [Docker Desktop](https://docs.docker.com/engine/install/)
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

## Step 1: Install Quix CLI

To install Quix CLI:

[macOS](https://quix.io/docs/quix-cli/cli-quickstart.html#__tabbed_1_1)[Linux](https://quix.io/docs/quix-cli/cli-quickstart.html#__tabbed_1_2)[Windows](https://quix.io/docs/quix-cli/cli-quickstart.html#__tabbed_1_3)

```
curl -fsSL https://github.com/quixio/quix-cli/raw/main/install.sh | bash
```

```
curl -fsSL https://github.com/quixio/quix-cli/raw/main/install.sh | bash
```

```
iwr https://github.com/quixio/quix-cli/raw/main/install.ps1 -useb | iex
```

For further details on installation, including instructions for Microsoft Windows, see the [install guide](https://github.com/quixio/quix-cli?tab=readme-ov-file#installation-of-quix-cli).

Tip

To update Quix CLI just run `quix update` to get the latest version.

## Step 2: Verify dependencies

To verify you have the dependencies installed, run the following command:

```
quix status
```

View the output carefully to confirm you have Git and Docker installed:

```
✓ Docker detected
✓ Git detected
```

## Step 3: Create a GitHub repository

Create a [**new Git repo**](https://github.com/new) on GitHub to store your project files.

Initialize the repo with a `README.md` file to make it easier to clone.

If you encounter any issues creating your GitHub repository, refer to this [documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/quickstart-for-repositories) on Github.

## Step 4: Clone your GitHub repo into your local project directory

Now, clone the repository using the URL. For example:

```
git clone https://github.com/<your-username>/<your-repository>
```

Tip

Replace `<your-username>` and `<your-repository>` with your actual username and repository name.

If you encounter any issues cloning your GitHub repository, refer to this [documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) on Github.

## Step 5: Initialize your project as a Quix project

Change into your project directory:

```
cd <your-repository>
```

In your Git project directory, enter `quix init`. This initializes your Quix project with a `quix.yaml` file, which describes your Quix project:

```
quix init
```

If you look at the initial `quix.yaml` file you'll see the following:

```
# Quix Project Descriptor
# This file describes the data pipeline and configuration of resources of a Quix Project.

metadata:
  version: 1.0

depployments: []

topics: []
```

## Step 6: Create a source application

Now create a source application that will ingest simulated telemetry data into the broker:

```
quix app create demo-data-source
```

When prompted, assign it a name of `demo-data-source`.

## Step 7: Create a transform application

Now let's create a simple transform application. This application will read data from the source and will generate a message when a hard braking is detected:

```
quix app create event-detection-transformation
```

When prompted, assign it a name of `event-detection-transformation`.

## Step 8: Update the deployments of your pipeline

Update the deployments of your pipeline with the newly created applications of the project:

```
quix pipeline update
```

Now, view your `quix.yaml` file again to see how a deployment for each application has been added:

```
# Quix Project Descriptor
# This file describes the data pipeline and configuration of resources of a Quix Project.

metadata:
  version: 1.0

deployments:
  - name: demo-data-source
    application: demo-data-source
    deploymentType: Service
    version: latest
    resources:
      cpu: 200
      memory: 500
      replicas: 1
    variables:
      - name: output
        inputType: OutputTopic
        description: Name of the output topic to write into
        required: true
        value: f1-data
  - name: event-detection-transformation
    application: event-detection-transformation
    deploymentType: Service
    version: latest
    resources:
      cpu: 200
      memory: 500
      replicas: 1
    variables:
      - name: input
        inputType: InputTopic
        description: This is the input topic for f1 data
        required: true
        value: f1-data
      - name: output
        inputType: OutputTopic
        description: This is the output topic for hard braking events
        required: true
        value: hard-braking

topics:
  - name: f1-data
  - name: hard-braking
```

## Step 9: Run your pipeline

Run your pipeline in Docker:

```
quix pipeline up
```

Now switch to Docker Desktop and view the containers of the pipeline running:

## Step 10: Push your local pipeline to Github

To push your changes to Git, and sync your pipeline to Quix Cloud:

```
quix pipeline sync
```

This command also **synchronizes** your Git repository with Quix Cloud but may show an error message if Quix Cloud is not available.
