How samyakjain0007/moviepopcorn works
Project Type and Purpose
• This is a full-stack web application (MERN stack) for online movie booking.
• Key features: user & admin authentication, movie management, booking flow, real-time updates.
File Structure
• Frontend: “frontend/movies” contains a React app with:
• src/components (Auth, Movies, Bookings, Header, HomePage, Profile)
• src/store (Redux Toolkit)
• src/api-helpers (Axios wrapper)
• Backend: “backend” is an Express.js API with:
• app.js (entry point)
• routes/ (Express routers for admin, booking, movie, user)
• controller/ (business logic)
• models/ (Mongoose schemas: Admin, User, Movie, Bookings)
• .env (MONGO_URI, JWT_SECRET, PORT)
README for Additional Insights
• Tech stack: MongoDB, Express, React, Node.js, Mongoose, Redux Toolkit, Material-UI, Axios, JWT, Bcrypt.
• Patterns: RESTful API, MVC (models/controllers/routes), client-side state management, role-based access control.
Main Components
a. Client Side (React App)
• UI Components (Auth forms, Movie listing, Booking pages, Admin dashboard)
• State Store (Redux Toolkit)
• HTTP Client (Axios)
b. API Layer (Express Server)
• Router Layer (admin-router, booking-router, movie-router, user-router)
• Controller Layer (admin-controller, booking-controller, movie-controller, user-controller)
• Model Layer (Mongoose schemas)
c. Database
• MongoDB instance (could be Atlas or local)
d. Authentication & Security
• JWT issuance/verification
• Bcrypt password hashing
• Role-based access control (User vs Admin)
e. Configuration
• Environment variables (.env with MONGO_URI, JWT_SECRET, PORT)
Relationships & Data Flows
• User/Admin interacts with the React UI → dispatches Redux actions → API calls via Axios → HTTP requests hit Express routers.
• Frontend receives JSON → updates Redux store → UI rerenders.
• Admin flows: calls admin-router endpoints to manage movies/bookings.
• User flows: calls booking-router to create/view bookings, calls movie-router to list movies, calls user-router for profile.
Architectural Patterns & Design Principles
• MVC on the server: clear separation of Models, Controllers, and Routes.
• RESTful API conventions (CRUD over HTTP verbs).
• Client-side state management with Redux Toolkit.
• Component-based UI in React with Material-UI for styling.
• Token-based authentication (stateless sessions).