Back-office for cinema management | Epitech project · PHP MVC + Vue 3 + MySQL
Table of Contents
My Cinema is a back-office web application for cinema managers. It provides a complete administration interface to manage movies, screening rooms, and showtime schedules. Built as an Epitech project, it implements a custom MVC architecture in PHP without any framework, following best practices for security (prepared statements, input validation) and object-oriented design.
- Movie management — Full CRUD for movies with title, director, genre, duration, and release year. Movies with existing screenings are protected from deletion.
- Room management — Create, edit, and soft-delete screening rooms. Each room has a name, capacity, and type (Standard, 3D, IMAX).
- Screening scheduling — Schedule film screenings in specific rooms at specific times. Automatic conflict detection prevents double-booking and overlapping screenings based on movie duration.
- REST API — Complete JSON API with 15 endpoints covering all CRUD operations for movies, rooms, and screenings.
- Modern dashboard — Single-page application built with Vue 3 and shadcn-vue components, featuring dark/light theme, responsive tables, and form validation.
— Backend runtime (8.3+)
— Frontend framework
— Relational database
— Utility-first CSS framework
— Frontend build tool
— PHP dependency manager
graph LR
A[Vue 3 SPA] -->|fetch /api/*| B[index.php]
B --> C[Router]
C --> D[MoviesController]
C --> E[RoomsController]
C --> F[ScreeningsController]
D --> G[Model]
E --> G
F --> G
G -->|PDO| H[(MySQL)]
G -->|JSON| C
C -->|JSON Response| A
The frontend Vue 3 SPA communicates with the backend through fetch() calls to REST API endpoints. The backend's single entry point (index.php) routes requests to the appropriate controller, which validates input, calls the model layer, and returns JSON responses. Models use PDO with prepared statements for all database operations.
- PHP 8.3 or higher
- MySQL 8.0 or higher
- Composer (PHP dependency manager)
- Node.js 18+ and npm
-
Clone the repository:
git clone https://github.com/Sofian-bll/ept-my-cinema.git cd my-cinema -
Install PHP dependencies:
cd backend composer install -
Install frontend dependencies:
cd ../frontend npm install -
Create the database:
mysql -u root -p < ../backend/database/schema.sqlOptionally, seed with sample data:
mysql -u root -p < ../backend/database/seed.sql
-
Copy the environment file in the backend directory:
cd backend cp .env.example .env -
Edit
.envwith your database credentials:APP_ENV=dev DB_HOST=localhost DB_NAME=my_cinema DB_USER=root DB_PASS=your_password
Start the backend (PHP built-in server):
cd backend
php -S localhost:8000 -t publicStart the frontend (Vite dev server):
cd frontend
npm run devOpen http://localhost:5173 in your browser. The dashboard provides:
- Dashboard — Overview of the cinema
- Movies — Add, edit, and delete films
- Rooms — Manage screening rooms and their types
- Screenings — Schedule and manage film showtimes
- Settings — Application preferences
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/movies |
List all movies |
| GET | /api/movies/{id} |
Get movie details with screenings |
| POST | /api/movies |
Create a movie |
| PUT | /api/movies/{id} |
Update a movie |
| DELETE | /api/movies/{id} |
Delete a movie |
| GET | /api/rooms |
List all rooms |
| GET | /api/rooms/{id} |
Get room details |
| POST | /api/rooms |
Create a room |
| PUT | /api/rooms/{id} |
Update a room |
| DELETE | /api/rooms/{id} |
Soft-delete a room |
| GET | /api/screenings |
List all screenings |
| GET | /api/screenings/{id} |
Get screening details |
| POST | /api/screenings |
Create a screening |
| PUT | /api/screenings/{id} |
Update a screening |
| DELETE | /api/screenings/{id} |
Delete a screening |
my-cinema/
├── backend/
│ ├── app/
│ │ ├── Controllers/ # Request handlers (Movies, Rooms, Screenings)
│ │ ├── Core/ # Router, Database, Model base, Controller base
│ │ ├── Helpers/ # Validation, Date utilities
│ │ ├── Models/ # Entity classes (Movies, Rooms, Screenings)
│ │ └── Traits/ # SoftDelete behavior
│ ├── config/ # Routes and database configuration
│ ├── database/
│ │ ├── schema.sql # Database schema
│ │ └── seed.sql # Sample data
│ ├── public/
│ │ └── index.php # Single entry point
│ ├── tests/ # PHPUnit tests
│ └── composer.json
├── frontend/
│ ├── src/
│ │ ├── components/ # Vue components (ui, layout, movies, rooms, screenings)
│ │ ├── pages/ # Page components (Dashboard, Movies, Rooms, Screenings)
│ │ ├── router/ # Vue Router configuration
│ │ └── assets/ # CSS styles
│ ├── package.json
│ └── vite.config.js
├── docs/
│ └── assets/
│ └── logo.png
├── LICENSE
└── .gitignore
The backend follows a custom MVC pattern without any PHP framework:
- Entry point:
backend/public/index.php— All requests are routed through this single file - Router:
Core/Router.php— Matches URL patterns and HTTP methods to controller actions - Controllers: Handle request/response logic, validate input, call models
- Models: Extend
Core/Model.php— Provide PDO-based CRUD operations with prepared statements - Traits:
SoftDeleteTrait— Implements soft delete for rooms (preserves data with a deleted timestamp) - Error handling: Centralized error handler with JSON error responses
All business logic is server-side. The frontend is a thin Vue 3 SPA that consumes the REST API — no business logic in JavaScript.
Distributed under the MIT License. See LICENSE for more information.
