A Node.js backend application for tracking movies you've watched, with integration for OMDB API and Letterboxd export functionality.
- Track movies you've watched with details like viewing date, format, and location
- Search movies using OMDB API
- Export your watched movies to Letterboxd format
- Check if a movie is a first-time viewing
- API key authentication for secure endpoints
- Node.js (v14 or higher)
- MariaDB/MySQL database
- OMDB API key
- Clone the repository
- Install dependencies:
npm install
- Copy
.env.example
to.env
and fill in your configuration:cp .env.example .env
- Configure your environment variables in
.env
:PORT
: The port number for the server (default: 3000)MOVIETHING_SQL_HOST
: MariaDB hostMOVIETHING_SQL_USER
: MariaDB usernameMOVIETHING_SQL_PASS
: MariaDB passwordMOVIETHING_SQL_DB
: MariaDB database nameMOVIETHING_OMDB_API_KEY
: Your OMDB API keyMOVIETHING_VALID_API_KEY
: Your chosen API key for authentication
Ensure you have a MariaDB database with the following table:
CREATE TABLE movies (
movieTitle VARCHAR(255),
viewingDate DATE,
movieURL VARCHAR(255),
viewFormat VARCHAR(255),
viewLocation VARCHAR(255),
firstViewing TINYINT(1),
movieGenre VARCHAR(255),
movieReview TEXT
);
Development mode with auto-reload:
npm run dev
Production mode:
npm start
All endpoints that require authentication need an apiKey
parameter either in the query string or request body.
GET /
: Get movies watched in a specific year (defaults to current year)POST /searchMovie
: Search for movies using OMDB APIPOST /getMovieDetails
: Get detailed movie information from OMDBPOST /newEntry
: Add a new movie entryGET /exportLetterboxd
: Export movies in Letterboxd CSV format
Search for a movie:
curl -X POST "http://localhost:3000/searchMovie" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "apiKey=your_api_key" \
-d "json={\"title\":\"The Matrix\"}"
Add a new movie entry:
curl -X POST "http://localhost:3000/newEntry" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "apiKey=your_api_key" \
-d "json={\"movieTitle\":\"The Matrix\",\"viewingDate\":\"2024-03-15\",\"movieURL\":\"https://www.imdb.com/title/tt0133093\",\"viewFormat\":\"Digital\",\"viewLocation\":\"Home\",\"movieGenre\":\"Sci-Fi\",\"movieReview\":\"Amazing!\",\"firstViewing\":true}"