---
title: Quickstart
slug: headless-sdk/quickstart
docTags: 
createdAt: 2022-05-09T12:53:15.000Z
---

These instructions work with any javascript environment or framework that supports installing packages through NPM.

## Installation

First install required packages to your project with npm or yarn.

```shell
npm install @klevu/core
```

## Initialization

Before making any request it is required to provide the Klevu API key and the search server you are targeting. This should be done in the index of the application or the initialization of your app.

URL and apikey can be found from your KMC installation.

:::CodeblockTabs
```typescript
import { KlevuConfig } from "@klevu/core"

KlevuConfig.init({
  url: "https://<your-server>.ksearchnet.com/cs/v2/search",
  apiKey: "klevu-xxxxxxxxxxxxx",
})
```

```javascript
import { KlevuConfig } from "@klevu/core"

KlevuConfig.init({
  url: "https://<your-server>.ksearchnet.com/cs/v2/search",
  apiKey: "klevu-xxxxxxxxxxxxx",
})
```
:::

## Making a search

All queries to Klevu are made with **KlevuFetch** function. Inside KlevuFetch you provide any amount of query functions as parameters. In this example we do most basic product search with search term "*hoodies*".

:::CodeblockTabs
```typescript
import { KlevuFetch, search } from "@klevu/core"

const result = await KlevuFetch(search("hoodies"))
console.log(result.queriesById("search")?.records)
```

```javascript
import { KlevuFetch, search } from "@klevu/core"

const result = await KlevuFetch(search("hoodies"))
console.log(result.getQueriesById("search")?.records)
```
:::

## Simple Playground

[Click here](https://codesandbox.io/s/klevu-headless-sdk-hello-world-dupbtv?file=/src/index.ts) to see a simple example you can play with.



