# Run the Kafka live viewer profiles application using LocalStack
> Run the complete live viewer profiles stack locally with Docker, LocalStack, and Snowplow to process media tracking events and display real-time user states.
> Source: https://docs.snowplow.io/tutorials/kafka-live-viewer-profiles/quickstart-localstack/
> Documentation index: https://docs.snowplow.io/llms.txt

The following steps will deploy the solution accelerator using Localstack.

## Step 0: Prerequisites

1. Open a terminal
2. Install **Docker** and **Docker Compose**
3. [Clone the project](https://github.com/snowplow-industry-solutions/kafka-live-viewer-profiles) and navigate to its directory

```bash
git clone https://github.com/snowplow-industry-solutions/kafka-live-viewer-profiles.git
```

4. Create a `.env` file based on `./docker/.env.example`
5. You can leave the AWS variables as placeholders when using Localstack

```bash
ACCEPT_LICENSE="true"
AWS_REGION=eu-west-2
AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxx
AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxx
AWS_ENDPOINT_URL=http://localstack:4566
```

## Step 1: Start the containers

Run the following command to download and run everything in Docker:

```bash
./docker/up.sh
```

Details on everything that's installed can be found in the [architecture](/tutorials/kafka-live-viewer-profiles/introduction/#architecture) section on the previous page.

**Tips:**

- Use `Ctrl+C` to stop services but keep containers running
- Pass service-specific options to `./docker/up.sh` (e.g., `./docker/up.sh kafka-services`)

## Step 2: Open the web tracking front-end

Visit <http://localhost:3000> to configure the Stream Collector endpoint and start tracking events. Enter the Collector URL: `localhost:9090` and click `Create tracker`.

![Snowplow JavaScript Tracker Demo setup page with the Collector endpoint URI field pre-filled with \&quot;localhost:9090\&quot; and \&quot;Create tracker\&quot; and \&quot;Skip\&quot; buttons](/assets/images/tracker-demo-721e93110218fc7e08aa453985b6d823.png)

On the next screen, click `Custom media tracking demo`. This will bring up a video and a screen that displays information on what events are sent from the browser to the pipeline. If you want to simulate multiple users watching the video at the same time, you can open this in separate browsers.

![Tracker demo welcome page listing tracking options including \&quot;Custom media tracking demo\&quot;, with buttons for enabling and disabling anonymous tracking and tracking structured events](/assets/images/welcome-page-aadae418d8f57badba9bb14166e6cf3e.png)

You must keep this window open with the video playing because everything here is running in real-time. You can use the [Snowplow Chrome Plugin](https://chromewebstore.google.com/detail/snowplow-inspector/maplkdomeamdlngconidoefjpogkmljm) to verify that the events are successfully sent from the web browser.

![Browser at localhost:3000/media showing the Big Buck Bunny video playing at 0:26/9:56 in the Snowplow JavaScript Tracker demo app](/assets/images/video-4b9da5d6d44a98bf239574a7d56ebcf1.png)

## Step 3: Open the Live Viewer front-end

Open <http://localhost:8280> in a separate window. This will display the active users and their current state (e.g. watching video, watching advertisement, paused).

![Snowplow Live Viewer Profile dashboard at localhost:8280 showing \&quot;Messages received: 5 | Live viewers: 1\&quot; with a JSON message displaying viewer\_id, status PAUSED\_VIDEO, and video playback position](/assets/images/live-viewer-df27c3494d3a88598b62d266d80769b6.png)

Congratulations! You have successfully run the accelerator to stream web behavior through Snowplow and Kafka to a real-time dashboard.

## Next Steps

- You can implement Snowplow media tracking on any [HTML5](/docs/sources/web-trackers/tracking-events/media/html5/) or [YouTube](/docs/sources/web-trackers/tracking-events/media/youtube/) media of your choice
- Look into the output from Kafka and extend the Live Viewer to include information on the media being watched and the user.
- Use our supplied Terraform in the next section to run this on AWS and make it publicly available.

## Other things you can do

### View Events in Kafka UI

Access <http://localhost:8080> to review events within the Kafka UI.

### Manage containers with LazyDocker

Run the following command to manage containers visually:

```bash
sudo ./docker/lazy.sh
```

### Inspect infrastructure with LocalStack UI

Visit the [LocalStack UI](https://app.localstack.cloud/) to inspect infrastructure components such as Kinesis and DynamoDB. Please note that a LocalStack account is required to view this.

## Cleaning up

### Stop the containers

Shut down all running containers:

```bash
./docker/down.sh
```

### Clean up and delete

To remove all containers and images, use:

```bash
./docker/clean.sh
```

This command will delete all generated data.
