CineQuery is an interactive application for searching movies in the Sakila (MySQL) database with logging of user queries in MongoDB. The project follows clean architecture principles, supports two interfaces (TUI and Web), and includes a query analytics system.
The project provides two interfaces:
- 🖥 TUI (Textual UI) --- a modern terminal-based interface
- 🌐 Web (FastAPI) --- a web interface with templates
- Search by keyword (movie title)
- Pagination (10 results per page)
- Ability to load all results
- By genre (multi-select)
- By year range
- Combined filtering
- Top 5 most popular queries
- Recent search history
- All queries are stored in MongoDB
- Stored data includes:
- query text
- number of results
- search type
- parameters
- timestamp
The project is built following clean architecture principles:
├── app/
│ ├── core/ # Database connections and configuration
│ ├── models/ # Domain models (Movie Dataclass)
│ ├── repositories/ # Data access layer (SQL/NoSQL logic)
├── cli/ # TUI logic (Textual)
├── web/ # Templates and static files for Web
├── tests/ # Automated tests
├── main.py # TUI entry point
└── run_web.py # Web entry point
- Separation of concerns
- Repository pattern
- Minimal code duplication
- PEP8 compliance
- Python 3.10+
- MySQL
- MongoDB
- FastAPI
- Textual (TUI)
- pymysql / pymongo
- Jinja2
- pytest
git clone <your-repo>
cd CineQuerypython -m venv venv
# Linux / Mac
source venv/bin/activate
# Windows
venv\Scripts\activatepip install -r requirements.txtCreate a .env file based on .env.example.
- Install MySQL
- Import the Sakila database
- Install MongoDB locally or use MongoDB Atlas
python main.pypython run_web.pypytest testsCoverage includes:
- Repository layer
- Models
- Logging
This project demonstrates:
- Clean Architecture
- Working with SQL + NoSQL
- Building CLI + Web applications
Educational project for portfolio purposes.