rmb
ES

Movies API

A server-side application built with NestJS and TypeScript for managing movies, user favorites, authentication, and API keys.

Movies API
NestJSTypeScriptMongoDBDocker

🌍 Overview

The Movies API is a server-side application built with NestJS and TypeScript. It provides endpoints for managing movies, user favorites, authentication, and API keys. The API is designed with modular architecture, robust validation, and secure authentication mechanisms.

  • NestJS
  • TypeScript
  • MongoDB
  • Docker

⚑ Features

  • πŸ” Authentication: Secure login, registration, and token-based authentication.
  • 🎬 Movies: Fetch popular, trending, top-rated, and upcoming movies from TMDB.
  • πŸ‘Ύ Favorites: Manage user-specific favorite movies.
  • πŸ”‘ API Keys: Generate, validate, and manage API keys for external integrations.
  • πŸ“š Swagger Documentation: Interactive API documentation.

πŸ› οΈ Tech Stack

The project is built using the following technologies:

  • πŸš€ TypeScript
  • πŸ¦Έβ€β™‚οΈ NestJS
  • πŸ—„οΈ MongoDB
  • 🐳 Docker
  • πŸ“š Swagger

πŸ“š API Documentation

πŸ” Auth Endpoints

πŸ“ POST /auth/login

Authenticate a user and return access and refresh tokens.

πŸ“₯ Request Body
{
  "email": "user@mail.com",
  "password": "secure@pass123"
}
πŸ“€ Response
{
  "user": {
    "id": "123",
    "email": "user@mail.com",
    "name": "User"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

πŸ“ POST /auth/register

Register a new user.

πŸ“₯ Request Body
{
  "name": "User",
  "email": "user@mail.com",
  "password": "secure@pass123"
}
πŸ“€ Response
{
  "user": {
    "id": "123",
    "email": "user@mail.com",
    "name": "User"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

πŸ“ POST /auth/refresh

Refresh the access token using a refresh token.

πŸ“₯ Request Body
{
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
πŸ“€ Response
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

🎬 Movies Endpoints

πŸ“ GET /movies/popular

Fetch popular movies from TMDB.

  • Query Parameters: page (optional): Page number for pagination.
πŸ“€ Response
{
  "page": 1,
  "results": [
    {
      "id": 550,
      "title": "Fight Club",
      "overview": "A ticking-time-bomb insomniac...",
      "poster_path": "/poster.jpg",
      "release_date": "1999-10-15",
      "vote_average": 8.4
    }
  ],
  "total_results": 1000,
  "total_pages": 50
}

πŸ“ GET /movies/trending

Fetch trending movies.

  • Query Parameters: timeWindow (optional): day or week.
πŸ“€ Response
{
  "page": 1,
  "results": [
    {
      "id": 550,
      "title": "Fight Club",
      "overview": "A ticking-time-bomb insomniac...",
      "poster_path": "/poster.jpg",
      "release_date": "1999-10-15",
      "vote_average": 8.4
    }
  ],
  "total_results": 1000,
  "total_pages": 50
}

πŸ“ GET /movies/:id

Fetch detailed information about a movie.

  • Path Parameters: id: TMDB Movie ID.
πŸ“€ Response
{
  "id": 550,
  "title": "Fight Club",
  "overview": "A ticking-time-bomb insomniac...",
  "poster_path": "/poster.jpg",
  "release_date": "1999-10-15",
  "vote_average": 8.4,
  "genres": [{"id": 18, "name": "Drama"}]
}

πŸ‘Ύ Favorites Endpoints

πŸ“ POST /favorites

Add a movie to favorites.

πŸ“₯ Request Body
{
  "movieId": "550"
}
πŸ“€ Response
{
  "id": "123",
  "movieId": "550",
  "title": "Fight Club",
  "description": "A ticking-time-bomb insomniac...",
  "releaseDate": "1999-10-15",
  "tmdbRating": 8.4
}

πŸ“ GET /favorites

Fetch all favorites for the authenticated user.

  • Query Parameters: page (optional): Page number for pagination. limit (optional): Number of items per page.
πŸ“€ Response
{
  "results": [
    {
      "id": "123",
      "movieId": "550",
      "title": "Fight Club",
      "description": "A ticking-time-bomb insomniac...",
      "releaseDate": "1999-10-15",
      "tmdbRating": 8.4
    }
  ],
  "total": 10,
  "page": 1,
  "limit": 10
}

πŸ”‘ API Keys Endpoints

πŸ“ POST /api-keys

Generate a new API key.

πŸ“₯ Request Body
{
  "description": "Mobile application integration",
  "expiresInDays": 30
}
πŸ“€ Response
{
  "id": "123",
  "key": "abcd1234-5678-efgh-ijkl-9876543210mn",
  "description": "Mobile application integration",
  "expiresAt": "2025-12-31T23:59:59Z",
  "createdAt": "2025-07-01T12:00:00Z"
}

πŸ“ GET /api-keys

Fetch all API keys (Admin only).

πŸ“€ Response
[
  {
    "id": "123",
    "description": "Mobile application integration",
    "expiresAt": "2025-12-31T23:59:59Z",
    "createdAt": "2025-07-01T12:00:00Z",
    "isActive": true,
    "usageCount": 10
  }
]
Published: 18/09/2025

Related Projects

Chatbot App
A full-stack AI-powered chatbot, designed for fast, friendly, and interactive support.
Next Store
A scalable e-commerce web application built with Next.js and PostgreSQL, featuring product listings, user authentication, and a shopping cart system.
Med Monitor App
Med Monitor App is a cloud-native system designed to monitor patient vital signs, manage alerts, and generate summary reports. It leverages a microservices architecture with real-time messaging integrations and secure cloud storage. The system provides both a responsive client dashboard and REST APIs for interacting with patient, alert, vital sign, and report data.