17 | Build this project step by step with our detailed tutorial on JavaScript Mastery YouTube. Join the JSM family!
18 |
19 |
20 |
21 | ## 📋 Table of Contents
22 |
23 | 1. 🤖 [Introduction](#introduction)
24 | 2. ⚙️ [Tech Stack](#tech-stack)
25 | 3. 🔋 [Features](#features)
26 | 4. 🤸 [Quick Start](#quick-start)
27 | 5. 🕸️ [Snippets (Code to Copy)](#snippets)
28 | 6. 🔗 [Assets](#links)
29 | 7. 🚀 [More](#more)
30 |
31 | ## 🚨 Tutorial
32 |
33 | This repository contains the code corresponding to an in-depth tutorial available on our YouTube channel, JavaScript Mastery.
34 |
35 | If you prefer visual learning, this is the perfect resource for you. Follow our tutorial to learn how to build projects like these step-by-step in a beginner-friendly manner!
36 |
37 |
38 |
39 | ## 🤖 Introduction
40 |
41 | Built with React.js for the user interface, Appwrite for backend services, and styled with TailwindCSS, this Movie App lets users browse trending movies, search titles, and explore content using the TMDB API. It features a responsive layout and a sleek, modern design.
42 |
43 | If you're getting started and need assistance or face any bugs, join our active Discord community with over **50k+** members. It's a place where people help each other out.
44 |
45 |
46 |
47 | ## ⚙️ Tech Stack
48 |
49 | - **[Appwrite](https://appwrite.io/)** is an open-source Backend-as-a-Service (BaaS) platform that provides developers with a set of APIs to manage authentication, databases, storage, and more, enabling rapid development of secure and scalable applications.
50 |
51 | - **[React.js](https://react.dev/reference/react)** is a JavaScript library developed by Meta for building user interfaces. It allows developers to create reusable UI components that manage their own state, leading to more efficient and predictable code. React is widely used for developing single-page applications (SPAs) due to its virtual DOM that improves performance and ease of maintenance.
52 |
53 | - **[React-use](https://github.com/streamich/react-use)** is a collection of essential React hooks that simplify common tasks like managing state, side effects, and lifecycle events, promoting cleaner and more maintainable code in React applications.
54 |
55 | - **[Tailwind CSS](https://tailwindcss.com/)** is a utility-first CSS framework that provides low-level utility classes to build custom designs without writing custom CSS, enabling rapid and responsive UI development.
56 |
57 | - **[Vite](https://vite.dev/)** is a modern build tool that provides a fast development environment for frontend projects. It offers features like hot module replacement (HMR) and optimized builds, enhancing the development experience and performance.
58 |
59 |
60 | ## 🔋 Features
61 |
62 | 👉 **Browse All Movies**: Explore a wide range of movies available on the platform.
63 |
64 | 👉 **Search Movies**: Easily search for specific movies using a search function.
65 |
66 | 👉 **Trending Movies Algorithm**: Displays trending movies based on a dynamic algorithm.
67 |
68 | 👉 **Modern UI/UX**: A sleek and user-friendly interface designed for a great experience.
69 |
70 | 👉 **Responsiveness**: Fully responsive design that works seamlessly across devices.
71 |
72 | and many more, including code architecture and reusability
73 |
74 | ## 🤸 Quick Start
75 |
76 | Follow these steps to set up the project locally on your machine.
77 |
78 | **Prerequisites**
79 |
80 | Make sure you have the following installed on your machine:
81 |
82 | - [Git](https://git-scm.com/)
83 | - [Node.js](https://nodejs.org/en)
84 | - [npm](https://www.npmjs.com/) (Node Package Manager)
85 |
86 | **Cloning the Repository**
87 |
88 | ```bash
89 | git clone https://github.com/adrianhajdin/react-movies.git
90 | cd react-movies
91 |
92 | ```
93 |
94 | **Installation**
95 |
96 | Install the project dependencies using npm:
97 |
98 | ```bash
99 | npm install
100 | ```
101 |
102 | **Set Up Environment Variables**
103 |
104 | Create a new file named `.env.local` in the root of your project and add the following content:
105 |
106 | ```env
107 | VITE_TMDB_API_KEY=
108 |
109 | VITE_APPWRITE_PROJECT_ID=
110 | VITE_APPWRITE_DATABASE_ID=
111 | VITE_APPWRITE_COLLECTION_ID=
112 | ```
113 |
114 | Replace the placeholder values with your actual **[TheMovieDatabase API](https://developer.themoviedb.org/reference/intro/getting-started)** and **[Appwrite](https://apwr.dev/JSM050)** credentials.
115 |
116 | **Running the Project**
117 |
118 | ```bash
119 | npm run dev
120 | ```
121 |
122 | Open [http://localhost:5173](http://localhost:5173) in your browser to view the project.
123 |
124 | ## 🕸️ Snippets
125 |
126 |
127 | index.css
128 |
129 | ```css
130 | @import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");
131 | @import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");
132 |
133 | @import "tailwindcss";
134 |
135 | @theme {
136 | --color-primary: #030014;
137 |
138 | --color-light-100: #cecefb;
139 | --color-light-200: #a8b5db;
140 |
141 | --color-gray-100: #9ca4ab;
142 |
143 | --color-dark-100: #0f0d23;
144 |
145 | --font-dm-sans: DM Sans, sans-serif;
146 |
147 | --breakpoint-xs: 480px;
148 |
149 | --background-image-hero-pattern: url("/hero-bg.png");
150 | }
151 |
152 | @layer base {
153 | body {
154 | font-family: "DM Sans", serif;
155 | font-optical-sizing: auto;
156 | background: #030014;
157 | }
158 |
159 | h1 {
160 | @apply mx-auto max-w-4xl text-center text-5xl font-bold leading-tight tracking-[-1%] text-white sm:text-[64px] sm:leading-[76px];
161 | }
162 |
163 | h2 {
164 | @apply text-2xl font-bold text-white sm:text-3xl;
165 | }
166 |
167 | main {
168 | @apply min-h-screen relative bg-primary;
169 | }
170 |
171 | header {
172 | @apply sm:mt-10 mt-5;
173 | }
174 |
175 | header img {
176 | @apply w-full max-w-lg h-auto object-contain mx-auto drop-shadow-md;
177 | }
178 | }
179 |
180 | @layer components {
181 | .pattern {
182 | @apply bg-hero-pattern w-full h-screen bg-center bg-cover absolute z-0;
183 | }
184 |
185 | .wrapper {
186 | @apply px-5 py-12 xs:p-10 max-w-7xl mx-auto flex flex-col relative z-10;
187 | }
188 |
189 | .trending {
190 | @apply mt-20;
191 |
192 | & ul {
193 | @apply flex flex-row overflow-y-auto gap-5 -mt-10 w-full hide-scrollbar;
194 | }
195 |
196 | & ul li {
197 | @apply min-w-[230px] flex flex-row items-center;
198 | }
199 |
200 | & ul li p {
201 | @apply fancy-text mt-[22px] text-nowrap;
202 | }
203 |
204 | & ul li img {
205 | @apply w-[127px] h-[163px] rounded-lg object-cover -ml-3.5;
206 | }
207 | }
208 |
209 | .search {
210 | @apply w-full bg-light-100/5 px-4 py-3 rounded-lg mt-10 max-w-3xl mx-auto;
211 |
212 | & div {
213 | @apply relative flex items-center;
214 | }
215 |
216 | & img {
217 | @apply absolute left-2 h-5 w-5;
218 | }
219 |
220 | & input {
221 | @apply w-full bg-transparent py-2 sm:pr-10 pl-10 text-base text-gray-200 placeholder-light-200 outline-hidden;
222 | }
223 | }
224 |
225 | .all-movies {
226 | @apply space-y-9;
227 |
228 | & ul {
229 | @apply grid grid-cols-1 gap-5 xs:grid-cols-2 md:grid-cols-3 lg:grid-cols-4;
230 | }
231 | }
232 |
233 | .movie-card {
234 | @apply bg-dark-100 p-5 rounded-2xl shadow-inner shadow-light-100/10;
235 |
236 | & img {
237 | @apply rounded-lg h-auto w-full;
238 | }
239 |
240 | & h3 {
241 | @apply text-white font-bold text-base line-clamp-1;
242 | }
243 |
244 | & .content {
245 | @apply mt-2 flex flex-row items-center flex-wrap gap-2;
246 | }
247 |
248 | & .rating {
249 | @apply flex flex-row items-center gap-1;
250 | }
251 |
252 | & .rating img {
253 | @apply size-4 object-contain;
254 | }
255 |
256 | & .rating p {
257 | @apply font-bold text-base text-white;
258 | }
259 |
260 | & .content span {
261 | @apply text-sm text-gray-100;
262 | }
263 |
264 | & .content .lang {
265 | @apply capitalize text-gray-100 font-medium text-base;
266 | }
267 |
268 | & .content .year {
269 | @apply text-gray-100 font-medium text-base;
270 | }
271 | }
272 | }
273 |
274 | @utility text-gradient {
275 | @apply bg-linear-to-r from-[#D6C7FF] to-[#AB8BFF] bg-clip-text text-transparent;
276 | }
277 |
278 | @utility fancy-text {
279 | -webkit-text-stroke: 5px rgba(206, 206, 251, 0.5);
280 | font-size: 190px;
281 | font-family: "Bebas Neue", sans-serif;
282 | }
283 |
284 | @utility hide-scrollbar {
285 | -ms-overflow-style: none;
286 | scrollbar-width: none;
287 |
288 | &::-webkit-scrollbar {
289 | display: none;
290 | }
291 | }
292 | ```
293 |
294 |
295 |
296 |
297 | components/Spinner.jsx
298 |
299 | ```jsx
300 | import React from 'react'
301 |
302 | const Spinner = () => {
303 | return (
304 |
305 |
315 | Loading...
316 |
317 | )
318 | }
319 | export default Spinner
320 | ```
321 |
322 |
323 |
324 | ## 🔗 Assets
325 |
326 | Assets and snippets used in the project can be found in the **[video kit](https://jsm.dev/react25-kit)**.
327 |
328 |
329 |
330 |
331 |
332 | ## 🚀 More
333 |
334 | **Advance your skills with Next.js Pro Course**
335 |
336 | Enjoyed creating this project? Dive deeper into our PRO courses for a richer learning adventure. They're packed with
337 | detailed explanations, cool features, and exercises to boost your skills. Give it a go!
338 |
339 |
340 |
341 |
--------------------------------------------------------------------------------