--- URL: "/guide/client" LLMS_URL: "/guide/client/llms.txt" --- # *Backan* `client` Create a client for your `backan` API and make your frontend app able to access your API easily and with type. To achieve this, backan makes use of the [`openapi-featch`](https://openapi-ts.dev/openapi-fetch/) library. ## 🔑 Installation ::: code-group ```bash [npm] npm install @backan/client ``` ```bash [pnpm] pnpm i @backan/client ``` ```bash [yarn] yarn add @backan/client ``` ```bash [bun] bun add @backan/client ``` ```bash [deno] deno add npm:@backan/client ``` ::: [![NPM Version](https://img.shields.io/npm/v/@backan/client?style=for-the-badge&color=yellow)](https://www.npmjs.com/package/@backan/client) ## 📈 Usage ```ts twoslash // @noErrors import { createClient } from '@backan/client' import type { paths } from './openapi.d.ts' // Types generated by `buildSchema` function from `@backan/builder` const client = createClient( { baseUrl : 'http://localhost:1312/', } ) export {client} ``` ### Example of call ```ts twoslash // @filename: client.js import { createClient } from '@backan/client' // @noErrors import type { paths } from './openapi.d.ts' // Types generated by `buildSchema` function from `@backan/builder` const client = createClient( { baseUrl : 'http://localhost:1312/', } ) export {client} // ---cut--- import {client} from './client.js' const response = await client.GET( '/random/child', { params : { query : { value : 'myValue', }, }, } ) console.log( response ) ```