myYouTube/README.md
vrubelroman 0ed20bb838 Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
  pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching

40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00

89 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MyYouTube
Персональный YouTube-клиент с категориями подписок и интеграцией с существующим MeTube.
Полное техническое задание: [`youtube_categories_metube_TZ.md`](./youtube_categories_metube_TZ.md).
Текущий статус: **Phase 1 — skeleton** (FastAPI backend, PostgreSQL, Alembic, React frontend, Docker Compose, healthcheck).
## Стек
- Backend: Python 3.13, FastAPI, SQLAlchemy 2.x, Alembic, Pydantic Settings
- Frontend: React, TypeScript, Vite, React Router, TanStack Query
- DB: PostgreSQL 16
- Deployment: Docker Compose
## Запуск в production (Docker Compose)
1. Скопируй `.env.example` в `.env` и заполни значения (Google OAuth credentials, секреты, MeTube URLs).
2. Собери и запусти:
```bash
docker compose up -d --build
```
3. Проверь health:
```bash
curl http://localhost:8080/api/health
```
Миграции Alembic применяются автоматически при старте контейнера `app` (см. `entrypoint.sh`).
## Локальная разработка
### Backend
```bash
cd backend
uv venv .venv
uv pip install -p .venv -r requirements-dev.txt
source .venv/bin/activate
cd ..
DATABASE_URL=postgresql+psycopg://youtube_app:password@localhost:5432/youtube_app \
APP_SECRET_KEY=dev APP_SECRET_KEY=dev TOKEN_ENCRYPTION_KEY=dev \
alembic upgrade head
uvicorn app.main:app --reload --app-dir backend --port 8080
```
Тесты:
```bash
backend/.venv/bin/python -m pytest tests/ -v
```
### Frontend
```bash
cd frontend
npm install
npm run dev
```
Dev-сервер Vite проксирует `/api/*` на `http://127.0.0.1:8080` (см. `vite.config.ts`).
## Миграции
```bash
alembic revision -m "описание"
alembic upgrade head
```
`alembic.ini` и папка `migrations/` находятся в корне проекта и подключают модели из `backend/app`.
## Структура проекта
```text
myyoutube/
├── backend/ # FastAPI приложение
├── frontend/ # React SPA
├── migrations/ # Alembic migrations
├── tests/ # backend tests (pytest)
├── Dockerfile
├── compose.yml
├── .env / .env.example
└── youtube_categories_metube_TZ.md
```
## Секреты
`.env` в `.gitignore`, не коммитится. Обязательные секреты: `APP_SECRET_KEY`, `TOKEN_ENCRYPTION_KEY`, `GOOGLE_CLIENT_SECRET`, `POSTGRES_PASSWORD`.