---
sidebar_position: 0
title: Guides - Setup
sidebar_label: Setup
---

# Setup

---

### Initialize Client

The first step is to initialize the **[Client](/documentation/02-core/client.mdx)**. It manage the basic configuration
for connection to the server and all the elements that make up Hyper Fetch, which are instances of - **dispatchers**,
**cache** and **app managers**. We start by determining the `url` of our server.

```tsx title="/src/server/client.ts"
import { Client } from "@hyper-fetch/core";

export const client = new Client({ url: "http://localhost:3000" });
```

### Create Request

Then, having already prepared connection setup for the server, we use the client method to create
**[requests](/documentation/02-core/request.mdx)** and assign types to them.

:::caution

We are using currying to achieve auto generated types for the endpoint string. <br /> This solution will be removed once
[https://github.com/microsoft/TypeScript/issues/10571](https://github.com/microsoft/TypeScript/issues/10571) get
resolved.

:::

```tsx title="/src/server/auth/auth.ts"
import { client } from "../client.ts";

type ResponseType = { token: string; refreshToken: string };
type RequestType = { email: string; password: string };

const postLogin = client.createRequest<ResponseType, RequestType>()({ method: "POST", endpoint: "/auth/login" });
```

## You're ready to use Hyper Fetch! 🎊
