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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vo1x/tmdb

v1.0.0-beta.3

Published

Unofficial TypeScript/JavaScript SDK for The Movie Database (TMDb) API v3.

Downloads

10

Readme

@vo1x/tmdb


Features

  • Type-Safe: Automatically generated types from the TMDb OpenAPI spec ensure your code is correct.
  • Modern: Uses modern JavaScript (ES2022) and works in Node.js 18+ and browsers with native fetch.
  • Lightweight: Minimal dependencies and tree-shakeable to keep your project lean.
  • Comprehensive: Covers all major endpoints: movies, TV, search, trending, and configuration.
  • Clean Errors: Provides structured, useful errors for easier debugging.

Installation

# npm
npm install @vo1x/tmdb

# pnpm
pnpm add @vo1x/tmdb

# yarn
yarn add @vo1x/tmdb

Quick Start

import { TMDB } from "@vo1x/tmdb";

const tmdb = new TMDB({
  apiKey: process.env.TMDB_API_KEY!, // Get a key at [https://www.themoviedb.org/settings/api](https://www.themoviedb.org/settings/api)
});

// Get movie details
const movie = await tmdb.movies.get(550); // Fight Club
console.log(`${movie.title} (${movie.releaseDate}) - ${movie.voteAverage}/10`);

// Search for movies
const searchResults = await tmdb.search.movies("inception");
console.log(`Found ${searchResults.totalResults} movies.`);

API Reference

Movies

// Get movie details
const movie = await tmdb.movies.get(550, { language: "en-US" });

// Get credits
const credits = await tmdb.movies.credits(550);

// Get images
const images = await tmdb.movies.images(550);

// Get recommendations and similar movies
const recommendations = await tmdb.movies.recommendations(550);
const similar = await tmdb.movies.similar(550);

TV Shows

// Get TV show details
const show = await tmdb.tv.get(1399); // Game of Thrones

// Get credits, images, recommendations, etc.
const credits = await tmdb.tv.credits(1399);
const images = await tmdb.tv.images(1399);

Search

// Search for movies, TV shows, or people
const movies = await tmdb.search.movies("batman", { page: 1, includeAdult: false });
const tvShows = await tmdb.search.tv("breaking bad");
const people = await tmdb.search.people("leonardo dicaprio");

// Search across all types
const results = await tmdb.search.multi("marvel");

Trending

// Get daily or weekly trending content
const dailyTrending = await tmdb.trending.daily();
const weeklyTrending = await tmdb.trending.weekly();

Configuration

// Get API configuration, countries, languages, etc.
const config = await tmdb.configuration.get();
const countries = await tmdb.configuration.countries();

Person

// Get person details
const person = await tmdb.person.get(287); // Christian Bale

// Get images and combined credits
const images = await tmdb.person.images(287);
const credits = await tmdb.person.combinedCredits(287);

Error Handling

The SDK throws a TMDBError for API or network issues.

import { TMDB, TMDBError } from "@vo1x/tmdb";

try {
  await tmdb.movies.get(999999999); // Invalid ID
} catch (error) {
  if (error instanceof TMDBError) {
    console.error(`Error ${error.status}: ${error.message}`);
    // error.code contains the TMDb-specific error code
  }
}

Examples

The examples/ directory contains more detailed examples for each module.

Running Examples

# Run a specific example
pnpm example:movie

# Or run with your API key
TMDB_API_KEY=your_api_key pnpm example:movie

Configuration Options

const tmdb = new TMDB({
  apiKey: "your_api_key",     // Required
  baseUrl?: "custom_url",     // Optional
  language?: "en-US",         // Optional
});

Contributing

Contributions are welcome. Feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.