GitHunt
DE

deaneeth/enterprise-cinema-booking-platform

A scalable, multi-tenant cinema management platform built with the MERN Stack, TypeScript, and Docker. Features real-time seat reservation (WebSockets), role-based access control (RBAC), secure payments, and extensive automated testing.

CineBook Logo

๐ŸŽฌ Enterprise Cinema Booking Platform

A scalable, multi-tenant cinema management platform built with the MERN Stack

Features โ€ข Tech Stack โ€ข Installation โ€ข Usage โ€ข API โ€ข Contributors

React TypeScript Node.js MongoDB Express Docker

CI Status License Last Commit Contributors


๐Ÿ“ธ Screenshots

Home Page

๐Ÿ–ผ๏ธ View More Screenshots
Page Screenshot
Home Home
Movie Listing Movies
Movie Details Movie Details
Seat Selection Seat Selection
Payment Payment
Booking Confirmation Confirmation
User Profile Profile
Admin Dashboard Admin
Cinema-Admin Dashboard Admin

โœจ Features

๐ŸŽŸ๏ธ Booking System

  • Real-time seat reservation with WebSocket updates
  • Interactive seat map with live availability
  • 15-minute booking timer with auto-expiration
  • QR code tickets with PDF download
  • Booking history with status tracking

๐Ÿ” Authentication & Security

  • JWT-based authentication with refresh tokens
  • Role-based access control (User, Cinema Admin, Platform Admin)
  • Email verification via OTP
  • Secure password hashing with bcrypt
  • Rate limiting & CORS protection

๐Ÿ’ณ Payment Integration

  • PayPal Checkout integration
  • Sandbox & Production modes
  • Automatic refund on cancellation
  • Payment history & receipts
  • Secure transaction handling

๐ŸŽฌ Cinema Management

  • Multi-cinema support (B2B platform)
  • Movie & showtime management
  • Dynamic pricing by showtime
  • Seating layout customization
  • Cinema admin applications

๐Ÿ“Š Admin Dashboards

  • Platform Admin: User, cinema, movie management
  • Cinema Admin: Showtimes, bookings, analytics
  • Approval workflows for new cinemas
  • Revenue tracking & reports

โญ Reviews & Ratings

  • Movie & cinema reviews
  • Star ratings with averages
  • Verified booking badge
  • Review moderation

๐Ÿ› ๏ธ Tech Stack

Frontend Backend Database DevOps
React
React 18
Node.js
Node.js
MongoDB
MongoDB
Docker
Docker
TypeScript
TypeScript
Express
Express.js
Mongoose
Mongoose
GitHub Actions
CI/CD
Tailwind
Tailwind CSS
Socket.io
Socket.io
Redis
Redis (Cache)
Jest
Jest

Additional Technologies

Category Technologies
State Management React Query (TanStack Query)
Form Handling React Hook Form
HTTP Client Axios
Authentication JWT, bcryptjs
Validation Joi
Payment PayPal Checkout SDK
File Generation jsPDF, html2canvas, QRCode
Testing Jest, Supertest, React Testing Library

๐Ÿ—๏ธ Architecture

graph TB
    subgraph Client["๐Ÿ–ฅ๏ธ Frontend (React)"]
        UI[UI Components]
        RQ[React Query]
        WS[WebSocket Client]
    end

    subgraph Server["โš™๏ธ Backend (Express)"]
        API[REST API]
        Auth[Auth Middleware]
        WSS[WebSocket Server]
    end

    subgraph Data["๐Ÿ’พ Data Layer"]
        MongoDB[(MongoDB)]
        Cache[(Redis Cache)]
    end

    subgraph External["๐ŸŒ External Services"]
        PayPal[PayPal API]
        Email[SendGrid]
    end

    UI --> RQ --> API
    WS <--> WSS
    API --> Auth --> MongoDB
    API --> Cache
    API --> PayPal
    API --> Email

๐Ÿš€ Installation

Prerequisites

  • Node.js >= 18.x
  • MongoDB >= 6.0 (or Docker)
  • npm >= 9.x
# Clone the repository
git clone https://github.com/deaneeth/enterprise-cinema-booking-platform.git
cd enterprise-cinema-booking-platform

# Start all services
docker compose up -d

# Access the application
# Frontend: http://localhost:3000
# Backend API: http://localhost:5000
# MongoDB: localhost:27017

Manual Installation

๐Ÿ“‹ Step-by-step instructions

1. Clone the repository

git clone https://github.com/deaneeth/enterprise-cinema-booking-platform.git
cd enterprise-cinema-booking-platform

2. Install dependencies

# Install root dependencies
npm install

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

3. Configure environment variables

# Backend (.env in /backend directory)
cp backend/.env.example backend/.env

Edit backend/.env:

# Server
PORT=5000
NODE_ENV=development

# MongoDB
MONGODB_URI=mongodb://localhost:27017/cinema-booking

# JWT
JWT_SECRET=your-super-secret-key
JWT_EXPIRES_IN=7d

# PayPal (Optional - for payments)
PAYPAL_CLIENT_ID=your-paypal-client-id
PAYPAL_CLIENT_SECRET=your-paypal-client-secret
PAYPAL_MODE=sandbox

# Email (Optional - for verification)
SENDGRID_API_KEY=your-sendgrid-api-key
FROM_EMAIL=noreply@yourcinema.com

4. Start MongoDB

