Skip to main content
Version: 4.x.x


Initialize Client

The first step is to initialize the Client. 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.

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 and assign types to them.


We are using currying to achieve auto generated types for the endpoint string.
This solution will be removed once get resolved.

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! 🎊