Skip to content
プロジェクト

概要

🐬 Auto-generated composables for any API, typed from OpenAPI, with your credentials kept on the server

Web・アプリ開発

この数値の測り方

できること

  • 🪅 Auto-generated composables for each API
  • 🔒 API credentials kept on the server by a server proxy
  • 🌐 No CORS issues
  • 🍱 Built on Nuxt's useFetch and $fetch

計測したスター増加

24時間
0
7日間
0
15日間
+2
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Nuxt API Party module

Nuxt API Party

Auto-generated composables for any API in Nuxt, typed from OpenAPI, with your credentials kept on the server.

Features

Setup

npx nuxt module add api-party

Basic Usage

Add Nuxt API Party to your Nuxt configuration and describe your first API under 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!,
        // Sent as a bearer token with each request, from the server
        token: process.env.JSON_PLACEHOLDER_API_TOKEN,
      },
    },
  },
})

For an endpoint jsonPlaceholder, the module generates:

Use these composables in your templates or components:

<script setup lang="ts">
const { data, refresh, error, status, clear } = await useJsonPlaceholderData<{ title: string }>(
  'posts/1',
)
</script>

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

Connect as many APIs as you need: each entry in endpoints gets its own pair of composables.

The documentation covers the OpenAPI integration, caching, credential forwarding and every module option. Coming from v4? See the migration guide.

💻 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

Credits

  • Dennis Baum for sponsoring the initial version of this package.
  • Konkon for his logo pixel art.

License

MIT License © 2022-PRESENT Johann Schopplich and © 2025-PRESENT Matthew Messinger

関連プロジェクトを探す

読み込み中…