Skip to content

Secure TMDB API Proxy – A lightweight Node.js + Express proxy for fetching movie data from TMDB without exposing your API key, optimized for React Native and Expo apps.

Notifications You must be signed in to change notification settings

netesheng/tmdb-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TMDB Proxy

A lightweight Node.js + Express proxy server for the TMDB API, designed to securely fetch movie data for React Native, Expo, and web applications without exposing your API key.
Perfect for handling TMDB requests in regions where direct access is limited, e.g: India.


🚀 Features

  • Fetch popular movies and search for any title
  • Securely uses API Key and Bearer Token stored in .env.local
  • Easy to deploy on Vercel for serverless hosting
  • Prevents exposing your TMDB credentials in client apps

📂 Project Structure

tmdb-proxy/
 ├─ api/
 │   └─ index.js        # Express API routes
 ├─ package.json
 ├─ vercel.json         # Optional route rewrites for clean URLs
 └─ .gitignore

⚙️ Setup & Installation

  1. Clone the repository

    git clone https://github.com/ftashmit/tmdb-proxy.git
    cd tmdb-proxy
  2. Install dependencies

    npm install
  3. Create a .env.local file in the root:

    TMDB_API_KEY=your_api_key_here
    TMDB_BEARER_TOKEN=your_read_access_token_here
  4. Run locally

    npm run dev
  5. Access Endpoints for testing

    • http://localhost:3000/api/movies/popular
    • http://localhost:3000/api/movies/search?query=Inception
    • http://localhost:3000/api/tmdb/movie/550

☁️ Deploy on Vercel

  1. Push your repo to GitHub
  2. Import to Vercel
  3. Add the environment variables (TMDB_API_KEY, TMDB_BEARER_TOKEN) in Vercel → Settings → Environment Variables
  4. Deploy → Your API will be live at:
https://your-vercel-domain.vercel.app/api/movies/popular

📌 Example Usage in React Native

const API_URL = "https://your-vercel-domain.vercel.app";

export const fetchPopularMovies = async () => {
  const response = await fetch(`${API_URL}/api/movies/popular`);
  return response.json();
};

🛡️ Security Notes

  • Never expose your TMDB keys in client-side code
  • Use this proxy in production to securely fetch movie data

About

Secure TMDB API Proxy – A lightweight Node.js + Express proxy for fetching movie data from TMDB without exposing your API key, optimized for React Native and Expo apps.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%