This was my first backend project. I built it to practice working with MySQL, FastAPI, Pandas and Docker together in one project. The idea is a movie theatre booking system where customers can book seats and prices change depending on the seat type and day of the week.
- Python and FastAPI for the REST API
- MySQL for storing movies, customers and bookings
- SQLAlchemy as the ORM
- Pandas for cleaning and loading movie data from CSV into the database
- Docker to containerize the API and database together
Clone the repo and create a .env file from the example:
cp .env.example .env
Update the .env with your MySQL credentials then run with Docker:
docker compose up --build
Or run locally:
pip install -r requirements.txt uvicorn main:app --reload
The API will be at http://localhost:8000 and the docs at http://localhost:8000/docs
To clean and load sample movies from CSV run:
python3 seed.py
Pandas reads the CSV, drops missing values, fixes text casing, removes duplicates and checks for existing records before inserting. This avoids loading the same data twice.
Movies, customers and bookings each have GET, POST and DELETE endpoints. When a booking is made the system looks up the seat type to get the base price, checks the day of the week for any discount and calculates the final price automatically.
Seat types are regular, VIP and recliner. Discounts are higher mid-week and zero on weekends.