How shivam8761/cineverse-moviebookingapplication-backend works
Purpose and Runtime
CineVerse is a Spring Boot REST backend for movie-ticket booking. It provides JWT-secured, role-based APIs for users and administrators to manage catalog data, schedule shows, and create/maintain bookings. The application starts from src/main/java/com/sv/CineVerseApplication.java; Maven builds and runs it through pom.xml.
HTTP API Layer
Controllers expose resource-oriented endpoints and separate public/user/admin operations:
• Authentication: src/main/java/com/sv/controller/AuthController.java
• Movie, theater, and show APIs: src/main/java/com/sv/controller/MovieController.java, src/main/java/com/sv/controller/TheaterController.java, src/main/java/com/sv/controller/ShowController.java
• Booking and administrative operations: src/main/java/com/sv/controller/BookingController.java, src/main/java/com/sv/controller/AdminController.java
Requests enter controllers, are mapped through DTOs, and delegate business rules to services rather than directly to persistence.
Authentication and Authorization Boundary
Spring Security is configured as a stateless JWT boundary in src/main/java/com/sv/security/SecurityConfig.java. src/main/java/com/sv/jwt/JwtAuthenticationFilter.java intercepts requests, validates bearer tokens via src/main/java/com/sv/jwt/JwtService.java, and establishes authenticated context. src/main/java/com/sv/service/AuthenticationService.java handles registration/login flows, while src/main/java/com/sv/service/CustomUserDetailsService.java loads persisted users. Roles distinguish USER and ADMIN access, protecting management endpoints.
Domain Model and Persistence
JPA/Hibernate persists the booking domain in MySQL. Core aggregates are:
• Users and bookings: src/main/java/com/sv/entity/User.java, src/main/java/com/sv/entity/Booking.java
• Movie/show/theater scheduling: src/main/java/com/sv/entity/Movie.java, src/main/java/com/sv/entity/Show.java, src/main/java/com/sv/entity/Theater.java
• Booking lifecycle state: src/main/java/com/sv/entity/BookingStatus.java
Relationships model one user to many bookings, movie/theater to many shows, and show to many bookings. Spring Data repository interfaces isolate database access, including src/main/java/com/sv/repository/BookingRepository.java and src/main/java/com/sv/repository/ShowRepository.java.
Catalog and Scheduling Flow
Movie and theater services own CRUD/search behavior, backed by their repositories: src/main/java/com/sv/service/MovieService.java and src/main/java/com/sv/service/TheaterService.java. src/main/java/com/sv/service/ShowService.java links a movie and theater into a scheduled show, enabling retrieval by movie or theater. Administrative authorization is the control boundary for mutating these resources; browsing feeds booking selection.
Booking Lifecycle
src/main/java/com/sv/service/BookingService.java is the principal transactional business component. It accepts booking input, resolves the user/show context, validates requested seats against existing show bookings and theater capacity, calculates total ticket cost, and persists a status-bearing booking. It also governs confirmation, cancellation, cancellation-time restrictions, and user/show/status booking queries. src/main/java/com/sv/DTO/BookingDTO.java is the API-facing booking shape, insulating controllers from JPA entities.
Data Contracts and External Infrastructure
DTOs define request/response boundaries for auth and primary resources, notably src/main/java/com/sv/DTO/LoginRequestDTO.java, src/main/java/com/sv/DTO/LoginResponseDTO.java, and src/main/java/com/sv/DTO/ShowDTO.java. Material infrastructure is Java/Spring Boot, Spring Security, JWT, Spring Data JPA/Hibernate, and MySQL; no payment, notification, cache, message broker, or frontend integration is present. API documentation configuration exists at src/main/java/com/sv/security/SwaggerConfig.java.
Main entry points: BookingService.java Booking service · BookingRepository.java Spring Data repositories · JwtAuthenticationFilter.java JWT filter · CineVerseApplication.java Spring Boot app
Components 19
HTTP API
- Resource controllers · Movie, theater, show, booking, and admin endpoints.
- Auth controller
src/main/java/com/sv/controller/AuthController.java - Booking DTO · Insulates booking APIs from JPA entities.
src/main/java/com/sv/DTO/BookingDTO.java - Login DTOs
src/main/java/com/sv/DTO/LoginRequestDTO.java
Security
- Security config · Stateless JWT and role authorization rules.
src/main/java/com/sv/security/SecurityConfig.java - JWT filter
src/main/java/com/sv/jwt/JwtAuthenticationFilter.java - JWT service
src/main/java/com/sv/jwt/JwtService.java - Authentication service · Registration and login flows.
src/main/java/com/sv/service/AuthenticationService.java - User details service · Loads persisted users for authentication.
src/main/java/com/sv/service/CustomUserDetailsService.java
Booking Domain
- Catalog services · Movie and theater CRUD and search.
src/main/java/com/sv/service/MovieService.java - Show service · Links movies and theaters into scheduled shows.
src/main/java/com/sv/service/ShowService.java - Booking service · Validates seats and capacity, prices, and manages lifecycle.
src/main/java/com/sv/service/BookingService.java - Booking · Status-bearing reservation tied to a user and show.
src/main/java/com/sv/entity/Booking.java - Show · Scheduled movie at a theater.
src/main/java/com/sv/entity/Show.java - User
src/main/java/com/sv/entity/User.java
Persistence
- Spring Data repositories · Database access for bookings, shows, and catalog data.
src/main/java/com/sv/repository/BookingRepository.java - MySQL · JPA/Hibernate persistence store.
Other components
- Spring Boot app · Application entry point.
src/main/java/com/sv/CineVerseApplication.java - Maven build
pom.xml
Connections 22
- Maven build → Spring Boot app: builds and runs
- Spring Boot app → Security config: configures
- Spring Boot app → Resource controllers: serves
- Security config → JWT filter: installs
- JWT filter → JWT service: validates tokens
- JWT filter → User details service: loads identity
- Auth controller → Authentication service: login and registration
- Auth controller → Login DTOs: uses
- Resource controllers → Booking DTO: maps requests
- Resource controllers → Catalog services: catalog operations
- Resource controllers → Show service: scheduling operations
- Resource controllers → Booking service: booking operations
- Booking service → Booking: creates and updates
- Booking service → Show: checks availability
- Booking service → User: resolves customer
- Catalog services → Spring Data repositories: persists catalog
- Show service → Spring Data repositories: persists shows
- Booking service → Spring Data repositories: persists bookings
- User details service → Spring Data repositories: loads users
- Spring Data repositories → MySQL: JPA/Hibernate
- Show → Booking: has bookings
- User → Booking: has bookings