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

# Installation

> Install ofetch in your Node.js, browser, or worker project

## Install ofetch

You can install ofetch using your preferred package manager:

<CodeGroup>
  ```bash npm theme={null}
  npm install ofetch
  ```

  ```bash yarn theme={null}
  yarn add ofetch
  ```

  ```bash pnpm theme={null}
  pnpm add ofetch
  ```

  ```bash bun theme={null}
  bun add ofetch
  ```
</CodeGroup>

## Environment support

ofetch works across multiple JavaScript runtimes:

* **Node.js** - Version 18 and above (uses native fetch)
* **Browsers** - All modern browsers with fetch support
* **Workers** - Cloudflare Workers, Service Workers, Web Workers
* **Bun** - Full support with native fetch
* **Deno** - Full support with native fetch

<Note>
  ofetch uses the native `fetch` API available in your environment. For Node.js versions below 18, you may need a fetch polyfill.
</Note>

## TypeScript support

ofetch is written in TypeScript and includes type definitions out of the box. No additional `@types` packages are required.

```typescript theme={null}
import { ofetch } from 'ofetch';

// Response types are automatically inferred
interface User {
  id: number;
  name: string;
}

const user = await ofetch<User>('/api/user/1');
// user.id and user.name are fully typed
```

## Next steps

Now that you have ofetch installed, learn how to make your first request in the [quickstart guide](/quickstart).
