Skip to content

Latest commit

Β 

History

History
172 lines (126 loc) Β· 3.93 KB

File metadata and controls

172 lines (126 loc) Β· 3.93 KB

🎬 YouTube Clone API

A RESTful API backend for a YouTube-like video-sharing platform, built with Laravel and MySQL.


πŸš€ Features

  • User authentication and authorization
  • Video upload, streaming, and management
  • Channel creation and subscription
  • Commenting and liking system
  • Playlist management
  • Search functionality
  • API documentation

πŸ› οΈ Technologies Used

  • Framework: Laravel
  • Language: PHP
  • Database: MySQL
  • Web Server: Nginx
  • Containerization: Docker
  • Package Manager: Composer

πŸ“ Project Structure

β”œβ”€β”€ app/                 # Application core
β”œβ”€β”€ bootstrap/           # Application bootstrap files
β”œβ”€β”€ config/              # Configuration files
β”œβ”€β”€ database/            # Migrations and seeders
β”œβ”€β”€ public/              # Publicly accessible files
β”œβ”€β”€ resources/           # Views and assets
β”œβ”€β”€ routes/              # API and web routes
β”œβ”€β”€ storage/             # Logs and file storage
β”œβ”€β”€ tests/               # Test cases
β”œβ”€β”€ Dockerfile           # Docker configuration
β”œβ”€β”€ .env.example         # Environment variables example
β”œβ”€β”€ composer.json        # PHP dependencies
β”œβ”€β”€ package.json         # JavaScript dependencies
└── README.md            # Project documentation

πŸ“¦ Installation

  1. Clone the repository:

    git clone https://github.com/AHMED1CB/youtube-clone-api.git
    cd youtube-clone-api
  2. Copy the example environment file and configure it:

    cp .env.example .env
  3. Install PHP dependencies:

    composer install
  4. Generate application key:

    php artisan key:generate
  5. Run database migrations:

    php artisan migrate
  6. Start the development server:

    php artisan serve

🐳 Docker Setup

  1. Build and run the Docker containers:

    docker-compose up -d --build
  2. Access the application: The API will be available at http://localhost:8000.


πŸ”Œ API Endpoints

πŸ” Authentication:

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Authenticate a user
  • POST /api/auth/logout - Logout the authenticated user
  • POST /api/auth - Get Profile Details

πŸ“Ή Videos And Shorts:

  • POST /api/videos - Retrieve all videos
  • POST /api/videos/upload - Upload a new video
  • POST /api/videos/{slug} - Retrieve a specific video
  • POST /api/videos/{id}/delete - Delete a video
  • POST /api/videos/{id}/comment - Comment on Video
  • POST /api/videos/{id}/savedata - Add View To Video And Save To User History
  • POST /api/videos/{id}/react - React on Video

πŸ“Ί Channels:

  • POST /api/channels/{channel}/subscribe - Subscribe Channel
  • POST /api/channels/{username} - get Channel Data

πŸ’¬ Comments:

  • POST /api/comments/ - get All user Comments
  • POST /api/comments/{comment}/update - Update Comment
  • POST /api/comments/{comment}/delete - Delete a comment

πŸ’¬ History:

  • POST /api/ - get All History Videos Of User
  • POST /api/history/changestate - Pause or Start Saving History Videos
  • POST /api/history/clear - Clear History of user

πŸ—„οΈ Database Configuration

Ensure your .env file is configured with the correct database settings:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password

πŸ§ͺ Running Tests

Execute the test suite using PHPUnit:

php artisan test

πŸ“„ License

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


🀝 Contributing

Contributions are welcome! Please fork the repository and submit a pull request.


πŸ“« Contact

For support or inquiries, open an issue on GitHub.