Movie app in JavaScript with source code

Movie app in JavaScript with source code


Movie app is a movie-based web project. It is coded in HTML5, CSS, and JavaScript. It shows information about the different movies released.

In this tutorial movie app, we will be creating a simple movie app. First, we need to create a folder with HTML, CSS, and js files. This project’s functionality is made with Javascript. The movie app project has a simple layout with grid boxes. There is a search box in the top right corner. When the movie box-shadow has hovered you will see the movie information.

The movie information displays with animation from bottom to top. The project shows movie ratings with different colors and numbers. We will be using a movie API which will give access to our movie app project. You need to run the index.html file in the browser to run the project. See the screenshot below.


movie app

Movie app project source code


HTML will be used for displaying movies on screen. First, we create HTML code as a placeholder and then moved it to a JavaScript file. You will see a few HTML codes here. We are using the movie database API to display movies in our project. 


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="" integrity="sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+B+xFAmJKVSTbpM/CuL7qxO8w==" crossorigin="anonymous" />
    <link rel="stylesheet" href="style.css">
    <form id="form">
      <input type="text" id="search" class="search" placeholder="Search">

  <main id="main">
    <script src="script.js"></script>


We will be using CSS for styling the whole project. Such as background color, icons, text, aligning, flex-items, colors and many more.


@import url('');
* {
    box-sizing: border-box;

body {
  background-color: #06a18d;
  font-family: 'Roboto Mono', sans-serif;  
  margin: 0; 
header {
  padding: 1rem;
  display: flex;
  justify-content: flex-end;
  background-color: #034742;

.search {
  background-color: transparent;
  border: 2px solid #04040e;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  padding: .5rem 1rem;
  color: #fff;

.search:placeholder {
  color: #e6e6ec;

.search:focus {
  outline: none;
  background-color: rgb(7, 141, 141);

main {
  display: flex;
  flex-wrap: wrap;

.movie {
  width: 300px;
  margin: 1rem;
  background-color: #373b69;
  box-shadow: 0 4px 5px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  border-radius: 3px;

.movie img {
  width: 100%;

.movie-info {
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 1rem;
  letter-spacing: 0.5ox;

.movie-info h3 {
  margin-top: 0;

.movie-info span {
  background-color: #22254b;
  padding: .25rem 0.5rem;
  border-radius: 3px;
  font-weight: bold;

.movie-info {
  color: lightgreen;

.movie-info {
  color: orange;

.movie-info {
  color: red;

.overview {
  background-color: lightgrey;
  padding: 2rem;
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  max-height: 100%;
  transform: translateY(101%);
  transition: transform 0.3s ease-in;

.movie:hover .overview {
  transform: translateY(0);


The JavaScript code is used for fetching the movie from the API. Also it is used for making search functionality. The JavaScript works as backend in this project. Check the code below.


const API_URL = ''

const IMG_PATH= ''

const SEARCH_API = '" '

const main = document.getElementById('main')
const form = document.getElementById('form')
const search = document.getElementById('search')


async function getMovies(url) {
    const res = await fetch(url)
    const data = await res.json()


function showMovies(movies) {
    MediaDeviceInfo.innerHTML = ''
    movies.forEach(movie => {
        const {title, poster_path, vote_average, overview} = movie

        const movieEl = document.createElement('div')

        movieEl.innerHTML = `
      <img src="${IMG_PATH + poster_path}" alt="${title}">
      <div class="movie-info">
        <span class="${getClassByRate(vote_average)}">${vote_average}</span>
      <div class="overview">

function getClassByRate(vote) {
    if(vote >= 8) {
        return 'green'
    } else if(vote >=5) {
        return 'orange'
    } else {
        return 'red'
form.addEventListener('submit', (e) => {

    const searchTerm = search.value

    if(searchTerm && searchTerm !== '') {
        getMovies(SEARCH_API + searchTerm)

        search.value = ''
    } else {


Although the code is provided in this tutorial. You can click the button below to get the full source code of this project.