Join the Nuxt Team at Frontend Nation 4-7 June.


Securely connect to any API with a server proxy and dynamic composables


Nuxt API Party

npm version

Nuxt module to securely connect to any API.



!TIP📖 Read the documentation

npx nuxi@latest module add api-party

Basic Usage

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

// `nuxt.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:

Use these composables in your templates or components:

<script setup lang="ts">
const { data, pending, refresh, error } = await useJsonPlaceholderData('posts/1')

  <h1>{{ data?.title }}</h1>
  <pre>{{ JSON.stringify(data, undefined, 2) }}</pre>

!TIP You can connect as many APIs as you want, just add them to the endpoints object.

💻 Development

  1. Clone this repository
  2. Enable Corepack using corepack enable
  3. Install dependencies using pnpm install
  4. Run pnpm run dev:prepare
  5. Start development server using pnpm run dev

Special Thanks


MIT License © 2022-PRESENT Johann Schopplich