recommend-series
v1.0.0-213c9e719211
Published
A TV series recommendation tool
Maintainers
Readme
recommend-series
A CLI tool for TV series recommendations.
Summary
Thank you Matthias for this challenge, it was fun and interesting to solve.
My project is an npm package that can be installed and used locally, given the user has credentials as explained below. I used TDD to let complexity grow gradually and in a controlled way, especially with the usage of AI-aided coding. This approach really helped me stay focused and build features incrementally - I wrote tests first for the LLM query transformation, TVDB API integration, and response formatting, which made the implementation much cleaner. There is a GitHub Actions CI/CD workflow to automatically host on npmjs on push to main.
I implemented input sanitization to prevent prompt injection attacks, XSS vulnerabilities, and DoS attempts through input length validation. This was important since the app uses LLM APIs that could be manipulated by malicious input - and have my google billing account connected :] .
I also put some effort into the user experience - things like loading indicators, proper error handling with friendly messages, and support for follow-up queries like "tell me more about the first series" by maintaining conversation history. I engineered the prompts to handle natural language queries and transform them into TVDB API parameters.
Some separation of concerns is applied, the RecommendationEngine handles the "business" logic, TVDBClient manages API communication, and input sanitization is isolated. I also added Docker support so users can run it without installing Node.js locally.
What can be improved - self assessment
The user's preferences are not extracted with granular details due to time constraints. Also, the app lacks persistent memory, so the user will start from scratch each time they open it. The app can be pulled from npmjs, but is not hosted anywhere live. This would need to be tackled if the project went to prod, including automated test and lint workflows for CI. I initially misunderstood the requirement "on a server" - I thought I had to build a backend as well and not have the CLI communicate directly with the TVDB API. That took a lot of time and I could have double-checked this before investing the time (Cloud Run service account setup for a dockerized NestJS etc. -> all not needed here).
Installation
npm install -g recommend-seriesUsage
After installing globally, you need to set up your API credentials. You can either:
Option 1: Export environment variables
export LLM_API_KEY=your-api-key-here
export TVDB_API_KEY=your-tvdb-api-key-here
export TVDB_PIN=your-tvdb-pin-hereOption 2: Create a .env file in your current directory
LLM_API_KEY=your-api-key-here
TVDB_API_KEY=your-tvdb-api-key-here
TVDB_PIN=your-tvdb-pin-hereThen run the app:
recommend-seriesType your preferences and get recommendations. Type exit or quit to exit.
Development
With pnpm
pnpm install
pnpm devWith Docker
First, build the image:
docker compose buildThen run interactively:
docker compose run --rm recommend-seriesOr use Docker directly:
docker build -t recommend-series .
docker run -it --env-file .env recommend-series