How twilight2368/web-ticket-booking-cinema-project works
Project Type and Purpose
• The project is a full-stack web application for managing movie-related activities (booking tickets, showing movie information, managing news, payments, etc.).
• The backend is built with Node.js, employing various submodules (authentication, caching, emailing, logging) and works with a database (using MongoDB as suggested by the connectMongo.js file).
• The frontend appears in multiple flavors: one under “draft-ui/web-booking-fe” (likely an admin dashboard or a styled booking interface) and another under “frontend/client-app” (the client-facing UI).
• The README is minimal (labels this as “Project bai tap lon cho mon lap trinh Web”), indicating it’s a major project from a web programming course.
Analyzing the File Structure
• The backend directory is well-structured into configurations, controllers (for movies, news, payment, etc.), models (with separate directories for production data and migration mock data), routes, authentication (using JWT and Passport), caching (with Redis), mailing (using nodemailer), and logging components.
• The existence of a “database” folder (with a JSON file and its own README) suggests some demo or seed data.
• The frontends are further split into “draft-ui/web-booking-fe” and “frontend/client-app”. Both use modern frontend technologies (React, Tailwind CSS, Vite in one, and similar structures in the other). They have components for building UI elements like headers, footers, modals, and pages for booking, movies, news, profiles, etc.
• Configuration files like .env examples, tailwind.config.js, vite.config.js, etc., indicate that both frontends are set-up for local builds and potential production deployment.
a. Main Components:
– Client Frontend(s):
• "draft-ui/web-booking-fe": Likely the complete web front end for booking (or possibly the admin dashboard).
• "frontend/client-app": The client-facing application.
– Backend Server:
• Main Express server (initial entry point: index.js in backend) handling HTTP routing.
• Controllers to process business logic (managing movies, news, bookings, payments, user management).
• Middlewares for authentication (JWT, Passport), error handling, and general request processing.
• Sub-modules for caching (Redis connections), mailing (nodemailer module), and logging.
– Database:
• MongoDB accessed via the connection module (connectMongo.js).
• A file-based demo or seed database in the “database” folder.
– External Services:
• Redis server (for caching).
• Possibly external email services integrated via nodemailer.
• Payment gateways (if integrated into payment.controller.js).
b. Relationships and Interactions:
– Frontend applications communicate with the backend via RESTful APIs (routes for authentication, movie info retrieval, bookings, payments, etc.).
– The backend uses controllers to manage incoming requests, which in turn interact with:
• The database (for persistent storage of movies, bookings, user details, etc.).
• External caching (via Redis) to enhance performance.
• External emailing services for notifications.
– Authentication modules (JWT and Passport) secure sensitive endpoints.
– Logging tools record events across the services.
– Mailer module sends out emails after certain user actions (like booking confirmation).
c. Architectural Patterns or Design Principles:
– Modular design through separation into controllers, middlewares, and services.
– Use of MVC-like separation in the backend (even though it may not be a strict MVC, controllers and models are clearly separated).
– REST API communication between frontends and backend.
– Use of middleware for cross-cutting concerns (authentication, error handling, logging).
– Separation of concerns is also visible in frontends (organized components, layouts, pages, and state management using Redux slices or context).
d. Relevant Technologies & Frameworks:
– Node.js, Express, Passport, JSON Web Tokens (JWT) for backend.
– MongoDB as the main database.
– Redis for caching.
– Nodemailer for emailing.
– On the frontend: React, likely using Vite as a bundler, Tailwind CSS for styling, and possibly Redux for state management (as hints by store and slice files).
– Other utilities and open-source libraries as seen in the helpers, auth, and logging modules.