Movie Master is a full-stack movie exploration app.
You can:
- Search movies
- View details and generated summaries
- Chat with a movie assistant
- Translate content
- Rate movies and get recommendations
The project has:
- A FastAPI backend in
backend/ - A React + Vite frontend in
frontend/
- Python 3.11+
- Node.js 18+
pnpm9+ preferred for manual frontend worknpm9+ if you want to usescripts/dev-setup.ps1- Docker and Docker Compose (for PostgreSQL)
Quick checks:
python --version
node --version
pnpm --version
docker --version
docker-compose --versionIf python is not recognized on Windows, try:
py --versionThe backend uses SQLite by default for local development. For production or advanced development with PostgreSQL:
docker-compose up -dThis starts a PostgreSQL 15 container with:
- Database:
userdb - User:
postgres - Password:
postgres - Port:
5432
docker exec -it movie-master psql -U postgres -d userdbOnce connected to psql, you can:
-- List all tables
\dt
-- View users table
SELECT * FROM users;
-- View ratings table
SELECT * FROM ratings;
-- Exit psql
\qCreate or update backend/.env:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/userDB
USE_POSTGRESQL=truedocker-compose downTo also remove the data volume:
docker-compose down -vThe quickest way to run the app with the latest code and dependencies:
Windows (PowerShell):
.\scripts\run-latest.ps1macOS / Linux (Bash):
chmod +x scripts/run-latest.sh
./scripts/run-latest.shThis script will:
- Pull the latest code from git
- Create/update the backend virtual environment
- Install/update all dependencies
- Start both backend and frontend
The apps will open automatically:
- Backend:
http://localhost:8000/docs - Frontend:
http://localhost:5173
Optional flags:
- PowerShell:
-NoGitUpdate,-BackendPort 8001,-FrontendPort 5174 - Bash:
--no-git-update,--backend-port 8001,--frontend-port 5174
Example:
.\scripts\run-latest.ps1 -BackendPort 8001 -FrontendPort 5174From the repository root:
- Start backend in terminal 1
- Start frontend in terminal 2
- Open
http://localhost:5173
Detailed commands are below.
If you are on Windows PowerShell, use the bootstrap script:
.\scripts\dev-setup.ps1What it does:
- Creates backend virtual environment (
backend/.venv) if missing - Installs backend dependencies (
requirements.txtandrequirements-dev.txt) - Installs frontend dependencies (
npm install)
To set up and launch backend + frontend automatically in separate terminal windows:
.\scripts\dev-setup.ps1 -RunIf PowerShell blocks scripts in your session, run:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypasscd backendpython -m venv .venvIf needed on Windows:
py -3.11 -m venv .venvPowerShell:
.\.venv\Scripts\Activate.ps1Command Prompt:
.venv\Scripts\activate.batmacOS/Linux:
source .venv/bin/activateYou should now see (.venv) in your terminal prompt.
pip install -r requirements.txtFor PostgreSQL support, also install:
pip install psycopg2-binaryOptional dev/test extras:
pip install -r requirements-dev.txtCreate backend/.env.
The app runs without API keys using built-in fallback behavior, but real providers require keys.
For the current template, start from backend/.env.example.
Example backend/.env:
# App
APP_NAME=Movie Master API
API_PREFIX=/api/v1
DEBUG=false
# Database (SQLite is default, PostgreSQL optional)
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/userDB
USE_POSTGRESQL=false
DATABASE_PATH=./data/ratings.db
# Auth / JWT
JWT_SECRET_KEY=change-this-for-any-non-local-environment
JWT_ACCESS_TOKEN_EXPIRE_MINUTES=60
# Movie providers
TMDB_API_KEY=
OMDB_API_KEY=
# Azure AI Foundry (chat)
AZURE_FOUNDRY_ENDPOINT=
AZURE_FOUNDRY_AGENT_NAME=
AZURE_FOUNDRY_AGENT_VERSION=
AZURE_FOUNDRY_MODEL_DEPLOYMENT=
# Azure Language (summaries)
AZURE_LANGUAGE_ENDPOINT=
AZURE_LANGUAGE_KEY=
# Azure Translator
AZURE_TRANSLATOR_ENDPOINT=
AZURE_TRANSLATOR_KEY=
AZURE_TRANSLATOR_REGION=Notes:
- Database: Set
USE_POSTGRESQL=trueandDATABASE_URLfor PostgreSQL, or leave asfalsefor SQLite AZURE_FOUNDRY_AGENT_VERSIONis optional. Leave it blank to use the latest active prompt-agent version.AZURE_FOUNDRY_MODEL_DEPLOYMENTis used by the manual Foundry publishing flow and by the direct model fallback path.- Ratings, recommendations, and authenticated user CRUD now use bearer JWT auth instead of trusting client-supplied
user_idvalues. - The frontend stores the access token locally and sends it automatically on protected requests.
- Set
JWT_SECRET_KEYexplicitly anywhere beyond local development.
From backend/:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Or use the helper script from backend/scripts/:
./start_backend.shUseful endpoints:
- Health:
http://localhost:8000/health - OpenAPI docs:
http://localhost:8000/docs
If you want the Azure-backed chat, summary, and translation integrations, use the Terraform stack in terraform/.
What Terraform provisions:
- Azure AI Foundry account
- Azure AI Foundry project
- Azure AI Model deployment
- Azure AI Language resource
- Azure AI Translator resource
What Terraform does not provision automatically:
- The Foundry chat agent definition itself
Typical flow:
- Apply Terraform in
terraform/ - Copy the generated backend env block into
backend/.env - Create or update the Foundry prompt agent manually
- Start the backend and frontend
Useful Terraform commands:
cd terraform
terraform output -raw backend_env_file
terraform output -json backend_env_valuesbackend_env_file gives you a ready-to-paste env block for backend/.env.
Terraform does not generate your JWT signing secret. Set JWT_SECRET_KEY separately in backend/.env or your deployment secret store.
After Terraform, you still need a Foundry agent name in:
AZURE_FOUNDRY_AGENT_NAME=movie-master-agentOptional for version pinning:
AZURE_FOUNDRY_AGENT_VERSION=1If you want more detail on the Azure mapping, see terraform/README.md and backend/README.md.
This repo includes a manual helper script for prompt-agent publishing:
cd backend
python scripts/provision_foundry_agent.pyThe script:
- auto-loads
backend/.env - reads
backend/prompts/foundry_agent_instructions.txt - creates or versions the prompt agent in Foundry
- prints the env values you should keep in
backend/.env
In a second terminal, from repo root:
cd frontend
npm install
npm run devOpen:
- App:
http://localhost:5173
The frontend proxies /api/* requests to http://localhost:8000, so keep the backend running.
Account creation and login now persist a short-lived bearer token locally, so backend and frontend should be running from the same current branch when testing ratings, recommendations, or authenticated account actions.
scripts/run-latest.ps1(PowerShell) Recommended. Pulls latest code, updates dependencies, and launches both apps. Windows only.scripts/run-latest.sh(Bash) Recommended. Pulls latest code, updates dependencies, and launches both apps. macOS / Linux.scripts/dev-setup.ps1(PowerShell) Creates the backend virtual environment, installs backend/frontend dependencies, and can optionally launch both apps with-Run. Windows only.backend/scripts/start_backend.sh(Bash) Starts the FastAPI backend with the repo's standard Uvicorn command.backend/scripts/provision_foundry_agent.pyManually creates or versions the Foundry prompt agent after Terraform provisioning.
Backend (from backend/ with venv activated):
pytestBackend (from backend/):
pytest tests/test_full_integration_flow.py -vFrontend (from frontend/):
npm testfor end to end tests
npm test -- tests/e2eWatch mode:
npm run test:watchRun all tests (Windows):
.\scripts\run-e2e-tests.ps1 --allIf activation fails with an execution policy error, run:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassThen activate again:
.\.venv\Scripts\Activate.ps1Use a different port:
uvicorn app.main:app --reload --port 8001If you change backend port, update frontend proxy config in frontend/vite.config.js.
Make sure (.venv) appears in your prompt before running pip install or pytest.
When done:
deactivate