npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vue3-apollo/core

v1.4.2

Published

Composable Apollo Client utilities for Vue 3.

Readme

@vue3-apollo/core

🧩 Composable utilities for using Apollo Client v4 with Vue 3.

Vue3 Apollo Core provides a lightweight, composable-first integration between Vue 3 and Apollo Client, allowing you to perform GraphQL queries, mutations, and subscriptions in a fully reactive way.

✨ Features

  • 🪶 Minimal and tree-shakeable
  • 🔁 Reactive GraphQL queries & mutations via Vue composables
  • ⚡ Multiple client support (default + named clients)
  • 🧠 TypeScript-first API
  • 🧩 Seamless integration with Nuxt via @vue3-apollo/nuxt
  • 📄 Full documentation at vue3-apollo.guen.dev

📦 Installation

You can install using your preferred package manager:

npm install @vue3-apollo/core @apollo/client graphql

🚀 Getting Started

1. Create an Apollo Client

import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client/core'

export const defaultClient = new ApolloClient({
    cache: new InMemoryCache(),
    link: new HttpLink({
    // Example public GraphQL API
        uri: 'https://graphqlplaceholder.vercel.app/graphql',
    }),
})

2. Register the Plugin

import { apolloPlugin } from '@vue3-apollo/core'
import { createApp } from 'vue'

import { analyticsClient, defaultClient } from './apollo-clients'

const app = createApp(App)

app.use(apolloPlugin, {
    clients: {
        analytics: analyticsClient,
        default: defaultClient,
    },
})

This injects Apollo clients into your Vue app, making them available across composables and components.

3. Use in a Component

<script setup lang="ts">
import { useQuery } from '@vue3-apollo/core'
import gql from 'graphql-tag'

const GET_POSTS = gql`
  query Posts {
    posts {
      id
      title
      body
    }
  }
`

const { error, loading, result } = useQuery(GET_POSTS)
</script>

<template>
  <div v-if="loading">
    Loading...
  </div>
  <div v-else-if="error">
    {{ error.message }}
  </div>
  <ul v-else>
    <li v-for="post in result.posts" :key="post.id">
      <strong>{{ post.title }}</strong> — {{ post.body }}
    </li>
  </ul>
</template>

🧠 Composables Overview

| Composable | Description | |--------------------|------------------------------------------------| | useQuery | Reactive GraphQL query | | useMutation | Execute GraphQL mutations | | useSubscription | Subscribe to GraphQL streams | | useFragment | Retrieve and manage normalized cache fragments | | useApolloClient | Access current Apollo client | | useApolloClients | Access Apollo clients |

See the full API reference for details.


🧩 Multi-Client Example

You can register and switch between multiple clients:

const { result: analyticsData } = useQuery(ANALYTICS_QUERY, null, {
    clientId: 'analytics',
})

🧰 TypeScript Support

All composables are fully typed, providing autocompletion and inference for query variables and responses.

const { result } = useQuery<{ posts: { id: string, title: string }[] }>(GET_POSTS)

🧑‍💻 Contributing

This package is part of the Vue3 Apollo monorepo.

To develop locally:

pnpm install
pnpm build
pnpm dev:docs

📄 License

MIT

🔗 Links