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

anilist-wrapper

v1.0.0

Published

A comprehensive TypeScript-based AniList API wrapper utilizing GraphQL

Readme

anilist-wrapper

A comprehensive TypeScript-based AniList API wrapper utilizing GraphQL.

npm version License: MIT CI

Features

  • 🚀 Full TypeScript support with comprehensive type definitions
  • 🔄 Complete GraphQL query handling
  • 🧩 Modular architecture for easy extension
  • 📚 Comprehensive documentation
  • ⚡ Efficient rate limiting
  • 🧪 Thoroughly tested with Vitest

Installation

npm install anilist-wrapper

Quick Start

import { AniListClient } from 'anilist-wrapper';

// Create a new client
const client = new AniListClient();

// Get anime by ID
async function getAnime() {
  const anime = await client.anime.getById(1);
  console.log(anime.title.english);
}

// Search for anime
async function searchAnime() {
  const results = await client.anime.search({ search: 'Attack on Titan' });
  console.log(`Found ${results.data.length} results`);
}

getAnime();
searchAnime();

Modules

The wrapper is organized into modules for different types of content:

  • anime - Anime-related queries
  • manga - Manga-related queries
  • character - Character-related queries
  • staff - Staff-related queries
  • user - User-related queries
  • search - General search functionality

Authentication

For authenticated requests, you need to provide an OAuth token:

// Create a client with authentication
const client = new AniListClient({ token: 'YOUR_TOKEN_HERE' });

// Or set the token later
client.setToken('YOUR_TOKEN_HERE');

// Get the current user's information
const user = await client.user.getCurrentUser();
console.log(`Logged in as: ${user.name}`);

Examples

Get Trending Anime

const trending = await client.anime.getTrending();
console.log('Trending anime:');
trending.data.forEach(anime => {
  console.log(`- ${anime.title.english || anime.title.romaji}`);
});

Search for a Character

const characters = await client.character.search({ search: 'Luffy' });
console.log(`Found ${characters.data.length} characters`);
characters.data.forEach(character => {
  console.log(`- ${character.name.full}`);
});

Custom GraphQL Query

const query = `
  query {
    GenreCollection
  }
`;

const result = await client.rawQuery(query);
console.log('Available genres:', result.GenreCollection);

Rate Limiting

The wrapper includes a rate limiter to prevent hitting API limits:

import { AniListClient, RateLimiter } from 'anilist-wrapper';

const client = new AniListClient();
const rateLimiter = new RateLimiter(60); // 60 requests per minute

// Queue up requests through the rate limiter
const animePromise = rateLimiter.add(() => 
  client.anime.search({ search: 'One Piece' })
);

const mangaPromise = rateLimiter.add(() => 
  client.manga.search({ search: 'Naruto' })
);

// Wait for all requests to complete
const [animeResults, mangaResults] = await Promise.all([
  animePromise,
  mangaPromise
]);

API Reference

AniListClient

The main client for interacting with the AniList API.

const client = new AniListClient({
  token: 'YOUR_TOKEN_HERE', // Optional
  baseUrl: 'https://graphql.anilist.co' // Optional, default shown
});

Methods

  • setToken(token: string) - Set the authentication token
  • rawQuery<T>(query: string, variables?: Record<string, any>) - Execute a raw GraphQL query

AnimeModule

Module for anime-related queries.

  • getById(id: number) - Get anime by ID
  • search(options: AnimeFilterOptions, pagination?: PaginationOptions) - Search for anime
  • getTrending(pagination?: PaginationOptions) - Get trending anime
  • getPopular(pagination?: PaginationOptions) - Get popular anime
  • getUpcoming(pagination?: PaginationOptions) - Get upcoming anime
  • getAiring(pagination?: PaginationOptions) - Get currently airing anime

MangaModule

Module for manga-related queries.

  • getById(id: number) - Get manga by ID
  • search(options: MangaFilterOptions, pagination?: PaginationOptions) - Search for manga
  • getTrending(pagination?: PaginationOptions) - Get trending manga
  • getPopular(pagination?: PaginationOptions) - Get popular manga
  • getUpcoming(pagination?: PaginationOptions) - Get upcoming manga
  • getReleasing(pagination?: PaginationOptions) - Get currently releasing manga

CharacterModule

Module for character-related queries.

  • getById(id: number) - Get character by ID
  • search(options: CharacterFilterOptions, pagination?: PaginationOptions) - Search for characters
  • getPopular(pagination?: PaginationOptions) - Get popular characters
  • getByMedia(mediaId: number, pagination?: PaginationOptions) - Get characters for a specific anime or manga

UserModule

Module for user-related queries.

  • getById(id: number) - Get user by ID
  • getByName(name: string) - Get user by username
  • search(options: UserFilterOptions, pagination?: PaginationOptions) - Search for users
  • getCurrentUser() - Get the current authenticated user

StaffModule

Module for staff-related queries.

  • getById(id: number) - Get staff by ID
  • search(options: StaffFilterOptions, pagination?: PaginationOptions) - Search for staff
  • getPopular(pagination?: PaginationOptions) - Get popular staff
  • getByMedia(mediaId: number, pagination?: PaginationOptions) - Get staff for a specific anime or manga

SearchModule

Module for general search functionality.

  • searchAll(query: string, pagination?: PaginationOptions) - Search for all types of content

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please make sure to update tests as appropriate.

License

This project is licensed under the MIT License - see the LICENSE file for details.