How sankeerth6655/movie-booking-system works
1. Repository shape
- This is a two-part monorepo: a backend API in backend/ and a React frontend SPA in frontend/.
- The application domain is a movie/theatre ticket booking system with auth, listings, show selection, booking, and booking history.
2. Backend runtime and entrypoints
- The backend is a TypeScript Node.js service with src/server.ts as the process entrypoint and src/app.ts as the app composition layer.
- server.ts likely starts the HTTP listener, while app.ts wires middleware and route registration.
3. Backend layering
- The backend is organized into a classic three-layer flow:
- routes/ define URL boundaries,
- controllers/ handle HTTP input/output,
- services/ contain business logic,
- models/ define the persisted domain objects.
- config/db.ts is the persistence/config boundary, separating the app from the database connection details.
4. Backend domain subsystems
- The backend is split by business capability rather than by technical layer only:
- auth
- movie
- show
- theatre
- ticket
- health
- Each subsystem has its own route, controller, and service files, which suggests independently understandable API slices.
5. Backend request flow
- A typical request flows from src/routes/*.routes.ts into the matching controller, then into the service layer, and finally into a model/database operation.
- This separation matters for architecture diagrams because the HTTP API boundary is not the same as the domain logic boundary.
6. Authentication and access control
- Auth is its own backend subsystem with auth.controller.ts, auth.service.ts, and auth.routes.ts.
- The frontend also has AuthProtectedRoute, ProtectedRoute, and RoleProtectedRoute, indicating both authentication and role-based authorization are enforced at the UI routing layer.
- That suggests privileged pages such as adding movies or theatres are gated by role.
7. Frontend runtime and composition
- The frontend is a Vite-based React application using TypeScript.
- main.tsx bootstraps the app, App.tsx is the root composition point, and index.css provides global styling.
- The frontend is a client-side SPA that talks to the backend API over HTTP.
8. Frontend state and API access
- Global state is organized through src/app/store.ts, with auth state managed in features/auth/authSlice.ts.
- API integration is feature-based: authApi.ts, moviesApi.ts, theatreApi.ts, and ticketApi.ts.
- This indicates a centralized client state store plus dedicated API access modules per domain.
9. Frontend UI boundaries
- UI code is split between:
- components/ for reusable shell and route-guard components,
- pages/ for route-level screens.
- Navbar.tsx is part of the shared application shell, while pages like MovieDetailsPage.tsx and BookTicketsPage.tsx represent workflow screens.
10. Primary user flows
- The main product flows implied by the page names are:
- authentication (AuthPage)
- browsing theatres (TheatresPage)
- viewing movie details (MovieDetailsPage)
- booking tickets (BookTicketsPage)
- viewing personal bookings (MyBookingsPage)
- admin-style content creation (AddMoviePage, AddTheatrePage)
- HeroSection.tsx suggests a landing/home experience for discovery before the booking flow.
11. Data and dependency boundary between frontend and backend
- The frontend is the presentation and orchestration layer; the backend is the source of truth for users, movies, theatres, shows, and tickets.
- All persisted business data appears to live behind the backend API and its model/service layer, not in the client.
12. Operational setup
- The project is designed to be run as two separate dev processes:
- backend from backend/
- frontend from frontend/
- That separation is important for diagrams: the browser talks to the frontend dev server in development, and the frontend talks onward to the backend API.
Main entry points: index.ts routes index · App.tsx App.tsx · models Domain models · store.ts store.ts
Components 34
Backend API
TypeScript Node.js service with HTTP routing, business logic, and persistence models.
- server.ts · Starts the HTTP process.
backend/src/server.ts - app.ts · Wires middleware and registers routes.
backend/src/app.ts - routes index · Collects and mounts API route modules.
backend/src/routes/index.ts - Auth routes · Authentication endpoints.
backend/src/routes/auth.routes.ts - Movie routes · Movie-related endpoints.
backend/src/routes/movie.routes.ts - Show routes · Show and scheduling endpoints.
backend/src/routes/show.routes.ts - Theatre routes · Theatre endpoints.
backend/src/routes/theatre.routes.ts - Ticket routes · Booking and ticket endpoints.
backend/src/routes/ticket.routes.ts - Health routes · Service health endpoint.
backend/src/routes/health.routes.ts - Auth controller · Handles auth request/response mapping.
backend/src/controllers/auth.controller.ts - Movie controller · Handles movie HTTP operations.
backend/src/controllers/movie.controller.ts - Show controller · Handles show HTTP operations.
backend/src/controllers/show.controller.ts - Theatre controller · Handles theatre HTTP operations.
backend/src/controllers/theatre.controller.ts - Ticket controller · Handles booking HTTP operations.
backend/src/controllers/ticket.controller.ts - Auth service · Authentication and authorization logic.
backend/src/services/auth.service.ts - Movie service · Movie domain logic.
backend/src/services/movie.service.ts - Show service · Show scheduling logic.
backend/src/services/show.service.ts - Theatre service · Theatre domain logic.
backend/src/services/theatre.service.ts - Ticket service · Ticket booking logic.
backend/src/services/ticket.service.ts - DB config · Database connection boundary.
backend/src/config/db.ts - Domain models · Movie, show, theatre, ticket, and user data models.
backend/src/models
Frontend SPA
Vite + React client with routing, state, and API integrations.
- main.tsx · Bootstraps the React application.
frontend/src/main.tsx - App.tsx · Root UI composition and routing.
frontend/src/App.tsx - store.ts · Configures global client state.
frontend/src/app/store.ts - Auth slice · Manages auth state.
frontend/src/features/auth/authSlice.ts - Auth API · Auth endpoint integration.
frontend/src/features/auth/authApi.ts - Movies API · Movie endpoint integration.
frontend/src/features/moviesApi.ts - Theatre API · Theatre endpoint integration.
frontend/src/features/theatreApi.ts - Ticket API · Booking endpoint integration.
frontend/src/features/ticketApi.ts - Navbar · Application shell navigation.
frontend/src/components/Navbar.tsx - Protected routes · Blocks unauthenticated access.
frontend/src/components/ProtectedRoute.tsx - Auth guard · Restricts auth-only flows.
frontend/src/components/AuthProtectedRoute.tsx - Role guard · Restricts role-based admin pages.
frontend/src/components/RoleProtectedRoute.tsx - Auth page · Login and registration flow.
frontend/src/pages/AuthPage.tsx
Connections 40
- server.ts → app.ts: starts · Process entrypoint boots the app composition.
- app.ts → routes index: mounts · App registers API route collection.
- routes index → Auth routes: includes · Route registry includes auth routes.
- routes index → Movie routes: includes · Route registry includes movie routes.
- routes index → Show routes: includes · Route registry includes show routes.
- routes index → Theatre routes: includes · Route registry includes theatre routes.
- routes index → Ticket routes: includes · Route registry includes ticket routes.
- routes index → Health routes: includes · Route registry includes health routes.
- Auth routes → Auth controller: handles · Auth HTTP boundary delegates to controller.
- Movie routes → Movie controller: handles · Movie HTTP boundary delegates to controller.
- Show routes → Show controller: handles · Show HTTP boundary delegates to controller.
- Theatre routes → Theatre controller: handles · Theatre HTTP boundary delegates to controller.
- Ticket routes → Ticket controller: handles · Ticket HTTP boundary delegates to controller.
- Auth controller → Auth service: calls · Controller delegates business logic.
- Movie controller → Movie service: calls · Controller delegates business logic.
- Show controller → Show service: calls · Controller delegates business logic.
- Theatre controller → Theatre service: calls · Controller delegates business logic.
- Ticket controller → Ticket service: calls · Controller delegates business logic.
- Auth service → Domain models: uses · Auth logic reads/writes persisted user data.
- Movie service → Domain models: uses · Movie logic uses domain models.
- Show service → Domain models: uses · Show logic uses domain models.
- Theatre service → Domain models: uses · Theatre logic uses domain models.
- Ticket service → Domain models: uses · Ticket logic uses domain models.
- Domain models → DB config: persists via · Domain models sit behind the DB boundary.
- main.tsx → App.tsx: boots · Client entry renders root app.
- App.tsx → store.ts: uses · Root app connects to global state.
- store.ts → Auth slice: includes · Store includes auth state slice.
- Auth slice → Auth API: queries · Auth state is backed by auth API calls.
- store.ts → Movies API: includes · Store-backed feature integration for movies.
- store.ts → Theatre API: includes · Store-backed feature integration for theatres.
- store.ts → Ticket API: includes · Store-backed feature integration for tickets.
- App.tsx → Navbar: renders · App shell includes shared navigation.
- App.tsx → Protected routes: wraps · App uses route protection.
- App.tsx → Auth guard: wraps · Auth flow protection is applied at routing.
- App.tsx → Role guard: wraps · Admin pages are role-gated.
- App.tsx → Auth page: routes to · Root app exposes auth screen.
- Auth API → Auth routes: calls API · Client auth module talks to backend auth routes.
- Movies API → Movie routes: calls API · Client movie module talks to backend movie routes.
- Theatre API → Theatre routes: calls API · Client theatre module talks to backend theatre routes.
- Ticket API → Ticket routes: calls API · Client ticket module talks to backend ticket routes.