# Using Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest

# Or install MongoDB locally
# https://www.mongodb.com/docs/manual/installation/

5. Run the application

# Start backend (from /backend directory)
cd backend
npm run dev

# Start frontend (from /frontend directory - new terminal)
cd frontend
npm start

๐Ÿ“– Usage

Default Accounts

After seeding the database (or first run), use these accounts:

Role Email Password
Platform Admin admin@gmail.com Admin123
Cinema Admin cinema@gmail.com Cinema123
Regular User user@gmail.com User123

User Workflows

journey
    title Movie Booking Journey
    section Browse
      View Movies: 5: User
      Select Movie: 5: User
      View Showtimes: 5: User
    section Book
      Select Seats: 4: User
      15-min Timer Starts: 3: System
      Proceed to Payment: 4: User
    section Pay
      PayPal Checkout: 4: User
      Confirm Payment: 5: PayPal
    section Receive
      Get QR Ticket: 5: System
      Download PDF: 5: User

๐Ÿ“ก API Documentation

The API follows RESTful conventions with comprehensive documentation.

Base URL

Development: http://localhost:5000/api
Production: https://api.your-domain.com/api

Authentication

All protected endpoints require a Bearer token:

Authorization: Bearer <your-jwt-token>

Quick Reference

Endpoint Method Description Auth
/auth/register POST Register new user โŒ
/auth/login POST Login user โŒ
/movies GET List all movies โŒ
/movies/:id GET Get movie details โŒ
/cinemas GET List all cinemas โŒ
/showtimes GET Get showtimes โŒ
/bookings POST Create booking โœ…
/bookings/:id GET Get booking โœ…
/payments/create-order POST Create PayPal order โœ…
/payments/capture POST Capture payment โœ…
๐Ÿ“š View Full API Documentation

See API_DOCUMENTATION.md for complete endpoint details, request/response schemas, and examples.


๐Ÿงช Testing

# Run all backend tests
cd backend
npm test

# Run unit tests only
npm run test:unit

# Run integration tests
npm run test:integration

# Run with coverage report
npm run test:coverage

# Run frontend tests
cd frontend
npm test

Test Coverage

Module Coverage
Controllers ~80%
Services ~85%
Models ~90%
Middleware ~75%

๐Ÿ“ Project Structure

enterprise-cinema-booking-platform/
โ”œโ”€โ”€ ๐Ÿ“‚ backend/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ src/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ config/        # Database & app configuration
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ controllers/   # Route handlers
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ middlewares/   # Auth, validation, error handling
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ models/        # Mongoose schemas
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ routes/        # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ services/      # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ tests/         # Unit & integration tests
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ types/         # TypeScript definitions
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ utils/         # Helper functions
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ server.ts      # Entry point
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ package.json
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ tsconfig.json
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ frontend/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ src/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ components/    # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ contexts/      # React contexts
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ hooks/         # Custom hooks
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ pages/         # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ services/      # API client
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ types/         # TypeScript types
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ App.tsx        # Root component
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ package.json
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ tailwind.config.js
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ docs/                  # Documentation
โ”œโ”€โ”€ ๐Ÿ“„ docker-compose.yml     # Docker configuration
โ”œโ”€โ”€ ๐Ÿ“„ .github/workflows/     # CI/CD pipelines
โ””โ”€โ”€ ๐Ÿ“„ README.md

๐Ÿ—„๏ธ Database Schema

erDiagram
    USER ||--o{ BOOKING : makes
    USER ||--o{ REVIEW : writes
    CINEMA ||--o{ SHOWTIME : has
    CINEMA ||--o{ REVIEW : receives
    MOVIE ||--o{ SHOWTIME : scheduled_in
    MOVIE ||--o{ REVIEW : receives
    SHOWTIME ||--o{ BOOKING : for
    BOOKING ||--o| PAYMENT : has

    USER {
        ObjectId _id PK
        string email UK
        string password
        string name
        enum role
        boolean isVerified
    }

    CINEMA {
        ObjectId _id PK
        string name
        string location
        array facilities
        ObjectId adminId FK
    }

    MOVIE {
        ObjectId _id PK
        string title
        string description
        number duration
        string genre
        string poster
    }

    SHOWTIME {
        ObjectId _id PK
        ObjectId movieId FK
        ObjectId cinemaId FK
        datetime startTime
        number price
        array seats
    }

    BOOKING {
        ObjectId _id PK
        ObjectId userId FK
        ObjectId showtimeId FK
        array seats
        enum status
        number totalAmount
    }

    PAYMENT {
        ObjectId _id PK
        ObjectId bookingId FK
        string paypalOrderId
        number amount
        enum status
    }
๐Ÿ“š View Full Database Schema

Database Schema


๐Ÿค Contributors

Dean Hettiarachchi
Dineth Hettiarachchi

Project Lead
Wickramaarachchi B S
Wickramaarachchi B S

Backend Developer
Himasha Sandeepani
Himasha Sandeepani

Frontend Developer
Kasun Madhusanka
Kasun Madhusanka

Full Stack Developer
Kavix
Kavindu

Backend Developer
Ashiru
Ashiru

Frontend Developer
Jayaweera HRK
Jayaweera HRK

Developer
Rashmi Edirisinghe
Rashmi Edirisinghe

Developer

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


โญ Star this repository if you found it helpful!

Report Bug โ€ข Request Feature