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

# Deployment - JavaScript/TypeScript

> Deploy your Kinetix ML pipeline to JavaScript or TypeScript in less than 5 minutes.

## Install the Library

Kinetix ML should be installed as a node module using the command below.

```bash theme={null}
yarn add kml-pipe-ts
```

<Warning>
  There is a known issue with Tensorflow JS dependencies when installing using
  the npm command so please use yarn. They are for the most part interoperable.
</Warning>

## Initialization

First start by importing the module.

```TypeScript theme={null}
import { KMLPipeline } from 'kml-pipe-ts';
```

Create the pipeline object using your API Key and project name.

```TypeScript theme={null}
var pipeline = new KMLPipeline("[Your Project Name]", "[Your API Key]");
```

Initialize the pipeline.

```TypeScript theme={null}
await pipeline.initialize();
```

## Execution

To execute the pipeline you need to run the execute method with the required input data.

```TypeScript theme={null}
await pipeline.execute([]) // the [] should be replaced with your list of inputs
```

## Webcam Inference

The pipeline will need a data source for each of its inputs. A common input is image data for nodes such as PoseDetection2D. For these nodes you should first create a video source element.

```HTML theme={null}
<video id="webcam" autoplay />
```

Now we need to make a function that we can call for every frame

```TypeScript theme={null}
let outputs = []
let processing = false
async function runInference() {
  if (!processing) {
      processing = true;
      outputs = await pipe.execute([videoSource]);
      processing = false;
    }
  document.getElementById("webcam").requestVideoFrameCallback(runInference); // run inference on every frame
};
```

Then, to use your webcam, run the following function which will ask the user for webcam permission, start playing the video, and start inference.

```TypeScript theme={null}
async function startWebcam() {
    const stream = await navigator.mediaDevices.getUserMedia({ video: true });
    document.getElementById("webcam").srcObject = stream;
    await document.getElementById("webcam").play();
    document.getElementById("webcam").requestVideoFrameCallback(runInference);
};
```
