A fast, secure, and easy-to-use serverless proxy for the Anilist GraphQL API, deployable on Vercel in seconds.
- π CORS enabled - Works seamlessly with web applications
- π Authentication support - Forwards authorization headers for authenticated requests
- π‘οΈ Error handling - Comprehensive error logging and user-friendly responses
- β‘ Serverless ready - Zero-config deployment on Vercel
- π― Drop-in replacement - Compatible with existing Anilist API implementations
- π Rate limiting friendly - Respects Anilist's API guidelines
Click the button above to deploy your own instance in under 30 seconds!
Or manually:
- Fork this repository
- Connect to Vercel
- Deploy with default settings
- Your API is ready! π
Once deployed, your proxy will be available at:
| Endpoint | Description |
|---|---|
https://your-app.vercel.app/api/graphql |
Main GraphQL endpoint |
https://your-app.vercel.app/graphql |
Aliased endpoint (shorter URL) |
const query = `
query ($id: Int) {
Media (id: $id, type: ANIME) {
id
title {
romaji
english
native
}
description
episodes
status
averageScore
}
}
`;
const variables = {
id: 15125
};
fetch('https://your-app.vercel.app/api/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
variables: variables
})
})
.then(response => response.json())
.then(data => console.log(data));const query = `
query {
Viewer {
id
name
avatar {
large
}
statistics {
anime {
count
meanScore
}
}
}
}
`;
fetch('https://your-app.vercel.app/api/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
body: JSON.stringify({ query })
})
.then(response => response.json())
.then(data => console.log(data));const searchAnime = async (searchTerm) => {
const query = `
query ($search: String) {
Page (perPage: 10) {
media (search: $search, type: ANIME) {
id
title {
romaji
english
}
coverImage {
medium
large
}
startDate {
year
}
averageScore
genres
}
}
}
`;
const response = await fetch('https://your-app.vercel.app/api/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query,
variables: { search: searchTerm }
})
});
return response.json();
};
// Usage
searchAnime('Attack on Titan').then(console.log);import axios from 'axios';
const client = axios.create({
baseURL: 'https://your-app.vercel.app',
headers: {
'Content-Type': 'application/json',
}
});
const getAnimeDetails = async (animeId) => {
const query = `
query ($id: Int) {
Media (id: $id, type: ANIME) {
title { romaji }
description
episodes
status
genres
studios {
nodes {
name
}
}
}
}
`;
try {
const response = await client.post('/api/graphql', {
query,
variables: { id: animeId }
});
return response.data;
} catch (error) {
console.error('Error fetching anime:', error);
}
};- Node.js 18+
- npm or yarn
# Clone the repository
git clone https://github.com/Itzmepromgitman/Anilist-Api.git
# Navigate to project directory
cd Anilist-Api
# Install dependencies
npm install
# Start development server
npm run devYour proxy will be available at http://localhost:3000/api/graphql
Create a .env.local file for custom configuration:
# Optional: Custom Anilist API URL (defaults to https://graphql.anilist.co)
ANILIST_API_URL=https://graphql.anilist.co
# Optional: Enable debug logging
DEBUG=trueThe proxy automatically forwards these headers:
Authorization- For authenticated requestsContent-Type- Request content typeUser-Agent- Client identification
Get Trending Anime
query {
Page (perPage: 20) {
media (type: ANIME, sort: TRENDING_DESC) {
id
title {
romaji
english
}
coverImage {
large
}
averageScore
genres
}
}
}Get User's Anime List
query ($userName: String) {
MediaListCollection (userName: $userName, type: ANIME) {
lists {
name
entries {
media {
title {
romaji
}
}
score
status
}
}
}
}Get Anime by Genre
query ($genre: String) {
Page (perPage: 25) {
media (type: ANIME, genre: $genre, sort: POPULARITY_DESC) {
id
title {
romaji
}
description
episodes
averageScore
popularity
}
}
}The proxy provides detailed error responses:
{
"errors": [
{
"message": "Error description",
"locations": [...],
"path": [...]
}
]
}Common error scenarios:
- 400 Bad Request - Invalid GraphQL query
- 401 Unauthorized - Invalid or missing authorization token
- 429 Too Many Requests - Rate limit exceeded
- 500 Internal Server Error - Proxy or upstream API error
This proxy respects Anilist's rate limiting:
- 90 requests per minute for authenticated requests
- 60 requests per minute for anonymous requests
The proxy will forward rate limit headers from Anilist API.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Anilist GraphQL Documentation
- Anilist GraphQL Explorer
- Vercel Documentation
- GraphQL Learning Resources
Made with β€οΈ for the anime community
β Star this repo β’ π Report Bug β’ π‘ Request Feature