Auto-generated composables for secure API access, with OpenAPI support
npm install nuxt-api-party
Nuxt module that provides seamless integration with multiple API endpoints. It generates type-safe composables for each API endpoint you configure, offering a familiar developer experience similar to Nuxt's useFetch and $fetch while keeping your API credentials secure and eliminating CORS issues through a server proxy.
- ✨ Release Notes
- 📖 Read the documentation
- 🪅 Auto-generated composables for each API endpoint
- 🔒 Protected API credentials with Nuxt proxy route
- 🌐 No CORS issues
- 🍱 Familiar developer experience to useFetch and $fetch
- 🧇 Connect all your APIs
- 🦾 Fully typed API clients from OpenAPI specifications
- 🗃 Smart caching & hydration
> [!TIP]
> 📖 Read the documentation
``bash`
npx nuxt module add api-party
> [!TIP]
> 📖 Read the documentation
Add the Nuxt API Party to your Nuxt config and prepare your first API connection by setting an endpoint object with the following properties for the apiParty module option:
`tsnuxt.config.ts
//
export default defineNuxtConfig({
modules: ['nuxt-api-party'],
apiParty: {
endpoints: {
jsonPlaceholder: {
url: process.env.JSON_PLACEHOLDER_API_BASE_URL!,
// Global headers sent with each request
headers: {
Authorization: Bearer ${process.env.JSON_PLACEHOLDER_API_TOKEN}`
}
}
}
}
})
If you were to call your API jsonPlaceholder, the generated composables are:
- $jsonPlaceholder – Returns the response data, similar to $fetchuseJsonPlaceholderData
- – Returns multiple values similar to useFetch
Use these composables in your templates or components:
`vue
{{ data?.title }}
{{ JSON.stringify(data, undefined, 2) }}
`
> [!TIP]
> You can connect as many APIs as you want, just add them to the endpoints object.
1. Clone this repository
2. Enable Corepack using corepack enablepnpm install
3. Install dependencies using pnpm run dev:prepare
4. Run pnpm run dev`
5. Start development server using
- Dennis Baum for sponsoring the initial version of this package.
- Konkon for his logo pixel art.
MIT License © 2022-PRESENT Johann Schopplich
MIT License © 2025-PRESENT Matthew Messinger