.PHONY: help install dev-services dev-stop-services dev-backend dev-frontend dev build test lint clean up down restart logs celery-worker celery-beat celery-flower celery-shell help: ## Show this help message @echo "Available commands:" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' install: ## Install dependencies @echo "Installing backend dependencies..." cd backend && python -m venv venv . backend/venv/bin/activate && pip install -r backend/requirements/dev.txt @echo "Installing frontend dependencies..." cd frontend && npm install dev-services: ## Start development services (postgres & redis only) @echo "Starting development services (postgres & redis)..." docker compose -f docker-compose.dev.yml up -d dev-stop-services: ## Stop development services @echo "Stopping development services..." docker compose -f docker-compose.dev.yml down dev-backend: ## Start backend server locally @echo "Starting backend server..." cd backend && . venv/bin/activate && flask run dev-frontend: ## Start frontend server locally @echo "Starting frontend server..." cd frontend && npm run dev dev: ## Start development environment @echo "Starting development environment..." docker-compose -f docker-compose.dev.yml up -d @echo "In one terminal run: make dev-backend" @echo "In another terminal run: make dev-frontend" build: ## Build Docker images @echo "Building Docker images..." docker compose build up: ## Start all services @echo "Starting all services..." docker compose up -d down: ## Stop all services @echo "Stopping all services..." docker compose down restart: ## Restart all services @echo "Restarting all services..." docker compose restart logs: ## Show logs from all services docker compose logs -f logs-backend: ## Show backend logs docker compose logs -f backend logs-frontend: ## Show frontend logs docker compose logs -f frontend test: ## Run all tests @echo "Running backend tests..." cd backend && . venv/bin/activate && pytest @echo "Running frontend tests..." cd frontend && npm test test-backend: ## Run backend tests only cd backend && . venv/bin/activate && pytest test-backend-cov: ## Run backend tests with coverage cd backend && . venv/bin/activate && pytest --cov=app --cov-report=html --cov-report=term test-backend-verbose: ## Run backend tests with verbose output cd backend && . venv/bin/activate && pytest -v test-backend-unit: ## Run backend unit tests only cd backend && . venv/bin/activate && pytest -m unit test-backend-integration: ## Run backend integration tests only cd backend && . venv/bin/activate && pytest -m integration test-backend-auth: ## Run backend authentication tests only cd backend && . venv/bin/activate && pytest -m auth test-backend-product: ## Run backend product tests only cd backend && . venv/bin/activate && pytest -m product test-backend-order: ## Run backend order tests only cd backend && . venv/bin/activate && pytest -m order test-backend-watch: ## Run backend tests in watch mode (auto-rerun on changes) cd backend && . venv/bin/activate && pip install pytest-watch && pytest-watch test-backend-parallel: ## Run backend tests in parallel (faster) cd backend && . venv/bin/activate && pip install pytest-xdist && pytest -n auto test-backend-coverage-report: ## Open backend coverage report in browser cd backend && . venv/bin/activate && pytest --cov=app --cov-report=html && python -m webbrowser htmlcov/index.html test-backend-failed: ## Re-run only failed backend tests cd backend && . venv/bin/activate && pytest --lf test-backend-last-failed: ## Run the tests that failed in the last run cd backend && . venv/bin/activate && pytest --lf test-backend-specific: ## Run specific backend test (usage: make test-backend-specific TEST=test_models.py) cd backend && . venv/bin/activate && pytest tests/$(TEST) test-backend-marker: ## Run backend tests by marker (usage: make test-backend-marker MARKER=auth) cd backend && . venv/bin/activate && pytest -m $(MARKER) test-frontend: ## Run frontend tests only cd frontend && npm test lint: ## Run linting @echo "Linting backend..." cd backend && . venv/bin/activate && flake8 app tests @echo "Linting frontend..." cd frontend && npm run lint lint-backend: ## Lint backend only cd backend && . venv/bin/activate && flake8 app tests lint-frontend: ## Lint frontend only cd frontend && npm run lint format: ## Format code @echo "Formatting backend..." cd backend && . venv/bin/activate && black app tests && isort app tests @echo "Formatting frontend..." cd frontend && npx prettier --write "src/**/*.{js,jsx,ts,tsx,css}" migrate: ## Run database migrations cd backend && . venv/bin/activate && flask db upgrade shell: ## Open Flask shell cd backend && . venv/bin/activate && flask shell clean: ## Clean up build artifacts @echo "Cleaning up..." cd backend && rm -rf __pycache__ *.pyc .pytest_cache cd frontend && rm -rf dist node_modules/.cache prune: ## Remove unused Docker resources docker system prune -a backup: ## Backup database docker exec crafting-shop-postgres pg_dump -U crafting crafting_shop > backup.sql restore: ## Restore database (usage: make restore FILE=backup.sql) docker exec -i crafting-shop-postgres psql -U crafting crafting_shop < $(FILE) # Celery Commands celery-worker: ## Start Celery worker locally @echo "Starting Celery worker..." cd backend && . venv/bin/activate && celery -A celery_worker worker --loglevel=info --concurrency=4 celery-beat: ## Start Celery Beat scheduler locally @echo "Starting Celery Beat scheduler..." cd backend && . venv/bin/activate && celery -A celery_worker beat --loglevel=info celery-flower: ## Start Flower monitoring locally @echo "Starting Flower monitoring..." cd backend && . venv/bin/activate && celery -A celery_worker flower --port=5555 celery-shell: ## Open Celery shell for task inspection @echo "Opening Celery shell..." cd backend && . venv/bin/activate && celery -A celery_worker shell logs-celery: ## Show Celery worker logs docker compose logs -f celery_worker logs-celery-beat: ## Show Celery Beat logs docker compose logs -f celery_beat logs-flower: ## Show Flower logs docker compose logs -f flower