Skip to content

Latest commit

Β 

History

History
71 lines (58 loc) Β· 1.88 KB

File metadata and controls

71 lines (58 loc) Β· 1.88 KB

β€œMovie Catalog API” (PostgreSQL, FastAPI)

Goal: Create an API that lists and manages movie/TV show data from a dataset. Focus on CRUD operations and clean data modeling.

πŸ“¦ Stack

  • FastAPI
  • PostgreSQL
  • SQLAlchemy

πŸ“Š Dataset

Use the IMDb Movie Dataset or generate a smaller version with:

  • Title
  • Genre(s)
  • Release year
  • Duration
  • Director
  • Average rating

πŸ”§ API Endpoints

  • GET /movies – list all movies
  • GET /movies/{id} – get movie by ID
  • GET /movies/search?genre=Action&year=2020 – filter
  • POST /movies – add new movie
  • PUT /movies/{id} – update
  • DELETE /movies/{id} – delete

🧠 Learnings

  • Normalize genres into a separate table (many-to-many)
  • Write efficient queries
  • Work with PostgreSQL joins
  • Handle numeric filters (ratings, year range)

Β 

FOLDER STRUCTURE

city_events_api/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py               # FastAPI app instance
β”‚   β”œβ”€β”€ config.py             # DB and app settings
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── event.py          # SQLAlchemy Event model
β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── event.py          # Pydantic schemas
β”‚   β”œβ”€β”€ crud/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── event.py          # DB logic (CRUD operations)
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── routes_event.py   # API route definitions
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ session.py        # DB connection
β”‚   β”‚   └── base.py           # Base class for models
β”‚   └── utils/
β”‚       └── populate.py       # Script to load fake or real data
β”œβ”€β”€ alembic/                  # DB migrations
β”‚   └── ...
β”œβ”€β”€ alembic.ini
β”œβ”€β”€ requirements.txt
└── README.md