Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/enkot/nuxt-open-fetch

Generate zero-overhead, typed OpenAPI clients for Nuxt.
https://github.com/enkot/nuxt-open-fetch

api composable fetch nuxt nuxt3 openapi query

Last synced: about 5 hours ago
JSON representation

Generate zero-overhead, typed OpenAPI clients for Nuxt.

Awesome Lists containing this project

README

        

[![Nuxt Open Fetch](./docs/public/cover.png)](https://nuxt-open-fetch.vercel.app/)

# Nuxt Open Fetch

[![npm version][npm-version-src]][npm-version-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

Generate zero-overhead, 100% typed OpenAPI clients for Nuxt.

In other words - `$fetch` and `useFetch` on steroids. Uses awesome [openapi-typescript](https://github.com/drwpow/openapi-typescript) generator under the hood.

> ⚠️ APIs are subject to change.
> All ideas/suggestions are welcome! :)

- [✨  Release Notes](/CHANGELOG.md)
- [📖  Read the documentation](https://nuxt-open-fetch.vercel.app/)

## Features

- 🍹  No manual typing of your API
- 🍋  Supports OpenAPI 3.0 and 3.1 (including advanced features like [discriminators](https://spec.openapis.org/oas/v3.1.0#discriminator-object))
- 🌲  Uses runtime-free types that outperform old-school codegen
- 📡  Load schemas from YAML or JSON, locally or remotely
- 🥞  Works with Nuxt [Layers](https://nuxt.com/docs/getting-started/layers)

## Quick Setup

1. Add `nuxt-open-fetch` dependency to your project

```bash
# Using pnpm
pnpm add -D nuxt-open-fetch

# Using yarn
yarn add --dev nuxt-open-fetch

# Using npm
npm install --save-dev nuxt-open-fetch
```

2. Add `nuxt-open-fetch` to the `modules` section of `nuxt.config.ts`

```js
export default defineNuxtConfig({
modules: [
'nuxt-open-fetch'
]
})
```

That's it! You can now use `nuxt-open-fetch` in your Nuxt app ✨

## Development

```bash
# Install dependencies
pnpm install

# Generate type stubs
pnpm dev:prepare

# Develop with the playground
pnpm dev

# Build the playground
pnpm dev:build

# Run ESLint
pnpm lint

# Run Vitest
pnpm test
pnpm test:watch

# Release new version
pnpm release
```

## License

Made with 💚

Published under the [MIT License](./LICENCE).

[npm-version-src]: https://img.shields.io/npm/v/nuxt-open-fetch/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/nuxt-open-fetch

[license-src]: https://img.shields.io/npm/l/nuxt-open-fetch.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-open-fetch

[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com