npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aniflixx/partner-sdk

v1.0.1

Published

The official Aniflixx Partner SDK for accessing studio content and analytics.

Readme

Aniflixx Partner SDK

The official JavaScript/TypeScript SDK for Aniflixx Partner API. Access anime, manga, and other content from Aniflixx's platform for integration into your own applications.

Features

  • 🔐 Secure Authentication - Token-based authentication with automatic renewal
  • 📚 Content Catalog - Access to licensed anime, manga, and webtoon content
  • 🎬 Streaming - Get stream URLs for video and manga content
  • 🔍 Search - Search through available content
  • 📊 Analytics - Track your API usage and content performance
  • 🔄 Auto-Retry - Automatic retry logic with exponential backoff
  • 📱 Universal - Works in Node.js and browsers
  • 🎯 TypeScript - Full TypeScript support with complete type definitions

Installation

npm install @aniflixx/partner-sdk

Quick Start

const AnimeSDK = require('@aniflixx/partner-sdk');

// Initialize SDK with your credentials
const sdk = new AnimeSDK({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret'
});

// Authenticate
await sdk.authenticate();

// Get content catalog
const catalog = await sdk.getContentCatalog();
console.log(`Found ${catalog.total_series} series`);

// Get episode stream
const stream = await sdk.getEpisodeStream('episode-id');
console.log('Stream URL:', stream.stream_data.stream_url);

Configuration

Options

const sdk = new AnimeSDK({
  apiKey: 'your-api-key',        // Required: Your Partner API key
  apiSecret: 'your-api-secret',  // Required: Your Partner API secret
  baseURL: 'https://...',        // Optional: Custom API base URL (defaults to production)
  autoRetry: true,               // Optional: Enable automatic retries (default: true)
  maxRetries: 3                  // Optional: Maximum retry attempts (default: 3)
});

Authentication

The SDK handles authentication automatically. You only need to provide your API credentials during initialization.

const sdk = new AnimeSDK({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret'
});

// Authenticate (called automatically on first API request)
const authResponse = await sdk.authenticate();

// Authentication tokens are cached and renewed automatically
// Token expires in 24 hours

To manually clear authentication (force re-authentication):

sdk.clearAuth();

API Methods

Get Content Catalog

Retrieve all series and episodes available to your partner account.

const catalog = await sdk.getContentCatalog();

console.log(`Partner ID: ${catalog.partner_id}`);
console.log(`Total Series: ${catalog.total_series}`);

catalog.content.forEach(series => {
  console.log(`${series.title} (${series.type})`);
  console.log(`  Episodes: ${series.episodes.length}`);
  console.log(`  Views: ${series.view_count}`);
});

Response:

{
  success: boolean;
  partner_id: string;
  total_series: number;
  content: Array<{
    id: string;
    title: string;
    title_english?: string;
    type: 'anime' | 'manga' | 'webtoon' | 'light_novel';
    description?: string;
    cover_image?: string;
    status: string;
    view_count: number;
    genres: string[];
    tags: string[];
    episodes: Episode[];
  }>;
}

Get Series Details

Get detailed information about a specific series including all episodes.

const series = await sdk.getSeries('series-id');

console.log(`Title: ${series.series.title}`);
console.log(`Type: ${series.series.type}`);
console.log(`Episodes: ${series.episodes.length}`);

Get Episode Stream

Get streaming URLs for video content or page URLs for manga/webtoon content.

const stream = await sdk.getEpisodeStream('episode-id');

if (stream.episode.type === 'video') {
  console.log('Video URL:', stream.stream_data.stream_url);
} else if (stream.episode.type === 'manga') {
  console.log('Pages:', stream.stream_data.pages.length);
  stream.stream_data.pages.forEach((page, index) => {
    console.log(`Page ${index + 1}: ${page.url}`);
  });
}

Search Content

Search through available content by title.

const results = await sdk.searchContent('naruto');

console.log(`Found ${results.total} results`);
results.results.forEach(series => {
  console.log(`- ${series.title} (${series.type})`);
});

Get Analytics

Get analytics about your API usage and content performance.

const analytics = await sdk.getAnalytics();

console.log('Stats:', analytics.stats);
console.log(`Total Episodes Accessed: ${analytics.stats.total_episodes_accessed}`);
console.log(`Total Views: ${analytics.stats.total_views}`);
console.log(`Series Accessed: ${analytics.stats.total_series_accessed}`);

