Skip to content

nyawave/toki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toki

A fast, self-hosted, unofficial MyAnimeList API written in Go.

Toki turns public data from MyAnimeList into a clean JSON REST API. It covers anime, manga, characters, people, users, seasons, rankings, reviews, recommendations, and more without requiring MAL API credentials.

Toki is built with Fiber and goquery. It runs as a single binary, has no database, and is designed to be simple to deploy and easy to integrate.

Important

Toki is not affiliated with, maintained by, or endorsed by MyAnimeList. It reads public MAL pages, so upstream markup changes can temporarily break individual endpoints.

Why Toki?

  • No API key - access public MAL data without OAuth or developer credentials.
  • 70+ endpoints - one API for titles, people, communities, discovery, and user data.
  • Easy to self-host - one Go binary with no database or supporting services.
  • Small runtime footprint - a lightweight HTTP service built on Fiber.
  • Consistent JSON - typed response models with predictable snake_case fields.
  • Transparent errors - upstream MAL HTTP errors keep their original status code.
  • Broad discovery support - search filters, seasonal charts, schedules, rankings, reviews, recommendations, genres, producers, and magazines are available out of the box.

Quick Start

Toki requires Go 1.26 or newer.

Run it directly from the repository:

go run ./cmd/toki

Or build a standalone binary:

go build -o bin/toki ./cmd/toki
./bin/toki

The server listens locally on http://127.0.0.1:3000 by default. Set PORT to use a different port:

PORT=8080 ./bin/toki

Set HOST to control which network interface the server binds to. Keep it on 127.0.0.1 to allow connections only from the local machine:

HOST=127.0.0.1 PORT=8080 ./bin/toki

Use 0.0.0.0 to accept connections through all IPv4 network interfaces, such as when running Toki in Docker or making it available on a local network:

HOST=0.0.0.0 PORT=8080 ./bin/toki

Check that the service is running:

curl http://127.0.0.1:3000/
{"name":"toki","version":"1.0"}

Usage

Get an anime by its MAL ID:

curl http://localhost:3000/anime/52991

Search for anime:

curl "http://localhost:3000/search/anime?q=Frieren&type=tv&order_by=score&sort=desc"

Get the current season:

curl http://localhost:3000/seasons/now

Get the most popular anime:

curl "http://localhost:3000/top/anime?type=bypopularity&page=1"

Paginated endpoints accept ?page=N; invalid or missing page values fall back to page 1.

API Overview

Toki provides more than 70 read-only endpoints across the following areas:

  • anime and manga details, episodes, characters, staff, pictures, and statistics;
  • characters, people, clubs, producers, magazines, and genres;
  • search, rankings, seasonal charts, and weekly schedules;
  • reviews and recommendations;
  • public user profiles, lists, history, friends, and clubs;
  • recent and popular episodes and promotional videos.

All endpoints use GET and return JSON. Pagination, filters, accepted values, response schemas, and the complete endpoint reference are documented separately in the OpenAPI documentation, available as interactive docs at registry.scalar.com/@nyawave/apis/toki@1.0 or as the openapi.json file in this repository.

Only publicly available MAL data can be returned. Private profiles and lists remain inaccessible, just as they are on MyAnimeList.

Errors

Errors are returned as JSON:

{"error":"404 on https://myanimelist.net/anime/0"}

Invalid endpoint parameters or supported query values return 400. HTTP errors received from MAL, such as 403, 404, or 429, are passed through with the same status code. Network and parsing failures return 500.

Project Structure

cmd/toki/          application entrypoint and routes
internal/handler/  HTTP handlers and parameter validation
internal/mal/      MyAnimeList HTTP client
internal/model/    JSON response models
internal/parser/   HTML parsers
internal/request/  MAL URL builders
internal/helper/   shared parsing utilities

Operational Notes

Toki fetches MAL when an endpoint is called. It does not currently include a response cache or rate limiter. For a public deployment, put it behind a reverse proxy, cache suitable responses, set request limits, and avoid sending more traffic to MyAnimeList than necessary.

Because Toki relies on public HTML rather than an official contract, response availability depends on MyAnimeList. Please use it responsibly and comply with the applicable MyAnimeList terms and policies.

Acknowledgements

Toki owes a great deal to Jikan and the people who maintained it over the years. As Jikan approaches its sunset in October, thank you for building the project that made unofficial access to MyAnimeList practical for an entire community.

About

A fast, self-hosted, unofficial MyAnimeList API written in Go

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages