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.
- 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
tmdb-proxy/
├─ api/
│ └─ index.js # Express API routes
├─ package.json
├─ vercel.json # Optional route rewrites for clean URLs
└─ .gitignore
-
Clone the repository
git clone https://github.com/ftashmit/tmdb-proxy.git cd tmdb-proxy -
Install dependencies
npm install
-
Create a
.env.localfile in the root:TMDB_API_KEY=your_api_key_here TMDB_BEARER_TOKEN=your_read_access_token_here
-
Run locally
npm run dev
-
Access Endpoints for testing
http://localhost:3000/api/movies/popularhttp://localhost:3000/api/movies/search?query=Inceptionhttp://localhost:3000/api/tmdb/movie/550
- Push your repo to GitHub
- Import to Vercel
- Add the environment variables (
TMDB_API_KEY,TMDB_BEARER_TOKEN) in Vercel → Settings → Environment Variables - Deploy → Your API will be live at:
https://your-vercel-domain.vercel.app/api/movies/popular
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();
};- Never expose your TMDB keys in client-side code
- Use this proxy in production to securely fetch movie data