console.log('\nTop Series:');
analytics.top_series.forEach((series, index) => {
  console.log(`${index + 1}. ${series.title} - ${series.total_views} views`);
});

Error Handling

The SDK throws AnimeSDKError for API errors:

try {
  const catalog = await sdk.getContentCatalog();
} catch (error) {
  if (error instanceof AnimeSDK.AnimeSDKError) {
    console.error('API Error:', error.message);
    console.error('Status Code:', error.statusCode);
    console.error('Response:', error.response);
  } else {
    console.error('Network Error:', error.message);
  }
}

Common Error Codes

  • 400 - Bad Request (missing or invalid parameters)
  • 401 - Unauthorized (invalid credentials or expired token)
  • 403 - Forbidden (no access to requested resource)
  • 404 - Not Found (resource doesn't exist)
  • 429 - Too Many Requests (rate limit exceeded)
  • 500 - Internal Server Error

Examples

See the examples directory for complete integration examples:

TypeScript Support

The SDK includes complete TypeScript definitions:

import AnimeSDK, { 
  AnimeSDKOptions, 
  ContentCatalogResponse,
  EpisodeStreamResponse,
  AnalyticsResponse 
} from '@aniflixx/partner-sdk';

const sdk = new AnimeSDK({
  apiKey: process.env.ANIFLIXX_API_KEY!,
  apiSecret: process.env.ANIFLIXX_API_SECRET!
});

const catalog: ContentCatalogResponse = await sdk.getContentCatalog();

Best Practices

1. Store Credentials Securely

Never commit credentials to version control. Use environment variables:

const sdk = new AnimeSDK({
  apiKey: process.env.ANIFLIXX_API_KEY,
  apiSecret: process.env.ANIFLIXX_API_SECRET
});

2. Handle Errors Gracefully

Always wrap SDK calls in try-catch blocks:

try {
  const catalog = await sdk.getContentCatalog();
  // Process catalog
} catch (error) {
  // Log error and show user-friendly message
  console.error('Failed to fetch catalog:', error);
}

3. Reuse SDK Instance

Create one SDK instance and reuse it throughout your application:

// sdk.js
const AnimeSDK = require('@aniflixx/partner-sdk');

const sdk = new AnimeSDK({
  apiKey: process.env.ANIFLIXX_API_KEY,
  apiSecret: process.env.ANIFLIXX_API_SECRET
});

module.exports = sdk;

4. Respect Rate Limits

The Partner API has rate limits. Implement caching where appropriate:

// Cache catalog data for 5 minutes
const cache = new Map();
const CACHE_TTL = 5 * 60 * 1000;

async function getCachedCatalog() {
  const cached = cache.get('catalog');
  if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
    return cached.data;
  }
  
  const catalog = await sdk.getContentCatalog();
  cache.set('catalog', { data: catalog, timestamp: Date.now() });
  return catalog;
}

5. Monitor Analytics

Regularly check your API usage:

// Check analytics daily
setInterval(async () => {
  const analytics = await sdk.getAnalytics();
  console.log('Daily API usage:', analytics.stats);
}, 24 * 60 * 60 * 1000);

Browser Usage

The SDK works in browsers via UMD build:

<script src="node_modules/@aniflixx/partner-sdk/dist/index.umd.js"></script>
<script>
  const sdk = new AniflixxSDK({
    apiKey: 'your-api-key',
    apiSecret: 'your-api-secret'
  });
  
  sdk.authenticate().then(() => {
    return sdk.getContentCatalog();
  }).then(catalog => {
    console.log('Catalog:', catalog);
  });
</script>

Note: For security, avoid exposing API credentials in client-side code. Use a backend proxy instead.

Rate Limits

  • Authentication: 10 requests per minute
  • Content Endpoints: 100 requests per minute per partner
  • Streaming Endpoints: 100 requests per minute per partner

Rate limits are enforced per partner account. If you exceed limits, you'll receive a 429 Too Many Requests error.

Support

License

MIT License - see LICENSE file for details

Changelog

1.0.0 (Current)

  • Initial release
  • Authentication flow
  • Content catalog access
  • Episode streaming
  • Content search
  • Analytics tracking
  • Auto-retry with exponential backoff
  • TypeScript support