igdb-wrapper requires Node.js 18 or later and uses the native fetch API. TypeScript 5+ is recommended for the best type inference experience.
npm install igdb-wrapper
# or
pnpm add igdb-wrapper
# or
yarn add igdb-wrapper
# or
bun add igdb-wrapperIGDB's API is proxied through Twitch. You'll need a free Twitch Developer account to get credentials.
- Go to dev.twitch.tv/console/apps and log in
- Click Register Your Application
- Set the OAuth redirect URL to
http://localhost(not used, just required) - Copy your Client ID and generate a Client Secret
Store them as environment variables — never commit them to source control.
# .env
TWITCH_CLIENT_ID=your_client_id_here
TWITCH_CLIENT_SECRET=your_client_secret_hereimport { IGDBClient } from "@api-wrappers/igdb-wrapper";
const client = new IGDBClient({
clientId: process.env.TWITCH_CLIENT_ID!,
clientSecret: process.env.TWITCH_CLIENT_SECRET!,
});The client handles OAuth token acquisition and refresh automatically. You do not need to manage tokens yourself.
// Fetch the top 5 highest-rated games
const topGames = await client.games
.query()
.select((g) => ({
name: g.name,
rating: g.rating,
releaseDate: g.first_release_date,
}))
.where((g) => g.rating.gte(90))
.sort((g) => g.rating, "desc")
.limit(5)
.execute();
for (const game of topGames) {
console.log(`${game.name} — ${game.rating}`);
}- Learn the full query builder API in Querying
- Explore all available endpoints in Endpoints
- Understand how errors are structured in Error Handling