
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@github-graph/api
Advanced tools
API client for GitHub's GraphQL API that automatically merges multiple requests into one where possible, saving you from hitting the API rate limits.
API client for GitHub's GraphQL API that automatically merges multiple requests into one where possible, saving you from hitting the API rate limits.
yarn add @github-graph/api
import Client, {auth, gql, getMethod} from '@github-graph/api';
const getStargazers = getMethod<
{repository: {nameWithOwner: string; stargazers: {totalCount: number}}},
{owner: string; name: string}
>(gql`
query GetStargazers($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
nameWithOwner
stargazers {
totalCount
}
}
}
`);
const getWatchers = getMethod<
{repository: {nameWithOwner: string; watchers: {totalCount: number}}},
{owner: string; name: string}
>(gql`
query GetWatchers($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
nameWithOwner
watchers {
totalCount
}
}
}
`);
const client = new Client({
auth: auth.createTokenAuth(GITHUB_TOKEN),
});
await Promise.all([
getStargazers(client, {owner: 'pugjs', name: 'pug'}),
getWatchers(client, {owner: 'pugjs', name: 'pug'})),
getStargazers(client, {owner: 'ForbesLindesay', name: 'atdatabases'}),
getWatchers(client, {owner: 'ForbesLindesay', name: 'atdatabases'}),
]);
Unlike other libraries, that would send 4 separate queries to the backend. This library will only send one:
{
query: `
query ($owner: String!, $name: String!, $b: String!, $c: String!) {
repository(owner: $owner, name: $name) {
nameWithOwner
stargazers {
totalCount
}
watchers {
totalCount
}
}
b: repository(owner: $b, name: $c) {
nameWithOwner
stargazers {
totalCount
}
watchers {
totalCount
}
}
}
`,
variables: {
b: 'ForbesLindesay',
c: 'atdatabases',
name: 'pug',
owner: 'pugjs',
},
}
This is 4 times fewer tokens used from your rate limit.
Unfortunatley not everything on GitHub is available via the GraphQL API. If you need to, you can use client.rest which matches the octokit/rest API. or you can use client.request which lets you make direct un-typed requests to the GitHub API.
If you already have an octokit client, you can construct a github-graph client via:
const client = new Client({
request: octokitClient.request,
});
FAQs
API client for GitHub's GraphQL API that automatically merges multiple requests into one where possible, saving you from hitting the API rate limits.
We found that @github-graph/api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.