Skip to content

krishjp/movie-barcodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎬 MovieStripes — Movie Barcode Puzzle

Guess the movie from its unique barcode image — each barcode is generated from the frames of the movie, turning colors and pacing into a single visual strip.


Overview

MovieStripes is a daily online puzzle game where players guess a movie from its barcode.
The backend is built with a serverless AWS architecture for speed, scalability, and low cost.


Architecture

flowchart TD
    A[Player's Browser] -->|HTTP GET /api/puzzle/today| B[API Gateway]
    B --> C[Lambda Function: Fetch Puzzle]
    C --> D[(AWS RDS - PostgreSQL)]
    C --> E[(AWS S3 - Barcode Images)]
    F[Admin CLI Script] -->|Upload Images + DB Entry| E
    F --> D
Loading

Components:

  • AWS S3 — Stores static barcode images and hosts the frontend.
  • AWS RDS (PostgreSQL) — Stores movie metadata, puzzle schedule, and gameplay data.
  • AWS Lambda — Handles API requests, database queries, and caching.
  • API Gateway — Routes requests from the frontend to the Lambda backend.
  • Admin CLI — Uploads new puzzles (barcode images + DB entry) from your local machine.

Features

  • Daily Puzzle — One movie per day for all players.
  • Fast Loading — Caching reduces load time from 1.8s → 350ms.
  • Serverless — Low cost and automatically scales with player traffic.
  • PostgreSQL-backed — Reliable storage for puzzles and movie data.
  • S3 Static Hosting — Barcodes and frontend served directly from S3.

Tech Stack

Component Technology
Frontend React.js
Backend AWS Lambda (running Node.js code)
Database AWS RDS (PostgreSQL)
Storage AWS S3
API Routing AWS API Gateway
Infrastructure Serverless Framework

Setup & Installation

1️⃣ Clone the Repo

git clone https://github.com/yourusername/moviestripes.git
cd moviestripes

2️⃣ Create the RDS Database

  • Create a PostgreSQL RDS instance (public or private).
  • Load your schema:
psql -h <RDS_ENDPOINT> -U <USERNAME> -d <DB_NAME> -f schema.sql

3️⃣ Create the S3 Buckets

  • Bucket 1: moviestripes-images (private or public)
  • Bucket 2: moviestripes-frontend (public for hosting)

Upload frontend files:

aws s3 sync ./frontend s3://moviestripes-frontend --delete

4️⃣ Deploy the Lambda API

serverless deploy

5️⃣ Configure Environment Variables

In AWS Lambda or serverless.yml:

DB_HOST=<RDS_ENDPOINT>
DB_USER=<USERNAME>
DB_PASS=<PASSWORD>
DB_NAME=<DB_NAME>
S3_BUCKET=<moviestripes-images>

Admin Workflow: Adding a New Puzzle

Run the admin CLI:

python upload_puzzle.py --title "Inception" --year 2010 --genre "Sci-Fi" --director "Christopher Nolan" --barcode ./barcodes/inception.png

This script:

  1. Uploads the barcode image to S3.
  2. Inserts metadata into the RDS database.
  3. Schedules it for a future puzzle date.

upload_puzzle.py is tracked under the backend subfolder


Performance

  • API caching reduced average puzzle load time:

    • Before: 1.8 seconds
    • After: 350 milliseconds
  • Reduced DB query load by 70% via cache hits.

  • Enabled near-instant puzzle loading for repeat visits.


Future Roadmap

  • Add multiplayer leaderboard.
  • Add difficulty levels (easy, medium, hard).
  • Support user-submitted barcodes.
  • Progressive Web App (PWA) offline mode.

License

MIT License © 2025 Krish Patel


Acknowledgments

Inspired by the MovieBarCodeGenerator project by mlaidly on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •