How aditya18mew/movie-app-react works
1. Overall shape
This is a two-tier movie app: a React/Vite frontend in React/ and an Express/Node backend in express/. The frontend handles the UI and routing, while the backend owns authentication, user persistence, and server-side integration with the TMDB movie API.
2. Frontend boundary
The React app is organized around page-level routes in src/Pages/ such as homepage, trending, moviedetails, signin, signup, wishlist, favorites, and the password recovery screens. main.jsx and App.jsx act as the app entry and route composition layer.
3. UI/component layer
Reusable UI lives in src/components/: Navbar, MovieCard, section, skeleton, buttons, otpform, and provider/context helpers like MovieProvider, useCustomcontext, and useFormdata. This suggests the frontend centralizes movie/user state in a context layer and composes pages from shared presentational components.
4. Movie data flow
Movie discovery and detail views appear to flow from the frontend pages through API calls to the backend’s moviesRoutes. The backend likely proxies or normalizes requests to The Movie Database (TMDB), since the README states the TMDB API key is configured server-side. That makes the backend the external API boundary, not the browser.
5. Authentication flow
Authentication is handled end-to-end by the backend authRoutes and AuthController, with the frontend pages signin, signup, forget password, resetpassword, and otpform covering the user journey. User data is stored in MongoDB through Mongoose, while the frontend likely stores only session/token state.
6. Protected access
middleware/Authmiddleware.js indicates route protection for authenticated operations, likely guarding user-specific pages such as dashboard, favorites, and wishlist. This creates a clear separation between public movie browsing and authenticated user features.
7. Password recovery
The presence of nodemailer.js, otpform, and reset-password pages indicates a recovery flow that uses email delivery plus a one-time code or reset token. That means the backend is responsible for generating, sending, and validating recovery credentials, while the frontend only collects and submits user input.
8. Persistence and supporting services
utils/mongoosedb.js connects the app to MongoDB for durable user storage. config/Redis.js plus middleware/ratelimiter.js show a Redis-backed or Redis-aware control plane for transient state and throttling, which is important for login/reset abuse prevention and short-lived auth workflows.
9. Validation and security
Both sides contain regex utilities: React/src/utils/regex.js and express/regex/regex.js. This implies input validation is duplicated intentionally across client and server, with the backend still acting as the authoritative validation/security layer.
10. Deployment/runtime boundary
The repo includes Dockerfiles for both apps, compose.yaml, and nginx.conf in the React folder. That points to a containerized deployment where the frontend is built and served by Nginx, the backend runs as a separate Node service, and supporting infrastructure like MongoDB/Redis is orchestrated alongside them.
11. Typical request paths
A user first loads the React app, navigates through pages, and either browses movie data or signs in. Auth requests go to Express, which validates input, talks to MongoDB, may send mail, and issues JWTs. Movie requests go from React to Express, which fetches TMDB data and returns it to the UI.
12. Architecture diagram emphasis
For a diagram, the main boxes should be: React UI, Express API, MongoDB, Redis, TMDB external API, and Email service via Nodemailer. The key arrows are: UI → Express for auth and movie data; Express → MongoDB for users; Express → Redis for throttling/transient state; Express → TMDB for movie metadata; Express → email for password reset delivery.
Main entry points: App.jsx App shell · authRoutes.js Auth routes · AuthController.js Auth logic · moviesRoutes.js Movie routes
Components 23
React UI
Vite/React client for browsing movies and managing user actions.
- Main entry · Bootstraps the React application.
React/src/main.jsx - App shell · Composes global app structure and route wiring.
React/src/App.jsx - Home · Landing page and primary movie browsing surface.
React/src/Pages/homepage.jsx - Trending · Movie discovery and trending listings.
React/src/Pages/trending.jsx - Details · Movie detail view.
React/src/Pages/moviedetails.jsx - Sign in · Login screen.
React/src/Pages/signin.jsx - Sign up · Account registration screen.
React/src/Pages/signup.jsx - Recovery · Password recovery and reset screens.
React/src/Pages/forget password.jsx - Dashboard · Authenticated user dashboard.
React/src/Pages/dashboard.jsx - Wishlist · Saved movies list.
React/src/Pages/wishlist.jsx - Favorites · Favorite movies list.
React/src/Pages/favorites.jsx - Movie state · Shared movie and user-facing state container.
React/src/components/MovieProvider.jsx - UI kit · Reusable navigation, cards, sections, skeletons, buttons, and OTP form.
React/src/components/Navbar.jsx - Client validation · Frontend input validation helpers.
React/src/utils/regex.js
Express API
Node server for auth, user state, and movie data integration.
- Server entry · Starts the Express application.
express/Server.js - Auth routes · Authentication API surface.
express/routes/authRoutes.js - Movie routes · Movie API surface.
express/routes/moviesRoutes.js - Auth logic · Registration, login, recovery, and account flow orchestration.
express/utils/AuthController.js - JWT tokens · Token creation and verification helpers.
express/utils/jwttokens.js
Services
External and supporting runtime services used by the backend.
- MongoDB · Mongoose-backed persistence for users and related records.
express/utils/mongoosedb.js - Redis · Transient state and rate-limit support.
express/config/Redis.js - Email service · Nodemailer-backed recovery email delivery.
express/utils/nodemailer.js - TMDB API · External movie metadata provider used by the backend.
Connections 30
- Main entry → App shell: loads · Bootstraps the application shell.
- App shell → Home: routes to · Primary public landing route.
- App shell → Trending: routes to · Discovery route.
- App shell → Details: routes to · Movie detail route.
- App shell → Sign in: routes to · Authentication route.
- App shell → Sign up: routes to · Registration route.
- App shell → Recovery: routes to · Password recovery and reset flow.
- App shell → Dashboard: routes to · Protected user area.
- App shell → Wishlist: routes to · Protected user list.
- App shell → Favorites: routes to · Protected user list.
- Home → Movie state: uses · Reads shared movie state.
- Trending → Movie state: uses · Reads shared movie state.
- Details → Movie state: uses · Reads shared movie state.
- Sign in → Auth routes: calls · Submits login requests.
- Sign up → Auth routes: calls · Submits registration requests.
- Recovery → Auth routes: calls · Submits recovery and reset requests.
- Dashboard → Auth routes: calls · Loads authenticated user data.
- Wishlist → Auth routes: calls · Reads protected saved movies.
- Favorites → Auth routes: calls · Reads protected saved movies.
- Details → Movie routes: calls · Fetches movie metadata.
- Trending → Movie routes: calls · Fetches movie listings.
- Auth routes → Auth logic: delegates · Routes authentication workflows.
- Auth logic → MongoDB: stores · Persists and reads user records.
- Auth logic → JWT tokens: issues · Creates and validates auth tokens.
- Auth logic → Email service: sends · Delivers recovery emails.
- Auth routes → Redis: throttles · Supports rate limiting and transient auth state.
- Movie routes → TMDB API: fetches · Proxies movie data from TMDB.
- Auth routes → Client validation: mirrors · Shares validation rules with the client.
- Server entry → Auth routes: mounts · Registers auth endpoints.
- Server entry → Movie routes: mounts · Registers movie endpoints.