How virajs07/movie-ticket-booking works
Project type and purpose
• This is a single‐page, front-end only application built as a learning exercise.
• It uses Backbone.js (MVC/MV*), Underscore.js (templating and utilities), and Bootstrap (CSS/JS) to implement a movie reservation UI.
File structure
• Top‐level:
• index.html (entry point)
• css/ (Bootstrap and custom CSS)
• js/ (Backbone, Underscore, Bootstrap.js, application code)
• fonts/, img/ (static assets)
• No backend folder—data persistence is either mocked in JavaScript or left as a future integration point.
• The js/ directory includes:
• backbone.js / backbone-min.js
• underscore-min.js
• bootstrap.js
• npm.js (module loader shim if used)
• prima.js (application’s custom logic—likely Views, Models, Routers)
README for additional insights
• Confirms it’s a “movie reservation UI using backbone” for learning.
• No mention of any server or API, so assume data is in‐memory or in local JSON.
Components and their relationships
a. Main components
1. Static Web Server (e.g., GitHub Pages, local HTTP)
2. Browser / Client
3. index.html – bootstraps the app
4. CSS Layer
– bootstrap.css, bootstrap-theme.css, prima.css
5. JS Libraries
– Backbone.js, Underscore.js, Bootstrap.js
6. Application Code (prima.js + any modules loaded by npm.js)
– Models (Movie, Reservation)
– Collections (Movies, Reservations)
– Views (MovieListView, SeatMapView, ReservationFormView)
– Router (manages URL state)
7. Static Assets (fonts/, img/)
8. (Optional future) External API or JSON store for persisting reservations
b. Relationships & data flow
– The Browser requests index.html from the Static Web Server.
– index.html loads CSS assets (styling) and JS libraries.
– Upon load, the Router initializes and fetches Models/Collections (in-memory or via AJAX to API).
– Views subscribe to Collections’ events and render templates (Underscore templates inside prima.js).
– User actions (click “Reserve Seat”) trigger View events → update Models → Views re‐render.
– If an API existed, Models would sync via Backbone.sync to REST endpoints.
c. Architectural patterns
– MV* pattern (Backbone’s Models, Collections, Views, Router)
– Unidirectional data flow: user → View → Model → View
– Separation of concerns:
• Styling (CSS) vs. logic (JS) vs. structure (HTML)
d. Key technologies
– Backbone.js for structure
– Underscore.js for templating & utilities
– Bootstrap (CSS + JS components) for UI scaffolding
– Optional AMD/CommonJS via npm.js if modules are split
Capturing essential architectural elements
• Don’t attempt to overly modularize beyond Models/Views/Router; keep high‐level to illustrate Backbone’s MV* flow.
• Clearly separate static asset delivery from runtime application logic.
• If in-memory only, note that Models fetch from a local JSON object or simulated API.