https://github.com/tutkli/jikan-ts
Jikan API wrapper for Typescript and NodeJS with built in typings.
https://github.com/tutkli/jikan-ts
jikan jikan-api my-anime-list my-anime-list-api myanimelist myanimelist-api nodejs typescript wrapper wrapper-api
Last synced: 2 months ago
JSON representation
Jikan API wrapper for Typescript and NodeJS with built in typings.
- Host: GitHub
- URL: https://github.com/tutkli/jikan-ts
- Owner: tutkli
- License: mit
- Created: 2022-11-09T17:55:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-22T10:30:01.000Z (2 months ago)
- Last Synced: 2026-03-23T01:16:22.896Z (2 months ago)
- Topics: jikan, jikan-api, my-anime-list, my-anime-list-api, myanimelist, myanimelist-api, nodejs, typescript, wrapper, wrapper-api
- Language: TypeScript
- Homepage:
- Size: 1.13 MB
- Stars: 42
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jikan-ts






> Jikan API wrapper for TypeScript and Node.js with built-in typing.
## Features
- 💅 Fully typed
- ♻ Built-in in-memory response cache (TTL-based)
- 📄 Request logging
- 📦 ESM with tree shaking support
## Installation
### Full client (with ky)
```bash
npm install @tutkli/jikan-ts ky
```
### Types only (zero runtime dependencies)
If you want to use the types and endpoint constants to build your own HTTP client:
```bash
npm install @tutkli/jikan-ts
```
## Example
### Using the types-only import
```ts
import type { Anime, JikanResponse } from '@tutkli/jikan-ts/types'
import { AnimeEndpoints, BASE_URL } from '@tutkli/jikan-ts/types'
// Build your own HTTP client using the provided types and endpoints
const response = await fetch(
`${BASE_URL}${AnimeEndpoints.AnimeById.replace('{id}', '1')}`
)
const data: JikanResponse = await response.json()
```
### Using a specific client, like **AnimeClient**
```ts
import { AnimeClient, JikanResponse, Anime } from '@tutkli/jikan-ts'
const animeClient = new AnimeClient()
animeClient.getAnimeById(1).then((response: JikanResponse) => {
/* ... */
})
```
### Using the **JikanClient**
```ts
import { JikanClient, JikanResponse, Anime } from '@tutkli/jikan-ts'
const jikanClient = new JikanClient()
jikanClient.anime.getAnimeById(1).then((response: JikanResponse) => {
/* ... */
})
```
## Client configuration
### Cache Configuration
Jikan-ts uses a built-in in-memory cache with TTL-based expiry (default: 5 minutes).
To customize the cache, pass the `cacheOptions` argument when instantiating a client:
```ts
import { AnimeClient } from '@tutkli/jikan-ts'
const animeClient = new AnimeClient({
cacheOptions: { ttl: 10 * 60 * 1000 } // 10 minutes
})
```
### Custom Ky Instance
Jikan-ts uses [Ky](https://github.com/sindresorhus/ky) as its HTTP client. You can provide your own Ky instance via the optional `kyInstance` argument:
```ts
import { AnimeClient } from '@tutkli/jikan-ts'
import ky from 'ky'
const animeClient = new AnimeClient({
kyInstance: ky.create({
/* ... */
})
})
```
### Logging
To enable logging, pass the `enableLogging` argument as `true`.
```ts
import { AnimeClient } from '@tutkli/jikan-ts'
const animeClient = new AnimeClient({
enableLogging: true
})
```
## Leave your feedback
- Did you find this project useful? [Leave a ⭐](https://github.com/tutkli/jikan-ts)
- Found a problem? [Create an issue 🔎](https://github.com/tutkli/jikan-ts/issues)
- Want to contribute? [Submit a PR 📑](https://github.com/tutkli/jikan-ts/pulls)