How splendor73/splendor_cinema_booking works
Project Type and Purpose
• This is a full-stack web application for movie ticket booking.
• The purpose is to provide a seamless booking experience that includes modern movie listings, real-time seat selection, secure payment integration, and automatic email notifications.
• The backend is built with Flask and PostgreSQL, while the frontend is implemented using HTML, CSS (with Bootstrap 5), and custom JavaScript for interactivity.
File Structure
• Top-level components include:
• app.py: The main Flask application file where routing, business logic, database connections, and mail configurations reside.
• requirements.txt: Lists all required Python dependencies for the project.
• static/ and templates/: These directories hold the frontend assets. “static/css/style.css” contains the styling, and the “templates” directory includes HTML files representing different pages (index, movies, seats, details, confirmation).
• There are no clearly separated backend or API folders, so the application is structured in a simple monolithic style with routing and logic embedded in app.py.
Architectural Insights from the README
• The README clearly outlines the tech stack for both backend and frontend, including Flask for web operations, PostgreSQL for persistent storage, and Flask-Mail for notifications.
• Detailed descriptions of the UI screens serve as hints on how the front-end components interact (e.g., welcome page, movie selection, seat layout, booking processing).
• Integration points such as email notifications (via Gmail SMTP) and (implicitly) payment integration are in scope.
– Identify Main Components:
• Client/User Interface:
• Web browser showing the application’s pages (index.html, movies.html, seats.html, details.html, confirmation.html).
• Web Server Layer:
• The Flask application (app.py) which handles incoming HTTP requests, applies business logic, interacts with the database, and sends out emails.
• It also serves static assets (CSS, JavaScript) and templates.
• Database:
• PostgreSQL database storing Movies, Seats, Bookings, and Booked Seats data.
• External Services:
• Email Service: Gmail SMTP through Flask-Mail to send booking confirmations.
• Payment Integration: Though not expanded on in the file structure, secure payment integration is part of the features, and its interaction should be represented.
– Relationships and Interactions:
• User Request Flow: A user interacts with the web UI (front-end) that sends HTTP requests to the Flask server.
• Flask Server Processes: The server routes requests, queries the PostgreSQL database for movie data or seat availability, and renders the appropriate HTML template.
• Database Communication: The Flask backend uses SQL queries to create, retrieve, update, or delete information in the movies, seats, bookings, and booked_seats tables.
• Email & Payment: Upon successful booking, the Flask app uses Flask-Mail to trigger an email confirmation (and processes payment via an external payment gateway).
– Architectural Patterns/Design Principles:
• Model-View-Controller (MVC)-like separation – though not formally split out into different directories, templates (views), application logic (controllers/routes in app.py), and the database (models) form the layers.
• Separation of concerns: Clearly distinct roles between user interface, business logic, and data persistence.
• Use of environment variables for configuration and separation between development settings and sensitive information.
What
• Main component with labels such as “Client/Web Browser”, “Flask Application (app.py)”, “PostgreSQL Database”, “Email Service (Gmail SMTP)”, and “Payment Gateway”.
• How requests originate from the client and flow to the server.
• How the server communicates with the database.
• How notifications are sent out from the server to the email service.
• (Optionally) How the payment process is invoked and its dependencies.
• Rectangles for major components.
Final Recommendations
– Keep it detailed enough to serve as a comprehensive overview of the architecture:
• Client → Frontend UI → Flask Server → Database.
• Additional interactions: Flask Server → Email Service and Payment Gateway.