Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Film Mania 🎬

An open-source subscription-based movie streaming platform designed to serve a diverse audience with multi-language content support and AI-powered subtitle translation.

🌟 Overview

Film Mania is a modern, production-ready streaming platform that enables users to watch films from various languages including Tamil, Malayalam, Hindi, English, Korean, Japanese, and Anime. The platform features AI-powered English-to-Sinhala subtitle translation, making content accessible to a broader audience.

Key Features

  • πŸŽ₯ Multi-Language Content: Support for Tamil, Malayalam, Hindi, English, Korean, Japanese, and Anime
  • πŸ€– AI Subtitle Translation: Automatic English-to-Sinhala subtitle conversion using AI models
  • πŸ’³ Subscription Management: Flexible monthly/yearly subscription plans via Stripe
  • πŸ” Secure Authentication: JWT-based authentication with refresh tokens
  • πŸ“Š Admin Dashboard: Admin tools for funding user subscriptions and managing API credits
  • 🎯 Content Discovery: Advanced search, filtering, and categorization
  • 🌐 Self-Hosted: Full Docker Compose setup for easy deployment
  • πŸ“± Responsive Design: Modern UI built with Next.js and React

πŸ—οΈ Architecture

Tech Stack

Frontend:

  • Next.js 14+ (App Router)
  • React 18+
  • TypeScript
  • Tailwind CSS (optional)

Backend:

  • Node.js 18+
  • Express.js
  • TypeScript
  • PostgreSQL with Sequelize ORM
  • JWT Authentication
  • Stripe Integration

Infrastructure:

  • Docker & Docker Compose
  • Nginx Reverse Proxy
  • PostgreSQL Database
  • NX Monorepo

External Services:

  • Stripe (Payment Processing)
  • TMDB (Movie Metadata)
  • VidAPI/StreamAPI (Streaming Links)
  • AI Model (Subtitle Translation)

πŸ“ Project Structure

film-mania/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ api/                    # Backend API (Express/TypeScript)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ config/        # Configuration (app.config.ts, database.ts)
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers/    # API controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ middleware/    # Auth, validation, error handling
β”‚   β”‚   β”‚   β”œβ”€β”€ models/        # Sequelize database models
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/        # API routes (auth, movies, subscriptions, etc.)
β”‚   β”‚   β”‚   β”œβ”€β”€ services/      # Business logic (auth, stripe, movie)
β”‚   β”‚   β”‚   └── main.ts        # Application entry point
β”‚   β”‚   └── Dockerfile
β”‚   β”‚
β”‚   └── web/                    # Frontend (Next.js/React)
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ app/           # Next.js App Router pages
β”‚       β”‚   β”œβ”€β”€ components/    # React components
β”‚       β”‚   └── lib/           # Utilities and API client
β”‚       └── Dockerfile
β”‚
β”œβ”€β”€ libs/
β”‚   └── shared/                 # Shared TypeScript types and interfaces
β”‚       └── src/
β”‚           β”œβ”€β”€ interfaces/    # TypeScript interfaces (IMovie, etc.)
β”‚           β”œβ”€β”€ dtos/          # Data Transfer Objects
β”‚           └── enums/         # Enumerations
β”‚
β”œβ”€β”€ database/
β”‚   └── schema.sql             # PostgreSQL database schema
β”‚
β”œβ”€β”€ docker/
β”‚   └── nginx/                 # Nginx configuration
β”‚       └── nginx.conf
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ requirements.md        # Detailed requirements document
β”‚   └── technical-feasibility.md # Technical architecture document
β”‚
β”œβ”€β”€ scripts/                   # Deployment and utility scripts
β”‚   β”œβ”€β”€ deploy.sh
β”‚   β”œβ”€β”€ setup-vps.sh
β”‚   └── ...
β”‚
β”œβ”€β”€ docker-compose.yml        # Docker Compose configuration
β”œβ”€β”€ nx.json                   # NX configuration
└── package.json              # Root package.json

πŸš€ Quick Start

Prerequisites

  • Node.js 18.x or higher
  • Yarn 4.x (via Corepack)
  • Docker and Docker Compose
  • PostgreSQL 14+ (or use Docker)
  • Git

