A full-featured video sharing platform with YouTube-like functionality built with Flask, React, and modern web technologies.
- Email/password registration and login
- Password reset and email verification
- JWT-based sessions
- Role-based access control (user, moderator, admin)
- User profiles with avatars
- Channel pages with banners and descriptions
- Subscribe/unsubscribe functionality
- Resumable/chunked video uploads with progress tracking
- Server-side transcoding to multiple resolutions (1080p, 720p, 480p, 360p)
- Automatic and custom thumbnail generation
- Metadata extraction (duration, resolution, bitrate)
- Local file storage for development
- S3-compatible storage (AWS S3 for production)
- HLS streaming with master playlists
- Signed short-lived URLs for secure access
- Custom HTML5/JS player
- Resolution selector
- Captions/subtitles toggle
- Playback speed control
- Picture-in-Picture support
- Autoplay next video
- Like/dislike functionality
- Threaded comments with replies
- Edit/delete for content owners
- Report system for moderation
- Watch later playlists
- User playlists
- Full-text search on titles, descriptions, and tags
- Trending videos feed
- Recommended videos based on subscriptions
- Subscription feed
- In-app notifications for new uploads and comment replies
- Content moderation
- User management
- Report handling
- Analytics dashboard
- React with TypeScript
- Tailwind CSS for styling
- Responsive design for all device sizes
- Flask with Blueprints
- SQLAlchemy ORM
- Alembic for database migrations
- Flask-JWT-Extended for authentication
- Celery with Redis for background tasks
- Celery workers for video processing
- FFmpeg for transcoding and thumbnail generation
- PostgreSQL (or SQLite for local development)
- Local file system for development
- AWS S3 for production
youtube-clone/
├── backend/ # Flask API server
├── frontend/ # React frontend
├── worker/ # Celery workers for video processing
├── docs/ # Documentation
└── README.md # This file
- Python 3.8+
- Node.js 14+
- PostgreSQL (optional, can use SQLite for development)
- Redis
- FFmpeg
- Git
-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy the example environment file:
cp .env.example .env
-
Update the
.envfile with your local configuration:# For local development with SQLite DATABASE_URL=sqlite:///youtube.db # For PostgreSQL # DATABASE_URL=postgresql://username:password@localhost:5432/youtube_dev
-
Run database migrations:
flask db upgrade
-
Start the backend server:
flask run
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm start
-
Navigate to the worker directory:
cd worker -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the worker:
celery -A worker worker --loglevel=info
The application uses environment variables for configuration. See .env.example for all available options.
For local development without Docker, you'll need to:
- Install PostgreSQL or use SQLite
- Install Redis server
- Install FFmpeg
- Configure the
.envfile appropriately
app.py- Main Flask applicationconfig.py- Configuration settingsrequirements.txt- Python dependenciesapp/- Application modulesauth/- Authentication and user managementvideos/- Video management and processingusers/- User and channel managementadmin/- Admin and moderation featuresmodels.py- Database models
migrations/- Database migrationstests/- Unit and integration testsdocs/- API documentation
package.json- Node.js dependenciessrc/- Source codepublic/- Static assets
worker.py- Celery worker implementationrequirements.txt- Python dependencies
The application uses Alembic for database migrations:
# Generate a new migration
flask db migrate -m "Description of changes"
# Apply migrations
flask db upgradeAPI documentation is available in backend/docs/api.md or by accessing /api/docs when the backend is running.
# Run all tests
pytest
# Run specific test file
pytest tests/test_auth.pyThe project aims for >70% test coverage for critical backend functionality.
See docs/deployment.md for detailed deployment instructions.
- Development: Uses local file storage, SQLite or local PostgreSQL and Redis
- Production: Uses AWS S3 for storage, managed PostgreSQL and Redis
See docs/architecture.md for detailed architecture diagrams and explanations.
- Fork the repository
- Create a feature branch
- Make your changes
- Write tests for new functionality
- Run all tests to ensure nothing is broken
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue on the GitHub repository.