.PHONY: install dev stop sync build prod logs down

install:
	cd backend && python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
	cd frontend && npm install

dev:
	@echo "Backend: http://localhost:8000  Frontend: http://localhost:5173"
	@cd backend && .venv/bin/uvicorn app.main:app --reload --port 8000 &
	@cd frontend && npx vite --port 5173

stop:
	-@pkill -f "uvicorn app.main:app" 2>/dev/null
	-@pkill -f "vite --port 5173" 2>/dev/null
	@echo "gestoppt."

# Katalog holen und fehlende Teaser erzeugen (läuft im Betrieb täglich 4:30)
sync:
	cd backend && .venv/bin/python -m app.sync

build:
	cd frontend && npm run build

# ── Produktion (auf dem Server ausführen, im Projektverzeichnis) ──────────────
prod:
	docker compose up -d --build
	@echo "horror läuft: https://horror.marha.de"

logs:
	docker compose logs -f

down:
	docker compose down