Local Development Setup

  1. Clone the repository

    git clone <your-repo-url>
    cd film-mania
  2. Enable Corepack and install dependencies

    corepack enable
    yarn install
  3. Set up environment variables

    Create apps/api/.env:

    NODE_ENV=development
    PORT=3000
    
    # Database
    DB_HOST=localhost
    DB_PORT=5432
    DB_NAME=film_mania
    DB_USERNAME=postgres
    DB_PASSWORD=postgres
    
    # JWT
    JWT_SECRET=your-secret-key-change-in-production
    JWT_REFRESH_SECRET=your-refresh-secret-key-change-in-production
    JWT_EXPIRY=24h
    JWT_REFRESH_EXPIRY=7d
    
    # Stripe
    STRIPE_SECRET_KEY=sk_test_...
    STRIPE_WEBHOOK_SECRET=whsec_...
    
    # TMDB
    TMDB_API_KEY=your-tmdb-api-key
    
    # CORS
    CORS_ORIGIN=http://localhost:3001,http://localhost:3000

    Create apps/web/.env.local:

    NEXT_PUBLIC_API_URL=http://localhost:3000
  4. Set up the database

    # Start PostgreSQL with Docker
    docker-compose up -d postgres
    
    # Or use your existing PostgreSQL instance
    # Then run the schema
    psql -U postgres -d film_mania -f database/schema.sql
  5. Start the development servers

    In one terminal, start the API:

    yarn api:dev

    API will run on http://localhost:3000

    In another terminal, start the web app:

    yarn web:dev

    Web app will run on http://localhost:3001

  6. Access the application

🐳 Docker Deployment

Quick Start with Docker Compose

# Build and start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop all services
docker-compose down

The application will be available at:

πŸ“š API Documentation

Authentication Endpoints

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login user
  • POST /api/auth/refresh - Refresh access token
  • GET /api/auth/me - Get current user info

Movie Endpoints

  • GET /api/movies - Get movies list (with filters)
  • GET /api/movies/:id - Get movie details
  • GET /api/movies/categories/list - Get available categories
  • GET /api/movies/category/:category - Get movies by category
  • GET /api/movies/search/:query - Search movies

Subscription Endpoints

  • GET /api/subscriptions/current - Get current subscription
  • POST /api/subscriptions/create - Create subscription
  • POST /api/subscriptions/cancel - Cancel subscription

Admin Endpoints

  • POST /api/admin/fund-subscription - Fund user subscription (3 months)
  • GET /api/admin/api-credits - Get API credits
  • POST /api/admin/api-credits - Add API credits
  • GET /api/admin/funding/stats - Get funding statistics

πŸ”§ Configuration

Environment Variables

See apps/api/env.example for all available environment variables.

Database Schema

The database schema includes:

  • Users and authentication
  • Subscriptions and payments
  • Movies and categories
  • Subtitles
  • API credits and usage tracking
  • Admin funding records

See database/schema.sql for the complete schema.

🎯 Features Roadmap

  • User authentication and authorization
  • Subscription management with Stripe
  • Movie catalog with multi-language support
  • Admin dashboard for funding subscriptions
  • API credit tracking
  • AI subtitle translation (English to Sinhala)
  • Video player with subtitle support
  • User watchlist and favorites
  • Movie recommendations
  • Advanced search filters
  • Mobile app (React Native)
  • Social features (reviews, ratings)

πŸ›‘οΈ Security Features

  • βœ… JWT-based authentication with refresh tokens
  • βœ… Password hashing with bcrypt
  • βœ… Helmet.js for security headers
  • βœ… CORS configuration
  • βœ… Input validation and sanitization
  • βœ… Rate limiting (via Nginx)
  • βœ… SQL injection prevention (Sequelize ORM)
  • βœ… Environment variable management

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Ensure all tests pass and linting is clean
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write meaningful commit messages
  • Update documentation for new features
  • Add tests for new functionality
  • Ensure code passes ESLint checks

πŸ“ License

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

πŸ™ Acknowledgments

  • TMDB for movie metadata API
  • Stripe for payment processing
  • The open-source community for amazing tools and libraries

πŸ“§ Support

For issues, questions, or contributions:

🌍 Live Demo

Coming soon! The application will be deployed and available for public access.


Built with ❀️ using NX Monorepo, TypeScript, and modern web technologies

About

🎬 Open-source subscription-based movie streaming platform with multi-language support, AI-powered subtitle translation, and Stripe integration. Built with Next.js, Node.js, PostgreSQL, and Docker.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages