Movie Watchlist API- Python
Track your movies watchlist
A personal movie watchlist application that integrates with the OMDb API to fetch movie metadata and provides analytics on your viewing habits. I wanted to learn how to create APIs and do CRUD in python.
Features:
- Search movies by title using
OMDb API - Add/remove movies to personal watchlist
- Track watched vs. unwatched status
Tech Stack
- Backend:
FastAPI,Python 3.8+ - Database:
PostgreSQL,SQLAlchemy ORM - Data Processing:
Pandas - API Integration: OMDb API via
Requests - Testing:
pytest,pytest-cov - DevOps:
Docker,uvicorn
Architecture
The application follows a clean, layered architecture:
┌─────────────────┐
│ FastAPI App │ ← REST endpoints
├─────────────────┤
│ CRUD Layer │ ← Database operations
├─────────────────┤
│ SQLAlchemy ORM │ ← Data models
├─────────────────┤
│ PostgreSQL │ ← Persistent storage
└─────────────────┘
↕
┌─────────────────┐
│ OMDb Client │ ← External API integration
└─────────────────┘
Key Features & Implementation
- RESTful API Design- Implemented 8 endpoints following REST conventions with proper HTTP status codes:
-
GET /api/v1/search/{title}- Search movies -
GET /api/v1/movies/{imdb_id}- Get movie details -
GET /api/v1/movies/- List watchlist (with optional?watched=true/falsefilter) -
POST /api/v1/movies- Add to watchlist -
PATCH /api/v1/movies/{imdb_id}/watched- Update status -
DELETE /api/v1/movies/{imdb_id}- Remove from watchlist -
GET /api/v1/analytics- Get watchlist analytics
-
- Data Analytics with Pandas - Built analytics and computes insights from watchlist data
- Database Design -
PostgreSQLschema with SQLAlchemy ORM managing movie metadata and watch status. - External API Integration with OMDb client to get movie data.
- Comprehensive Testing achieving 90%+ code coverage with
pytestincluding CRUD operations, API endpoints, and edge cases.
Learnings:
- New Technologies:
FastAPI,SQLAlchemy,pytest - API Design: Following REST conventions makes APIs intuitive and predictable
- Documentation: FastAPI’s auto-generated docs saved significant development time
Links
- GitHub Repository: ctheara/movies-watchlist-python
- API Documentation: Run locally and visit
/docs
Technologies: Python · FastAPI · PostgreSQL · SQLAlchemy · Pandas · Docker · pytest · RESTful API