> [!NOTE] > **API MAYBE Temporarily Paused** due to suspiciously too many requests. My hosted version of this API is only for testing purposes. You MUST host your own instance to use the API.

Stars Forks Issues Pull Requests Last Commit License

Node.js Express AniList GraphQL Vercel License Version Endpoints Providers

A complete RESTful API for anime streaming data powered by AniList GraphQL and Miruro providers
Search, browse, filter, watch β€” every endpoint returns fresh data with smart caching.
46 endpoints, 12 streaming providers, M3U8 URLs with subtitles, skip timestamps, and batch operations.

Table of Contents • Features • API Docs • Quick Start • Deployment • Contributing

--- > [!WARNING] > 1. This `API` does not store any files β€” it only links to media hosted on 3rd party services. > 2. This `API` is explicitly made for **educational purposes only** and not for commercial usage. This repo will not be responsible for any misuse of it. > 3. All anime data, images, and content belong to their respective owners (AniList, Miruro). This project is not affiliated with Miruro. --- ## πŸ“– Table of Contents - [Overview](#-overview) - [Features](#-features) - [Data Sources](#-data-sources) - [Tech Stack](#-tech-stack) - [Architecture](#-architecture) - [Project Structure](#-project-structure) - [Quick Start](#-quick-start) - [Configuration](#-configuration) - [API Endpoints](#-api-endpoints) - [Streaming Flow](#-streaming-flow) - [API Response Schema](#-api-response-schema) - [Deployment](#-deployment) - [Available Scripts](#-available-scripts) - [Performance](#-performance) - [Changelog Highlights](#-changelog-highlights) - [Troubleshooting](#-troubleshooting) - [FAQ](#-faq) - [Roadmap](#-roadmap) - [Contributing](#-contributing) - [Acknowledgements](#-acknowledgements) - [License](#-license) - [Author](#-author) - [Star History](#-star-history) --- ## 🌸 Overview **MiruroAPI** is a serverless anime data API that fetches real-time information from **AniList GraphQL** and streaming data from **Miruro providers** β€” including anime details, episode lists, M3U8 streaming URLs with subtitles and skip timestamps, search, filtering, characters, and more β€” all through a clean REST API with zero database. > πŸ’‘ No database, no auth, no complex setup. Just deploy to Vercel and you have a production API. ### Why MiruroAPI? - 🎬 **46 Endpoints** β€” Complete anime data coverage - πŸ” **Full-Text Search** β€” Search anime by keyword with suggestions - 🎭 **Characters & Voice Actors** β€” Full character data from AniList - 🎯 **Advanced Filtering** β€” Genre, year, season, format, sort - πŸ† **Trending & Popular** β€” Discover what's hot right now - πŸ“… **Airing Schedule** β€” See what's airing on any date - πŸ“‘ **12 Streaming Providers** β€” M3U8 streaming sources - ⏭️ **Skip Timestamps** β€” OP/ED skip data - 🎭 **Character & Staff Search** β€” Search characters and staff by name - 🎬 **Batch Episodes** β€” Fetch multiple episode sources in parallel - ⚑ **Smart Caching** β€” In-memory Map with configurable TTL - πŸ”’ **CORS Enabled** β€” Works from any frontend, no proxy needed - πŸš€ **Zero-Config Deploy** β€” One click to Vercel, or run standalone with Express ### πŸ”„ Self-Healing System (v2.3.0) When Cloudflare blocks streaming requests, the API automatically tries fallback methods: - **Direct** β†’ Mirror rotation across 4 domains (miruro.to, miruro.ru, miruro.bz, miruro.tv) - **ScraperAPI** β†’ Proxy bypass via premium residential IPs ($49/mo) - **FlareSolverr** β†’ Self-hosted browser proxy Zero-config: works out of the box. Add `SCRAPER_API_KEY` env var for automatic Cloudflare bypass (requires ScraperAPI premium plan for protected domains). ### ⚠️ Streaming Status > **Streaming endpoints (`/api/episodes`, `/api/watch`, `/api/sources`, `/api/stream`) return 500 errors when Cloudflare blocks pipe requests.** > > This is expected behavior on Vercel's free tier. Cloudflare's bot protection blocks requests from datacenter IPs (including Vercel's). Metadata endpoints (search, info, trending, etc.) work perfectly β€” only streaming is affected. | What Works | What's Blocked | |:---|:---| | Search, suggestions, filter | Episodes, sources, stream | | Info, characters, relations | Watch, download | | Trending, popular, schedule | All pipe-dependent endpoints | | Genres, tags, calendar | Streaming provider data | | All AniList-backed endpoints | | **To fix streaming**, set one of these environment variables in Vercel: ```bash # Option 1: ScraperAPI (requires premium plan β€” $49/month) SCRAPER_API_KEY=your_scraperapi_key # Option 2: FlareSolverr (self-hosted, unlimited) FLARESOLVERR_URL=http://your-flaresolverr-host:8191 ``` See [How to Fix Streaming](#-how-to-fix-streaming-issues) in Troubleshooting below. ### How It Works ```mermaid flowchart TD A["🌐 Client Request
(Browser / App / curl)"] --> B["πŸ›‘οΈ Express Server
CORS Β· Security Headers Β· Rate Limiting"] B --> C{"πŸ’Ύ Cache Check
(In-Memory Map)"} C -- HIT --> D["⚑ Return Cached Response
~50ms"] C -- MISS --> E{"πŸ” Which Source?"} E -- Metadata --> F["πŸ“‘ AniList GraphQL
graphql.anilist.co"] E -- Streaming --> G["πŸ“Ί Miruro Pipe
miruro.{to,ru,bz,tv}/api/secure/pipe"] F --> H["AniList Response
JSON"] G --> I["Pipe Response
base64url + gzip"] H --> J["Cache + Respond
JSON"] I --> J style A fill:#1e1e2e,stroke:#a78bfa,color:#f1f5f9 style B fill:#1e1e2e,stroke:#6366f1,color:#f1f5f9 style C fill:#1e1e2e,stroke:#f43f8e,color:#f1f5f9 style D fill:#1e1e2e,stroke:#22c55e,color:#f1f5f9 style E fill:#1e1e2e,stroke:#a855f7,color:#f1f5f9 style F fill:#1e1e2e,stroke:#06b6d4,color:#f1f5f9 style G fill:#1e1e2e,stroke:#eab308,color:#f1f5f9 style H fill:#1e1e2e,stroke:#06b6d4,color:#f1f5f9 style I fill:#1e1e2e,stroke:#eab308,color:#f1f5f9 style J fill:#1e1e2e,stroke:#22c55e,color:#f1f5f9 ``` --- ## ✨ Features
### ⚑ Core - **AniList GraphQL** for rich metadata - **Miruro pipe** for streaming sources - **Smart caching** with configurable TTL - **46 RESTful endpoints** - **Gzip compression** β€” 30-70% smaller responses - **Request logging** β€” method, path, status, duration - **Graceful error handling** per endpoint - **Rate limiting** (100 req/min per IP) ### πŸ” Data - **Full-text search** with pagination - **Autocomplete suggestions** for search - **Advanced filtering** β€” genre, year, season, format, sort - **Characters** with voice actors - **Relations** and **Recommendations** - **Airing schedule** by date - **Seasonal anime** by year + season - **Studio filter** β€” anime by studio name - **Character & Staff search**
### πŸ“‘ Streaming - **Episode lists** from 12 providers - **M3U8 streaming URLs** with resolution info - **Skip timestamps** (OP/ED) - **Download links** when available - **Sub/Dub** support per provider - **Codec and fansub** metadata - **Batch episode fetching** β€” multiple sources in parallel - **Quality fallback** β€” auto 1080p β†’ 720p β†’ 360p - **Subtitle extraction** β€” expose subtitle URLs ### πŸ›‘οΈ Reliability - **CORS enabled** β€” works from any frontend - **Error responses** with descriptive messages - **Input validation** β€” required params checked - **Timeout protection** β€” per request - **In-memory caching** β€” survives warm starts - **Zero database** β€” pure API + cache
### 🌟 Feature Highlights | Feature | Description | Status | |:---|:---|:---:| | 🎬 46 API Endpoints | Complete anime data coverage | βœ… | | πŸ” Full-Text Search | Keyword search with pagination | βœ… | | πŸ’‘ Search Suggestions | Fast autocomplete | βœ… | | 🎯 Advanced Filtering | Genre, year, season, format, sort | βœ… | | 🎭 Characters + Voice Actors | Full character data from AniList | βœ… | | πŸ”— Relations & Recommendations | Related anime discovery | βœ… | | ⏭️ Skip Timestamps | OP/ED skip data | βœ… | | πŸ“‘ 12 Streaming Providers | M3U8 streaming sources | βœ… | | πŸ”„ Smart Caching | In-memory Map with TTL | βœ… | | πŸš€ One-Click Deploy | Vercel button deployment | βœ… | | πŸ—οΈ Express Mode | Standalone server with `npm start` | βœ… | | 🐳 Docker Support | Containerized deployment | βœ… | --- ## πŸ—žοΈ Data Sources ### Metadata Source | Source | API | Data | |:---|:---|:---| | 🌸 **AniList** | `graphql.anilist.co` | Search, info, characters, relations, recommendations, filter, schedule | ### Streaming Source | Source | Domain | Data | |:---|:---|:---| | πŸ“Ί **Miruro** | `miruro.to` | Episodes, streaming sources (M3U8 URLs) | | πŸ“Ί **Miruro** | `miruro.ru` | Mirror domain | | πŸ“Ί **Miruro** | `miruro.bz` | Mirror domain | | πŸ“Ί **Miruro** | `miruro.tv` | Mirror domain | ### 🎬 Streaming Providers | Provider | Provider | Provider | Provider | |:---|:---|:---|:---| | πŸ₯ kiwi | 🐝 pewe | 🐻 bee | 🍯 bonk | | 🍌 bun | 🀝 ally | πŸ¦„ nun | πŸ‘― twin | | βš™οΈ cog | πŸ„ moo | 🐰 hop | πŸ“Ί telli | --- ## πŸ› οΈ Tech Stack | Technology | Purpose | Version | Documentation | |:---|:---|:---|:---| | 🟒 [Node.js](https://nodejs.org/) | JavaScript runtime | >= 20 | [Docs](https://nodejs.org/docs/) | | ⚑ [Express](https://expressjs.com/) | HTTP server framework | 4.21 | [Docs](https://expressjs.com/en/4x/api.html) | | β–² [Vercel Functions](https://vercel.com/docs/functions) | Serverless deployment | β€” | [Docs](https://vercel.com/docs/functions) | | 🌸 [AniList GraphQL](https://anilist.gitbook.io/anilist-apiv2-docs/) | Anime metadata API | β€” | [Docs](https://anilist.gitbook.io/anilist-apiv2-docs/) | | 🌐 [Axios](https://axios-http.com/) | HTTP client | 1.8 | [Docs](https://axios-http.com/docs/intro) | | πŸ”§ [dotenv](https://github.com/motdotla/dotenv) | Environment variables | 16.4 | [Docs](https://github.com/motdotla/dotenv) | | πŸ”’ [cors](https://github.com/expressjs/cors) | CORS middleware | 2.8 | [Docs](https://github.com/expressjs/cors) | ### πŸ“¦ Key Dependencies ```json { "express": "^4.21.0", // HTTP server "axios": "^1.8.0", // HTTP client "cors": "^2.8.5", // CORS middleware "dotenv": "^16.4.0" // Environment variables } ``` --- ## πŸ—οΈ Architecture ### Request Flow | Stage | Component | Description | |:-----:|-----------|-------------| | 1 | **Client** | Browser, app, or `curl` sends request | | 2 | **Express Server** | Routes request, applies CORS + security headers + rate limiting | | 3 | **Cache Check** | In-memory Map with TTL β€” hit = instant response | | 4 | **Fetch Data** | AniList GraphQL or Miruro pipe endpoint | | 5 | **Decode** | Pipe responses decoded: base64url β†’ gunzip β†’ JSON | | 6 | **Cache + Respond** | Store in cache, return JSON response | ### Caching Architecture ```mermaid flowchart TD A["πŸ“₯ Request"] --> B{"🧠 Memory Cache
(Map + TTL)"} B -- HIT --> C["⚑ Return Cached
~50ms"] B -- MISS --> D["πŸ“‘ Fetch from
AniList / Miruro"] D --> E["πŸ” Decode
base64url + gzip"] E --> F["πŸ’Ύ Cache Result
(1-5 min TTL)"] F --> G["πŸ“€ Return Fresh"] style A fill:#1e1e2e,stroke:#a78bfa,color:#f1f5f9 style B fill:#1e1e2e,stroke:#f43f8e,color:#f1f5f9 style C fill:#1e1e2e,stroke:#22c55e,color:#f1f5f9 style D fill:#1e1e2e,stroke:#6366f1,color:#f1f5f9 style E fill:#1e1e2e,stroke:#06b6d4,color:#f1f5f9 style F fill:#1e1e2e,stroke:#a855f7,color:#f1f5f9 style G fill:#1e1e2e,stroke:#22c55e,color:#f1f5f9 ``` > πŸ’‘ Serverless functions have read-only filesystems except `/tmp`. The cache uses in-memory `Map` which survives across warm invocations. --- ## πŸ“ Project Structure ``` MiruroAPI/ β”œβ”€β”€ πŸ“‚ public/ # 🌐 Static files β”‚ β”œβ”€β”€ πŸ“„ index.html # πŸ“– Premium landing page (real Miruro icons) β”‚ β”œβ”€β”€ πŸ“„ docs.html # πŸ“˜ Swagger UI interactive documentation β”‚ β”œβ”€β”€ πŸ“„ openapi.json # πŸ“‹ OpenAPI 3.0 spec β”‚ β”œβ”€β”€ πŸ“„ icon-dark.svg # πŸŒ™ Miruro dark mode favicon β”‚ β”œβ”€β”€ πŸ“„ icon-light.svg # β˜€οΈ Miruro light mode favicon β”‚ β”œβ”€β”€ πŸ“„ icon-512x512.png # πŸ“± Miruro app icon β”‚ β”œβ”€β”€ πŸ“„ favicon.ico # πŸ”– Classic favicon β”‚ β”œβ”€β”€ πŸ“„ apple-touch-icon-180x180.png # 🍎 iOS home screen icon β”‚ └── πŸ“„ og-image.png # πŸ–ΌοΈ OG/Twitter share image β”‚ β”œβ”€β”€ πŸ“‚ assets/ # 🎨 Scraped Miruro assets β”‚ β”œβ”€β”€ πŸ“‚ favicons/ # πŸ”– All favicon variants β”‚ β”œβ”€β”€ πŸ“‚ logos/ # 🏷️ Status page logo β”‚ β”œβ”€β”€ πŸ“‚ fonts/ # πŸ”€ Inter + FontAwesome β”‚ └── πŸ“‚ media/ # πŸ–ΌοΈ Testimonial avatars β”‚ β”œβ”€β”€ πŸ“‚ src/ # βš™οΈ Core logic β”‚ β”œβ”€β”€ πŸ“‚ helpers/ # πŸ› οΈ Integration modules β”‚ β”‚ β”œβ”€β”€ πŸ“„ anilist.js # 🌸 AniList GraphQL integration β”‚ β”‚ β”œβ”€β”€ πŸ“„ pipe.js # πŸ“Ί Miruro pipe integration β”‚ β”‚ └── πŸ“„ cache.js # πŸ’Ύ In-memory cache with TTL β”‚ β”‚ β”‚ └── πŸ“‚ routes/ # πŸ›€οΈ Express routes β”‚ └── πŸ“„ apiRoutes.js # 🌐 Main API routes (46 endpoints) β”‚ β”œβ”€β”€ πŸ“„ server.js # πŸš€ Express server entry point β”œβ”€β”€ πŸ“„ package.json # πŸ“¦ Dependencies & scripts β”œβ”€β”€ πŸ“„ vercel.json # β–² Vercel routing config β”œβ”€β”€ πŸ“„ Dockerfile # 🐳 Docker support β”œβ”€β”€ πŸ“„ .dockerignore # 🐳 Docker ignore β”œβ”€β”€ πŸ“„ CHANGELOG.md # πŸ“ Version history └── πŸ“„ README.md # πŸ“– This file ``` --- ## πŸš€ Quick Start ### Prerequisites | Requirement | Minimum | Recommended | |:---|:---|:---| | πŸ“¦ Node.js | 20.x | 20.x LTS | | πŸ“¦ npm | 9.0+ | 10.x | | πŸ’» OS | Windows, macOS, Linux | Any | ### πŸ”§ Installation ```bash # 1️⃣ Clone the repository git clone https://github.com/Shineii86/MiruroAPI.git cd MiruroAPI # 2️⃣ Install dependencies npm install # 3️⃣ Start development server npm run dev ``` > 🌐 Open [http://localhost:3000](http://localhost:3000) in your browser. ### πŸ—οΈ Build for Production ```bash # Start production server npm start ``` ### 🐳 Alternative Package Managers ```bash # Using yarn yarn install yarn dev # Using pnpm pnpm install pnpm dev # Using bun bun install bun dev ``` --- ## βš™οΈ Configuration ### Environment Variables | Variable | Default | Description | |:---|:---|:---| | `PORT` | `3000` | Server port (Express mode only) | | `ALLOWED_ORIGINS` | `*` | Comma-separated allowed origins (restricts CORS in production) | | `PIPE_OBF_KEY` | `71951034...` | Pipe response XOR obfuscation key (hex, 32 chars) | | `PRU_PROXY_KEY` | `a54d389c...` | PRU proxy URL XOR key (hex, 32 chars) | | `SCRAPER_API_KEY` | β€” | ScraperAPI key for Cloudflare bypass (requires premium plan, $49/mo) | | `FLARESOLVERR_URL` | β€” | FlareSolverr URL for browser-based bypass (e.g., `http://127.0.0.1:8191`) | > ⚠️ **Required for production:** Set `ALLOWED_ORIGINS` to restrict CORS. Set `PIPE_OBF_KEY` and `PRU_PROXY_KEY` for pipe decoding. > > πŸ“Ί **For streaming:** Set `SCRAPER_API_KEY` (requires ScraperAPI premium plan) or `FLARESOLVERR_URL` (free, self-hosted) to bypass Cloudflare bot protection. See [How to Fix Streaming Issues](#-how-to-fix-streaming-issues). ### Vercel Configuration The `vercel.json` file handles: - **Builds** β€” Maps `server.js` to `@vercel/node` - **Routes** β€” All requests forwarded to Express --- ## πŸ“‘ API Endpoints ### Base URL ``` https://mirurotvapi.vercel.app/api ``` ### Response Format All endpoints return: ```json { "success": true, "results": { ... } } ``` ### Streaming Flow To get a stream URL, follow these 3 steps: ```bash # Step 1: Get episodes (returns provider slugs) curl "https://mirurotvapi.vercel.app/api/episodes/20" # Step 2: Get streaming sources (pass provider + anilistId + category + slug) curl "https://mirurotvapi.vercel.app/api/watch/kiwi/20/sub/animepahe-1" # Step 3: Play M3U8 in any HLS player # Use hls.js, video.js, or native