{"_id":"@abdosaiko20/tmdb-api","name":"@abdosaiko20/tmdb-api","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.8":{"name":"@abdosaiko20/tmdb-api","version":"1.0.8","description":"A professional, type-safe TMDB API wrapper for movies and TV shows","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","dev":"tsup src/index.ts --format cjs,esm --dts --watch","prepublishOnly":"npm run build"},"keywords":["tmdb","movies","tv","shows","api","typescript","react","nextjs","server-side"],"author":{"name":"Abdelrahman"},"license":"MIT","devDependencies":{"tsup":"^8.0.0","typescript":"^5.3.0"},"engines":{"node":">=16"},"_id":"@abdosaiko20/tmdb-api@1.0.8","gitHead":"f8be3a040c002175fdb3bfe1c8262ea1931bac64","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-MXW7ZI5SMCwpkDAfhhW4pTxm2K3N9SCl0Mhyi2Ln+rhH07hletCbZABxJ29vqbHADGA4iYUi7XCulrV6qphdBA==","shasum":"83ab4b321639342d4100e40fb4a4ae1976112c45","tarball":"https://registry.npmjs.org/@abdosaiko20/tmdb-api/-/tmdb-api-1.0.8.tgz","fileCount":6,"unpackedSize":60732,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCVb6zYbScc+TiqYVz649Edsy0IwSlZeLAuLOUC4ALD7gIgeYAhEbV8kQ9pegj0eSNRD5VurFaSNsTeG/KuZMl8vt8="}]},"_npmUser":{"name":"abdosaiko20","email":"mxamxa1200@gmail.com"},"directories":{},"maintainers":[{"name":"abdosaiko20","email":"mxamxa1200@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tmdb-api_1.0.8_1783098736353_0.9439069605854584"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T17:12:16.195Z","1.0.8":"2026-07-03T17:12:16.505Z","modified":"2026-07-03T17:12:16.712Z"},"maintainers":[{"name":"abdosaiko20","email":"mxamxa1200@gmail.com"}],"description":"A professional, type-safe TMDB API wrapper for movies and TV shows","keywords":["tmdb","movies","tv","shows","api","typescript","react","nextjs","server-side"],"author":{"name":"Abdelrahman"},"license":"MIT","readme":"## README.md\n\n```markdown\n# tmdb-api-v1\n\nA professional, type-safe TMDB API wrapper for movies and TV shows. Built for server-side rendering and Node.js with zero browser APIs.\n\n---\n\n## Features\n\n- Complete TMDB API coverage for movies and TV shows\n- Smart genre helpers with automatic genre ID mapping\n- Image URL builder for posters, backdrops, and profiles\n- Streaming URL generator for movies and TV episodes\n- Full TypeScript support with strict mode and exported interfaces\n- Server-side compatible (Node.js, Next.js, Express, Remix, Astro)\n- Tree-shakeable with CJS and ESM support\n- Professional error handling with meaningful messages\n\n---\n\n## Installation\n\n```bash\nnpm install tmdb-api-v1\n```\n\n```bash\npnpm add tmdb-api-v1\n```\n\n```bash\nyarn add tmdb-api-v1\n```\n\n---\n\n## Quick Start\n\n```typescript\nimport { TMDB } from 'tmdb-api-v1';\n\nconst api = new TMDB({\n  apiKey: process.env.TMDB_API_KEY\n});\n\n// Get popular movies\nconst movies = await api.movies.popular();\n\n// Search for a movie\nconst results = await api.search.movie('Inception');\n\n// Generate streaming URL\nconst url = api.player.movie(27205);\n```\n\n---\n\n## Configuration\n\n```typescript\nconst api = new TMDB({\n  apiKey: 'your_api_key_here',\n  baseUrl: 'https://api.themoviedb.org/3',\n  timeout: 10000\n});\n```\n\nGet your API key at: https://www.themoviedb.org/settings/api\n\n---\n\n## API Reference\n\n### Movies\n\n```typescript\n// Discovery\nawait api.movies.popular(page?: number)\nawait api.movies.trending(window?: 'day' | 'week')\nawait api.movies.nowPlaying(page?: number)\nawait api.movies.upcoming(page?: number)\nawait api.movies.topRated(page?: number)\nawait api.movies.latest()\n\n// Details\nawait api.movies.details(movieId: number)\nawait api.movies.cast(movieId: number)\nawait api.movies.videos(movieId: number)\nawait api.movies.images(movieId: number)\nawait api.movies.recommendations(movieId: number)\nawait api.movies.similar(movieId: number)\nawait api.movies.reviews(movieId: number)\n```\n\n### TV Shows\n\n```typescript\n// Discovery\nawait api.tv.popular(page?: number)\nawait api.tv.trending(window?: 'day' | 'week')\nawait api.tv.topRated(page?: number)\nawait api.tv.airingToday(page?: number)\nawait api.tv.onTheAir(page?: number)\n\n// Details\nawait api.tv.details(tvId: number)\nawait api.tv.cast(tvId: number)\nawait api.tv.videos(tvId: number)\nawait api.tv.images(tvId: number)\nawait api.tv.recommendations(tvId: number)\nawait api.tv.similar(tvId: number)\nawait api.tv.reviews(tvId: number)\n\n// Seasons & Episodes\nawait api.tv.seasonDetails(tvId: number, seasonNumber: number)\nawait api.tv.episodeDetails(tvId: number, seasonNumber: number, episodeNumber: number)\n```\n\n### Genre Helpers\n\nAll genre methods automatically exclude documentaries:\n\n```typescript\nawait api.movies.action()\nawait api.movies.adventure()\nawait api.movies.animation()\nawait api.movies.cartoon()\nawait api.movies.comedy()\nawait api.movies.crime()\nawait api.movies.drama()\nawait api.movies.family()\nawait api.movies.kids()\nawait api.movies.fantasy()\nawait api.movies.history()\nawait api.movies.horror()\nawait api.movies.music()\nawait api.movies.mystery()\nawait api.movies.romance()\nawait api.movies.scienceFiction()\nawait api.movies.thriller()\nawait api.movies.war()\nawait api.movies.western()\n```\n\n### Search\n\n```typescript\nawait api.search.movie(query: string, page?: number)\nawait api.search.tv(query: string, page?: number)\nawait api.search.multi(query: string, page?: number)\nawait api.search.person(query: string, page?: number)\n```\n\n### Player URLs\n\n```typescript\n// Movie streaming URL\napi.player.movie(609681)\n// Returns: https://www.2embed.cc/embed/609681\n\n// TV episode streaming URL\napi.player.tv(60735, 1, 1)\n// Returns: https://www.2embed.cc/embedtv/60735&s=1&e=1\n```\n\n### Image Helpers\n\n```typescript\nimport { image } from 'tmdb-api-v1';\n\nimage.poster(path)\nimage.backdrop(path)\nimage.profile(path)\nimage.original(path)\nimage.w500(path)\nimage.w780(path)\nimage.w1280(path)\nimage.w342(path)\nimage.w185(path)\nimage.w154(path)\nimage.w92(path)\n```\n\n---\n\n## Usage Examples\n\n### Next.js App Router (Server Component)\n\n```typescript\nimport { TMDB, image } from 'tmdb-api-v1';\n\nconst api = new TMDB({\n  apiKey: process.env.TMDB_API_KEY!\n});\n\nexport default async function MoviesPage() {\n  const { results } = await api.movies.popular();\n  \n  return (\n    <div>\n      {results.map((movie) => (\n        <div key={movie.id}>\n          <img \n            src={image.poster(movie.poster_path)!} \n            alt={movie.title} \n          />\n          <h3>{movie.title}</h3>\n          <p>Rating: {movie.vote_average}</p>\n        </div>\n      ))}\n    </div>\n  );\n}\n```\n\n### Express.js API\n\n```typescript\nimport express from 'express';\nimport { TMDB, TMDBError } from 'tmdb-api-v1';\n\nconst app = express();\nconst api = new TMDB({ \n  apiKey: process.env.TMDB_API_KEY! \n});\n\napp.get('/api/movies/popular', async (req, res) => {\n  try {\n    const movies = await api.movies.popular();\n    res.json(movies);\n  } catch (error) {\n    if (error instanceof TMDBError) {\n      return res.status(error.statusCode).json({ \n        error: error.message \n      });\n    }\n    res.status(500).json({ error: 'Internal server error' });\n  }\n});\n\napp.listen(3000, () => {\n  console.log('Server running on port 3000');\n});\n```\n\n### Genre-Based Discovery\n\n```typescript\nasync function getMoviesByGenre(genre: string) {\n  const genres = {\n    action: api.movies.action,\n    comedy: api.movies.comedy,\n    horror: api.movies.horror,\n    scifi: api.movies.scienceFiction,\n    romance: api.movies.romance\n  };\n  \n  const fetcher = genres[genre as keyof typeof genres];\n  \n  if (!fetcher) {\n    throw new Error(`Unknown genre: ${genre}`);\n  }\n  \n  return await fetcher();\n}\n\n// Usage\nconst actionMovies = await getMoviesByGenre('action');\nconst horrorMovies = await getMoviesByGenre('horror');\n```\n\n### Building a Movie Details Page\n\n```typescript\nasync function getMoviePage(movieId: number) {\n  const [movie, credits, videos] = await Promise.all([\n    api.movies.details(movieId),\n    api.movies.cast(movieId),\n    api.movies.videos(movieId)\n  ]);\n\n  const trailer = videos.results.find(v => v.type === 'Trailer');\n  const streamUrl = api.player.movie(movieId);\n\n  return {\n    movie,\n    cast: credits.cast.slice(0, 10),\n    trailer,\n    streamUrl\n  };\n}\n```\n\n---\n\n## Error Handling\n\n```typescript\nimport { TMDBError } from 'tmdb-api-v1';\n\ntry {\n  const movie = await api.movies.details(999999);\n} catch (error) {\n  if (error instanceof TMDBError) {\n    switch (error.statusCode) {\n      case 401:\n        console.error('Invalid API key');\n        break;\n      case 404:\n        console.error('Movie not found');\n        break;\n      case 429:\n        console.error('Rate limit exceeded');\n        break;\n      case 408:\n        console.error('Request timed out');\n        break;\n      default:\n        console.error(`Error: ${error.message}`);\n    }\n  }\n}\n```\n\n---\n\n## TypeScript Support\n\n```typescript\nimport type { \n  Movie, \n  MovieDetails, \n  TVShow, \n  TVShowDetails,\n  Cast, \n  Crew,\n  PaginatedResponse,\n  TMDBConfig \n} from '@abdesaiko20/tmdb-api';\n\n// All responses are fully typed\nconst movie: MovieDetails = await api.movies.details(550);\nconst { results, page, total_pages }: PaginatedResponse<Movie> = \n  await api.movies.popular();\n```\n\n---\n\n## Environment Support\n\n| Environment | Status |\n|-------------|--------|\n| Node.js 16+ | Supported |\n| Next.js App Router | Supported |\n| Next.js Pages Router | Supported |\n| Express.js | Supported |\n| Astro | Supported |\n| Remix | Supported |\n| Nuxt 3 | Supported |\n| Vercel Functions | Supported |\n\n---\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the package\nnpm run build\n\n# Watch mode for development\nnpm run dev\n```\n\nThe build output in `dist/` folder:\n- `index.js` - CommonJS\n- `index.mjs` - ES Modules\n- `index.d.ts` - TypeScript declarations\n\n---\n\n## Contributing\n\nContributions are welcome! Feel free to submit issues and pull requests.\n\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Open a Pull Request\n\n---\n\n## License\n\nMIT © abdosaiko20\n\n---\n\n## Support\n\nIf you find this package useful, please consider giving it a star on GitHub!\n```\n","readmeFilename":"README.md","_rev":"1-9221be6ced21a1337a1f4560c93b631b"}