A typed TypeScript wrapper for the AniList GraphQL API and the MyAnimeList REST API. One class exposes two isolated provider namespaces. Every operation with inputs takes a single typed params object plus an optional trailing options object. Normalized errors, retries, pacing, and caching work identically on both. Import the root package for both providers, or scope imports to one provider with the anilink-api-wrapper/anilist and anilink-api-wrapper/mal subpaths.
npm install anilink-api-wrapperRequires Node.js 22 or later. The package is ESM-only, so use import syntax, not CommonJS require.
import { AniLink } from "anilink-api-wrapper";
// AniList (GraphQL) needs no token for public queries
const aniLink = new AniLink();
const anime = await aniLink.anilist.query.media({ id: 21, type: "ANIME" });
// MyAnimeList (REST) has its own credential slot
const client = new AniLink({ mal: { accessToken: "mal-token" } });
const malAnime = await client.mal.anime.get(
{ id: 21 },
{ fields: ["id", "title", "main_picture"] }
);- Queries and mutations. 25 typed queries (
user,media,character,staff,studio,review,thread, and more) and 29 typed mutations covering list entries, activities, replies, reviews, threads, and favourites. - Page queries. 18 paginated reads under
query.page(medias,characters,airingSchedules,notifications, and more). Each returns its items plusPageInfo. - Custom documents.
custom()andcustomPage()send your own GraphQL documents with the same validation, transport, and caching as the built-in operations. - Pagination.
paginate,paginatePages, andpaginateChunkswalk multi-page results, stopping at the server-reported last page. - Data helpers.
fuzzyDatebuildsFuzzyDateInputobjects for list-entry mutations,fuzzyDateIntbuilds theYYYYMMDDintegers that query filters take,flattenMediaListCollectionflattens list collections,crossLinkbuilds AniList-to-MAL id maps fromidMal, andmapExternalIdsmaps ids in either direction through ARM. - Watchers.
watch.notificationsandwatch.activitypoll AniList and yield new items as async generators.
- Reads.
anime.get,manga.get,user.me,user.get,anime.search,manga.search,seasonal,anime.ranking,manga.ranking,suggestions,user.animeList,user.mangaList, and theforum.boards,forum.topics, andforum.topicforum reads. Thefieldsoption selects the response shape. - Writes.
updateMyListStatusanddeleteFromListon bothanimeandmanga. - Pagination.
paginateandpaginatePageswalk the paginated list endpoints.
Both namespaces share one transport layer, which handles timeouts, retries, pacing, circuit breaking, hooks, automatic token refresh, and an opt-in response cache. Each provider slot has its own credentials and transport settings.
| Docs | Start here |
|---|---|
| Guides | Introduction · Getting started · Provider configuration · Per-request options · Error handling · Retries & resilience · Cancellation & timeouts · Observability · Recipes · TypeScript patterns · Troubleshooting · Response cache |
| AniList guides | Authentication · Client configuration · Querying · Page queries · Pagination · Mutations · Custom queries · Field selection · Helpers · Watchers · Complete examples |
| MAL guides | Authentication · Client configuration · Operations · Pagination · Complete examples |
| Operation reference | Overview · AniList catalog · MAL catalog |
| API reference (TypeDoc) | AniLink class; the full generated reference is at the docs root |
npm install # install dependencies
npm run check # typecheck, lint, tests, format, JSDoc, api-compare, build
npm run check:fast # typecheck, lint, and tests only
npm run docs:generate # TypeDoc + operation reference + guides site into docs/
npm run docs:dev # serve the guides site locallySee the contributing guide for workflow details.
