Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTube

A YouTube clone built with FastAPI and React. Videos are transcoded to HLS adaptive bitrate streams, stored in Cloudflare R2, and streamed directly to the client.

Features

  • User registration and JWT-based authentication
  • Video upload with real-time processing progress
  • HLS adaptive bitrate streaming (hls.js with native Safari fallback)
  • Likes and comments with per-video moderation
  • View count tracking

Tech Stack

Layer Technology
Backend FastAPI + Uvicorn
ORM SQLModel (SQLAlchemy + Pydantic)
Database PostgreSQL via Supabase
Auth JWT (python-jose) + bcrypt
Video processing python-ffmpeg-video-streaming + FFmpeg
Storage Cloudflare R2 (boto3 S3-compatible)
Migrations Alembic
Frontend React + TypeScript + Vite
Styling Tailwind CSS

Project Structure

PyTube/
├── backend/
│   ├── app/
│   │   ├── api/
│   │   │   ├── deps.py          # Dependency injection (auth, session)
│   │   │   └── endpoints/       # auth, users, videos, upload, stream, likes, comments
│   │   ├── models/              # SQLModel DB models
│   │   ├── schemas/             # Pydantic request/response schemas
│   │   ├── services/            # auth, storage, video processing
│   │   └── tests/
│   └── alembic/                 # DB migrations
└── frontend/
    └── src/
        ├── api/                 # Axios API clients
        ├── components/          # Shared UI components
        ├── context/             # Auth context
        ├── pages/               # Route-level page components
        ├── types/               # TypeScript interfaces
        └── utils/               # Shared utilities

Running Locally

Backend — from backend/:

.venv/bin/uvicorn app.main:app --reload

Runs on http://localhost:8000. API docs at http://localhost:8000/docs.

Frontend — from frontend/:

npm run dev

Runs on http://localhost:5173.

Environment Variables

Copy the example files and fill in your values:

cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env

Running Tests

From backend/:

.venv/bin/pytest app/tests/

About

A YouTube clone built with FastAPI and React

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages