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

@bota-apps/hooks

v0.5.4

Published

The generic data layer for @bota-apps apps: a configured React Query client wired to the feature error tracker, the GraphQL client context/provider, and typed query/mutation pipeline wrappers. Domain hooks stay in each app.

Readme

@bota-apps/hooks

The generic data layer for @bota-apps apps: a configured React Query client wired to the feature error tracker, the GraphQL client context/provider, and typed query/mutation pipeline wrappers. Domain hooks stay in each app (built on these) — this package ships only the generic plumbing.

Install

pnpm add @bota-apps/hooks
# peers: @tanstack/react-query, react, graphql

Usage

Provide the clients near the app root

QueryProvider mounts the shared queryClient; GraphQLProvider puts a @bota-apps/gql-client GraphQLClient on context so the useGql* hooks and useGraphQLClient() can reach it.

import { QueryProvider, GraphQLProvider } from "@bota-apps/hooks";
import { createGraphQLClient } from "@bota-apps/gql-client";

const client = createGraphQLClient("https://api.example.com/graphql");

<QueryProvider>
  <GraphQLProvider client={client}>{children}</GraphQLProvider>
</QueryProvider>;

Typed operations with the useGql* hooks

Pass a TypedDocumentNode (e.g. from @bota-apps/gql-codegen) and the field result type is inferred. useGqlQuery unwraps the single root field for you, and gqlQueryKey derives a stable query key from the document + variables:

import { useGqlQuery, useGqlMutation } from "@bota-apps/hooks";

export function useProjects() {
  return useGqlQuery(ProjectsDocument); // UseQueryResult<Project[], Error>
}

export function useProject(id: string) {
  return useGqlQuery(ProjectDocument, { id }); // variables passed positionally
}

export function usePromoteProject() {
  return useGqlMutation(PromoteProjectDocument, {
    invalidates: [["projects"]], // shorthand for meta.invalidates
  });
}

Build a domain hook on the raw pipelines

When you need a bespoke queryFn, use the pipelines directly. They forward failures to the feature tracker and honour meta.featureId / meta.invalidates:

import { useQueryPipeline, useGraphQLClient } from "@bota-apps/hooks";

export function useProjects() {
  const client = useGraphQLClient();
  return useQueryPipeline({
    queryKey: ["projects"],
    queryFn: () => client.request(ProjectsDocument).then((r) => r.projects),
    meta: { featureId: "projects" },
  });
}

API

| Export | What | | -------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | queryClient | The shared, pre-configured QueryClient instance | | QueryProvider | Mounts queryClient via QueryClientProvider | | GraphQLContext / useGraphQLClient | React context holding the GraphQLClient; hook throws if used outside a provider | | GraphQLProvider | Puts a GraphQLClient on GraphQLContext | | useQueryPipeline / useSuspenseQueryPipeline | useQuery / useSuspenseQuery wrappers with feature-tracker error forwarding | | useMutationPipeline | useMutation wrapper honouring meta.invalidates (auto query invalidation) | | usePaginatedQueryPipeline | Query pipeline for paginated list operations | | useGqlQuery / useGqlSuspenseQuery | Typed query hooks that take a TypedDocumentNode and unwrap the root field | | useGqlMutation | Typed mutation hook; invalidates shorthand for meta.invalidates | | gqlQueryKey | Stable query key from a document + variables | | QueryMeta / MutationMeta / GqlVariables | Supporting types (featureId, invalidates, variable record) | | GqlQueryOptions / GqlSuspenseQueryOptions / GqlMutationOptions | Option types for the useGql* hooks (query key / fn omitted) |

Query failures are forwarded to the feature tracker via @bota-apps/fm; the GraphQLClient type comes from @bota-apps/gql-client. React and @tanstack/react-query are peer dependencies supplied by the app.

Part of the @bota-apps packages monorepo.