Skip to content

JAllsop/Omdb-Terminal

Repository files navigation

OMDB Terminal

.NET Aspire .NET C# MySQL Docker Swagger OData

Build and Release CLI GitHub issues GitHub pull requests

OMDB Terminal is a .NET-based CLI application and REST API designed to interact with the Open Movie Database (OMDb) API. Built with a focus on modern .NET architecture (.NET 10), performance, and developer experience. It serves as a proxy for movie data, has intelligent caching and OData search capabilities

The project is orchestrated using .NET Aspire, which handles containerization, telemetry, and infrastructure management, enabling feature implementation and easy setup

Table of Contents

Features

Core Capabilities

  • OMDb API Integration: Search for movies by title or fetch detailed information using an IMDb ID
  • Intelligent Caching (Cache-Aside Pattern): Movie details fetched from OMDb are automatically persisted to a local MySQL database. Subsequent requests for the same movie are served from the database - reducing API quota usage and improving response times
  • Advanced Data Searching (OData): Perform complex, server-side filtering, sorting, and pagination on cached movie data directly via standard OData query strings (e.g., ?$filter=contains(Title, 'Matrix')&$orderby=Year desc)
  • Complete Cache Management: Full CRUD (Create, Read, Update, Delete) operations available via a dedicated CachedEntries controller

Architecture & Infrastructure

Architecture Diagram
  • Frontend (Terminal CLI): A standalone .NET console application - interacts with users and communicates with the backend via HTTP/OData
  • Backend (REST API): A ASP.NET Core API providing endpoints for searching, fetching, and managing OMDB movie data
  • .NET Aspire Orchestration: The entire solution (API, MySQL Database, and Telemetry) is managed by .NET Aspire, ensuring a one-click local setup with automatic container provisioning and connection string injection
  • Entity Framework Core: Leverages EF Core with Pomelo MySQL for automated design-time migrations and data operations
  • Service-Oriented Architecture: Strict separation of concerns, keeping Controllers thin by delegating business logic and database interactions to dedicated services (IMovieService, ICachedEntriesService)
  • Dependency Injection: Utilizes a static SimpleInjector container within the CLI for dependency resolution

Database Schema

The database relies on Entity Framework Core to manage relations between cached movies and their associated ratings

Database Schema
  • MovieEntity: Stores comprehensive movie metadata (Title, Year, Plot, Poster, etc.) and tracks cache status (IsDetailed, IsCustom)
  • RatingsEntity: Relies on a one-to-many relationship linking a movie to various rating sources (e.g., Internet Movie Database, Rotten Tomatoes, Metacritic)

Developer Experience

  • Swagger Integration: Full OpenAPI documentation with a custom Swagger filter (ODataOperationFilter) to natively support OData parameter inputs within the Swagger UI
  • OpenTelemetry Dashboard: Real-time visibility into database queries, HTTP requests, and application logs via the .NET Aspire Dashboard

Media Showcase

.NET Aspire Infrastructure

.NET Aspire Dashboard .NET Aspire Startup Logs
Aspire Dashboard Aspire Console Logs

Terminal CLI (V2)

CLI Startup Searching for Movies by Title
CLI Startup Example CLI Search Example
Opening a Searched Movie Viewing Cached Entries
CLI Search Open Example CLI Cached Example
Opening a Cached Entry Custom Cache Query
CLI Cached Open Example CLI Custom Example
Custom Entry View
CLI Custom Open Example

V2 Demo Video

Demo.mp4

Terminal CLI (V1.1)

Searching for movies by title Fetching and caching detailed movie data by IMDb ID
CLI Search Example CLI Lookup Example

V1.1 Demo Video

Demo.mp4

Technical Considerations & Known Limitations

As this project is designed primarily as a technical assessment, several intentional trade-offs were made to prioritize ease-of-use and rapid deployment:

  • CLI/API Coupling: V1.1 featured tight UI/API coupling to establish a rapid MVP - V2 fully resolves this with a cleaner separation of concerns
  • Automated Migrations: Entity Framework migrations run automatically on startup for ease of local testing - in production, these would be managed via secure, on-demand scripts to prevent data loss (among other issues)
  • In-Repo API Key: A demo OMDb API key is deliberately included in the repository for a frictionless review process - exposing it here is safe as it exclusively accesses a free, read-only service

Getting Started

Prerequisites

Note: For ease of testing and review, this repository is pre-configured with a demo OMDb API key — you do not need to generate or configure your own to run the project. In a Real World Environment, this would not be the case!

Running the Project

Architecture Note:
.NET Aspire is a cloud-native orchestrator - it is designed to be deployed to cloud environments not run as a standalon desktop app
Because of this, you cannot simply run the standalone CLI executable without first spinning up the backend locally
The .NET SDK handles automatically provisioning the MySQL Docker containers and injecting the dynamic connection strings into the API proxy

1. Clone the Repository

Open your terminal and clone the repository to your local machine:

git clone https://github.com/JAllsop/Omdb-Terminal-CarTrack-JAllsop.git
cd Omdb-Terminal-CarTrack-JAllsop

2. Start the Backend Infrastructure

Open a terminal in the root of the repository and run the setup script for your operating system

  • Windows

    .\start-backend-windows.ps1
  • Mac/Linux

    .\start-backend-windows.ps1

The scripts do the following:

  • Check for and initalise .NET User Secrets
  • Save the API key to .NET User Secrets - the included or user provided one
  • Spin up the Aspire orchestrator (API & MySQL Database)

3. Run the CLI

Leave the backend terminal running. Open a new terminal window, navigate to the CLI project, and run it:

cd OmdbTerminal/OmdbTerminal.Cli
dotnet run

Pre-Compiled CLI Binaries

If you prefer not to compile the frontend yourself using dotnet run, you can download the standalone CLI executable (available for Windows, macOS, and Linux) directly from the Releases tab

Important: You must still complete steps 1 & 2 above to run the Aspire backend infrastructure locally so the pre-compiled CLI has an API to connect to

About

A lightweight Command Line Interface (CLI) for searching and retrieving movie metadata using the OMDb API. Built for developers who want to query movie, series, and episode information directly from the terminal

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages