Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

The Greenlight Project is designed to showcase a practical application of backend development using Go. Inspired by the "Let's Go Further" book by Alex Edwards, this project focuses on creating a high-performance, reliable, and easy-to-maintain backend service for managing movie data.

Getting Started

To get started with the Greenlight Project, follow the instructions below.

Prerequisites

  • Go (version 1.16 or higher)
  • Git
  • PostgreSQL

Installation

Clone the repository

git clone https://github.com/ovaixe/greenlight.git
cd greenlight

Set up environment variables

Create a .envrc file in the root directory and add the following variables:

export GREENLIGHT_DB_DSN=your_database_connection_string

Install dependencies

make vendor

Usage

To run the project locally:

Start the application

make run/api

API Endpoints

Movies

  • GET /v1/movies: Retrieve a list of movies
    
  • POST /v1/movies: Add a new movie
    
  • GET /v1/movies/{id}: Retrieve a specific movie by ID
    
  • PATCH /v1/movies/{id}: Update an existing movie
    
  • DELETE /v1/movies/{id}: Delete an existing movie
    
  • **GET /v1/movies/{id}/similar**: Get similar movies based on content
    
  • **GET /v1/movies/search/semantic?q=query**: Semantic search for movies
    

Users & Authentication

  • POST /v1/users: Register a new user
    
  • PUT /v1/users/activated: Activate a registered user
    
  • POST /v1/tokens/authentication: Create an authentication token for user
    

AI-Powered Movie Recommendations

This project includes AI-based movie recommendations using vector similarity search.

Features

  • Semantic Search: Find movies using natural language queries
  • Similar Movies: Get recommendations based on movie content
  • Automatic Embeddings: Movie embeddings are generated automatically when creating/updating movies

Setup

1. Install pgvector Extension

CREATE EXTENSION IF NOT EXISTS vector;

2. Run Database Migrations

make db/migrations/up

3. Start the Embedding Service

cd cmd/embedding-service
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python embedding_service.py

Or use the Makefile:

make run/embedding-service

4. Populate Embeddings for Existing Movies

make populate/embeddings

5. Start the API Server

make run/api

Usage Examples

Semantic Search

curl "http://localhost:4000/v1/movies/search/semantic?q=space+adventure" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Similar Movies

curl "http://localhost:4000/v1/movies/1/similar?limit=5" \
  -H "Authorization: Bearer YOUR_TOKEN"

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Welcome to the Greenlight Project, inspired by the principles and methodologies outlined in the "Let's Go Further" book by Alex Edwards. This project is a backend application written in Go (Golang) that manages movie data.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages