Skip to content

ebilebilli/Movie-Website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

118 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Movie Website - Django REST API

A comprehensive Django-based movie streaming platform featuring AI-powered chat recommendations, secure JWT authentication with Google OAuth integration, social features including threaded comments and bookmarks, Docker containerization, PostgreSQL database with Redis caching, and Celery background task processing for scalable performance.

πŸ›  Technology Stack

🎯 Backend

Django DRF Python

πŸ—„ Database & Cache

PostgreSQL Redis

πŸ” Authentication & Security

JWT Google OAuth

πŸ€– AI & External Services

OpenAI Celery

🐳 DevOps & Deployment

Docker Docker Compose Gunicorn

πŸ“¦ Development Tools

Pipenv DRF YASG

πŸ— Architecture

Frontend Client ←→ Django API ←→ Background Tasks (Celery)
                      ↓
                PostgreSQL Database
                      ↓
                Redis (Cache/MQ)

πŸ“ Project Structure

movie_website/
β”œβ”€β”€ apis/                    # API endpoints
β”‚   β”œβ”€β”€ chat_ai_apis/       # AI chat
β”‚   β”œβ”€β”€ interaction_apis/    # Social features
β”‚   β”œβ”€β”€ movie_apis/         # Movie management
β”‚   β”œβ”€β”€ relation_apis/      # Actor/Category/Director
β”‚   └── user_apis/          # Authentication
β”œβ”€β”€ chat_ai/                # AI functionality
β”œβ”€β”€ interactions/           # Social features
β”œβ”€β”€ movies/                # Movie management
β”œβ”€β”€ relations/             # Related entities
β”œβ”€β”€ users/                 # User management
└── utils/                 # Utilities

πŸš€ Quick Start

Docker Setup

# Clone and setup
git clone <repository-url>
cd movie-website

# Create .env file with required variables
cp .env.example .env

# Start services
docker-compose up -d

# Run migrations
docker-compose exec web python manage.py migrate

# Create superuser
docker-compose exec web python manage.py createsuperuser

Local Setup

cd movie_website
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

πŸ”§ Environment Variables

# Django
SECRET_KEY=your-secret-key
DEBUG=True

# Database
POSTGRES_DB=movie_db
POSTGRES_USER=movie_user
POSTGRES_PASSWORD=your-password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0

# Celery
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0

# JWT
ACCESS_TOKEN_LIFETIME_MINUTES=60
REFRESH_TOKEN_LIFETIME_DAYS=7
JWT_ALGORITHM=HS256

# External Services
GOOGLE_OAUTH_CLIENT_ID=your-google-client-id
OPENAI_TOKEN=your-openai-api-key

πŸ“š API Endpoints

Authentication

POST /api/v1/auth/register/ # User registration POST /api/v1/auth/login/ # User login POST /api/v1/auth/logout/ # User logout POST /api/v1/auth/google/ # Google OAuth GET /api/v1/auth/google/client-id/ # Get Google client ID


### Movies

GET /api/v1/movies/             # List all movies
GET /api/v1/movies/{slug}/      # Movie details
GET /api/v1/search/             # Search movies

Social Features

POST /api/v1/comments/ # Create comment GET /api/v1/comments/ # List comments POST /api/v1/likes/ # Like comment DELETE /api/v1/likes/{id}/ # Unlike comment POST /api/v1/bookmarks/ # Add bookmark DELETE /api/v1/bookmarks/{id}/ # Remove bookmark


### Relations (Actors, Directors, Categories)

GET /api/v1/actors/             # List actors
GET /api/v1/actors/{id}/        # Actor details
GET /api/v1/directors/          # List directors
GET /api/v1/directors/{id}/     # Director details
GET /api/v1/categories/         # List categories
GET /api/v1/categories/{id}/    # Category details

AI Chat

POST /api/v1/chat/request/ # Start AI chat GET /api/v1/chat/response/{task_id}/ # Get AI response


### User Profile

GET /api/v1/users/profile/      # User profile
PUT /api/v1/users/profile/      # Update profile

πŸ—„ Database Models

Core Models

  • Movie: title, description, duration, rating, poster, video, trailer_url, slug
  • CustomerUser: email, username, birthday, bio, profile_image
  • Comment: user, movie, parent, text, like_count
  • Like: user, comment (unique constraint)
  • Bookmark: user, movie (unique constraint)

Relation Models

  • Actor: name, biography, birth_date, photo
  • Director: name, biography, birth_date, photo
  • Category: name, description
  • ReleaseDate: date, country

πŸ” Authentication

  • JWT Tokens: Access (60min) + Refresh (7 days)
  • Google OAuth: Social login integration
  • Token Blacklist: Secure logout
  • Age Validation: Minimum 13 years old

πŸ€– AI Features

  • Async Processing: Celery background tasks
  • OpenAI Integration: GPT-3.5-turbo for responses
  • Movie Search: Searches database for relevant movies
  • Context Awareness: Knows about available movies

🐳 Docker Services

services:
  web:          # Django app (Gunicorn)
  celery:       # Background tasks
  db:           # PostgreSQL database
  redis:        # Cache & message broker

πŸ’» Development

# Run tests
python manage.py test

# Create migrations
python manage.py makemigrations

# Apply migrations
python manage.py migrate

# Start Celery worker
celery -A movie_website worker --loglevel=info

πŸ“„ License

MIT License


Built with Django REST Framework


About

A comprehensive Django-based movie streaming platform featuring AI-powered chat recommendations, secure JWT authentication with Google OAuth integration, social features including threaded comments and bookmarks, Docker containerization, PostgreSQL database with Redis caching, and Celery background task processing for scalable performance.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages