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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@svadmin/graphql

v0.6.0

Published

GraphQL DataProvider for svadmin

Readme

@svadmin/graphql

Generic GraphQL DataProvider for svadmin.

Because GraphQL APIs do not share a universal convention for CRUD operations (unlike REST), this generic provider requires you to pass your GraphQL queries and mutations via the meta.query property in svadmin hooks.

Installation

bun add @svadmin/graphql graphql-request graphql

Basic Usage

Initialize the provider with a GraphQLClient:

import { AdminApp } from '@svadmin/ui';
import { createGraphQLDataProvider } from '@svadmin/graphql';
import { GraphQLClient } from 'graphql-request';

const client = new GraphQLClient('https://your-graphql-endpoint/graphql', {
  headers: {
    Authorization: `Bearer YOUR_TOKEN`,
  },
});

const dataProvider = createGraphQLDataProvider({ client });

Using Hooks with GraphQL

Pass your gql queries into the meta prop of your hooks.

Fetching a List (useList / useTable)

import { useTable } from '@svadmin/core';
import { gql } from 'graphql-request';

const POSTS_QUERY = gql`
  query GetPosts($limit: Int, $offset: Int) {
    posts(limit: $limit, offset: $offset) {
      id
      title
      content
    }
    posts_aggregate {
      aggregate {
        count
      }
    }
  }
`;

// In your Svelte component
const table = useTable({
  resource: 'posts',
  meta: {
    query: POSTS_QUERY
  }
});

(Note: If your API returns data in a deeply nested structure like posts_aggregate.aggregate.count, you may need to wrap this provider or map the response in your data hook overrides).

Creating a Record (useCreate / useForm)

import { useForm } from '@svadmin/core';
import { gql } from 'graphql-request';

const CREATE_POST_MUTATION = gql`
  mutation CreatePost($title: String!, $content: String!) {
    insert_posts_one(object: {title: $title, content: $content}) {
      id
      title
    }
  }
`;

const form = useForm({
  resource: 'posts',
  action: 'create',
  meta: {
    query: CREATE_POST_MUTATION
  }
});