2025-10-18 09:14:10 -04:00
# Plex Playlist Project
A full-stack application for managing Plex playlists with a FastAPI backend and Vue.js frontend.
## Architecture
2026-06-18 11:19:24 -04:00
- **Backend**: Python 3.14 + FastAPI + uv + ruff
2025-10-18 09:14:10 -04:00
- **Frontend**: TypeScript + Vue.js + Vite
- **Database**: PostgreSQL 16
- **Containerization**: Docker + Docker Compose
2026-06-19 10:27:24 -04:00
## Deployable Runtime Contract
Deployable image requirements are defined in:
- [docs/DEPLOYABLE_RUNTIME_CONTRACT.md ](docs/DEPLOYABLE_RUNTIME_CONTRACT.md )
- [docs/adr/ADR003-deployable_runtime_image_contract.md ](docs/adr/ADR003-deployable_runtime_image_contract.md )
These documents define backend/frontend runtime boundaries, startup and health
behavior expectations, environment contracts, and disallowed non-runtime
tooling classes in deployable artifacts.
2025-10-18 09:14:10 -04:00
## Development Setup
### Prerequisites
- Docker and Docker Compose
- Git
2025-10-18 21:29:28 -04:00
- pre-commit (for development)
### Code Quality Tools
This project uses comprehensive linting and formatting:
**Backend (Python):**
2026-06-19 10:27:24 -04:00
2025-10-18 21:29:28 -04:00
- `ruff` - Fast Python linter and formatter
- `pyright` - Type checking
2026-06-18 11:19:24 -04:00
- `pydoclint` - Docstring linting (Google style)
2025-10-18 21:29:28 -04:00
**Frontend (TypeScript/Vue):**
2026-06-19 10:27:24 -04:00
2025-10-18 21:29:28 -04:00
- `eslint` - Linting with Vue and TypeScript support
- `prettier` - Code formatting
- `vue-tsc` - Vue TypeScript checking
- `eslint-plugin-tsdoc` - TSDoc documentation linting
2025-10-31 13:25:03 -04:00
**Task Runner:**
2026-06-19 10:27:24 -04:00
2025-10-31 13:25:03 -04:00
- `poethepoet` - Unified task runner for development workflows
2025-10-18 21:29:28 -04:00
**General:**
2026-06-19 10:27:24 -04:00
2025-10-18 21:29:28 -04:00
- `pre-commit` - Git hooks for automated quality checks
- TOML formatting and validation
2025-10-31 13:25:03 -04:00
### Unified Development with Poe
This project uses **Poe the Poet ** for streamlined development:
```bash
# Complete setup (installs deps, starts dev environment)
poe setup
# Code quality (format, lint, type-check all code)
poe ci-quick
# Run all tests
poe test-all
# See all available tasks
poe --help
```
### Manual Setup (Alternative)
2025-10-18 21:29:28 -04:00
```bash
pip install pre-commit
pre-commit install
```
2025-10-18 09:14:10 -04:00
2025-10-31 13:25:03 -04:00
### Quick Start
2025-10-18 09:14:10 -04:00
2026-06-19 10:27:24 -04:00
Clone the repository, then choose one of these startup paths.
#### Unified Development
```bash
# Complete setup and start development environment
poe setup
# Or manually:
cd backend
pip install -e .
poe dev-env-start
```
#### Traditional Setup
```bash
# Backend development
cd backend
pip install -e .
# Frontend development
cd frontend
npm install
npm run dev
```
#### Docker Development
```bash
# Using Poe (recommended)
poe docker-dev-up
# Or directly
docker compose -f compose.dev.yml up --build
```
#### Production Build
```bash
poe docker-prod-up
# Or: docker compose up --build
```
2025-10-18 09:14:10 -04:00
### Running in Production Mode
```bash
docker compose up --build -d
```
This will start:
2026-06-19 10:27:24 -04:00
2025-10-18 09:14:10 -04:00
- PostgreSQL database on port 5432
- FastAPI backend on port 8000
- Vue.js frontend on port 80
## Project Structure
2026-06-19 10:27:24 -04:00
```text
2025-10-18 09:14:10 -04:00
plex-playlist/
├── backend/ # FastAPI backend
├── frontend/ # Vue.js frontend
│ └── nginx.conf # Nginx configuration
├── Dockerfile.backend # Backend Docker image
├── Dockerfile.frontend # Frontend Docker image
├── compose.yml # Production Docker Compose
├── compose.dev.yml # Development Docker Compose override
└── README.md
```
2026-06-18 11:19:24 -04:00
## CI Operations
For Gitea Actions runner image mirror maintenance, use:
- `source scripts/gitea-actions/repair_runner_mirror.xsh`
- `source scripts/gitea-actions/check_runner_images.xsh`
- `source scripts/gitea-actions/collect_runner_diagnostics.xsh [since] [trace_id]`
For full troubleshooting context, see `docs/GITEA_ACTIONS_TROUBLESHOOTING.md` .
2025-10-18 09:14:10 -04:00
## Environment Variables
### Backend
2026-06-19 10:27:24 -04:00
2025-10-18 09:14:10 -04:00
- `DATABASE_URL` : PostgreSQL connection string
2026-06-19 10:27:24 -04:00
- `BACKEND_REQUIRED_PYTHON` : Runtime policy baseline (`3.14` default)
2025-10-18 09:14:10 -04:00
- `ENVIRONMENT` : `development` or `production`
- `RELOAD` : Enable uvicorn auto-reload (development only)
### Frontend
2026-06-19 10:27:24 -04:00
- No required runtime environment variables for production nginx serving
2025-10-18 09:14:10 -04:00
## Database
The PostgreSQL database is configured with:
2026-06-19 10:27:24 -04:00
2025-10-18 09:14:10 -04:00
- Database: `plex_playlist`
- User: `plex_user`
- Password: `plex_password`
## Development Workflow
1. Make changes to your code
2. The development containers will automatically reload:
- Backend: uvicorn with `--reload` flag
- Frontend: Vite dev server with hot module replacement
## API Documentation
When running, the FastAPI automatic documentation is available at:
2026-06-19 10:27:24 -04:00
- Development: <http://localhost:8001/docs>
- Production: <http://localhost:8000/docs>
2025-10-18 09:14:10 -04:00
---
2026-06-19 10:27:24 -04:00
## Manual Setup (if not using Docker)
2025-10-18 09:14:10 -04:00
2026-06-18 11:19:24 -04:00
## Backend Setup (FastAPI, Python 3.14, uv, ruff, pyright)
2025-10-18 09:14:10 -04:00
### 1. Create and activate the uv virtual environment
```sh
2026-06-18 11:19:24 -04:00
cd backend
uv venv .venv
source .venv/bin/activate
2025-10-18 09:14:10 -04:00
```
### 2. Install dependencies
```sh
2026-06-18 11:19:24 -04:00
uv sync --all-groups
2025-10-18 09:14:10 -04:00
```
### 3. Install dev tools
```sh
2026-06-18 11:19:24 -04:00
uv run poe format
uv run poe lint
uv run poe test
2025-10-18 09:14:10 -04:00
```
### 4. Project structure
2026-06-18 11:19:24 -04:00
- `src/backend/` - FastAPI application code
2025-10-18 09:14:10 -04:00
- `tests/` - Test suite
- `pyrightconfig.json` - Pyright type checking config
2026-06-18 11:19:24 -04:00
- `pyproject.toml` - Ruff, pytest, and task configuration
2025-10-18 09:14:10 -04:00
### 5. Run the development server
```sh
2026-06-18 11:19:24 -04:00
uv run uvicorn backend.main:app --reload --app-dir src
2025-10-18 09:14:10 -04:00
```
---
## Frontend Setup (Vue 3, Vite, TypeScript)
### 1. Create the project
```sh
cd frontend
npm create vite@latest . -- --template vue-ts
npm install
```
### 2. Recommended: Enable strictest TypeScript settings
Edit `tsconfig.json` and set:
2026-06-19 10:27:24 -04:00
2025-10-18 09:14:10 -04:00
```json
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}
}
```
## 3. Run the frontend
```sh
npm run dev
```
---
2025-10-25 17:45:17 -04:00
## Documentation
2025-10-30 16:21:02 -04:00
### Development & Workflow
2026-06-19 10:27:24 -04:00
2025-10-30 16:21:02 -04:00
- **[Development Environment Setup ](docs/DEVELOPMENT.md )** - Comprehensive guide for setting up your development environment, git workflow, pre-commit hooks, manual tool usage, and CI/CD pipeline understanding
2025-10-31 13:25:03 -04:00
- **[Poe Task Reference ](docs/POE_TASK_REFERENCE.md )** - Complete guide to unified development tasks and workflows using Poe the Poet
2026-06-19 10:27:24 -04:00
- **[Deployable Runtime Contract ](docs/DEPLOYABLE_RUNTIME_CONTRACT.md )** - Canonical backend/frontend deployable runtime image requirements and exclusions
- **[ADR003: Deployable Runtime Image Contract Boundaries ](docs/adr/ADR003-deployable_runtime_image_contract.md )** - Architectural decision that locks deployable image boundary policy
2025-10-31 13:25:03 -04:00
### Architecture & CI/CD
2025-11-01 13:03:18 -04:00
- **[CI/CD Multi-stage Build ](docs/CICD_MULTI_STAGE_BUILD.md )** - Docker multi-stage build strategy, architecture decisions, and performance optimizations
- **[CI/CD Troubleshooting Guide ](docs/CICD_TROUBLESHOOTING_GUIDE.md )** - Comprehensive troubleshooting, optimization decisions, and performance monitoring for Docker builds and E2E testing
2025-11-04 12:40:53 -05:00
- **[CI/CD Success Summary ](docs/CICD_SUCCESS_SUMMARY.md )** - Complete validation results and performance metrics for the optimized pipeline
### Dependency Management & Automation
- **[Renovate Bot Setup ](docs/RENOVATE_SETUP_GUIDE.md )** - Automated dependency updates with Renovate for Python, Node.js, and Docker dependencies
2025-10-30 16:21:02 -04:00
### Operations & Troubleshooting
2025-10-31 13:25:03 -04:00
2025-10-25 17:45:17 -04:00
- **[Gitea Actions Troubleshooting ](docs/GITEA_ACTIONS_TROUBLESHOOTING.md )** - Solutions for CI/CD pipeline issues, including the critical "jobs waiting forever" problem
2025-10-30 16:21:02 -04:00
- **[Secure Docker CI/CD ](docs/SECURE_DOCKER_CICD.md )** - Security considerations and setup for Docker-based CI/CD pipelines
2025-10-25 16:54:38 -04:00
2025-10-25 17:45:17 -04:00
See the `backend/` and `frontend/` folders for more details.