A community based topic aggregation platform built on atproto
1.PHONY: help dev-up dev-down dev-logs dev-status dev-reset dev-db-up dev-db-down dev-db-reset test clean 2 3# Default target - show help 4.DEFAULT_GOAL := help 5 6# Colors for output 7CYAN := \033[36m 8RESET := \033[0m 9GREEN := \033[32m 10YELLOW := \033[33m 11 12##@ General 13 14help: ## Show this help message 15 @echo "" 16 @echo "$(CYAN)Coves Development Commands$(RESET)" 17 @echo "" 18 @awk 'BEGIN {FS = ":.*##"; printf "Usage: make $(CYAN)<target>$(RESET)\n"} \ 19 /^[a-zA-Z_-]+:.*?##/ { printf " $(CYAN)%-15s$(RESET) %s\n", $$1, $$2 } \ 20 /^##@/ { printf "\n$(YELLOW)%s$(RESET)\n", substr($$0, 5) }' $(MAKEFILE_LIST) 21 @echo "" 22 23##@ Local Development (atProto Stack) 24 25dev-up: ## Start PDS for local development 26 @echo "$(GREEN)Starting Coves development stack...$(RESET)" 27 @echo "$(YELLOW)Note: Make sure PostgreSQL is running on port 5433$(RESET)" 28 @echo "Run 'make dev-db-up' if database is not running" 29 @docker-compose -f docker-compose.dev.yml --env-file .env.dev up -d pds 30 @echo "" 31 @echo "$(GREEN)✓ Development stack started!$(RESET)" 32 @echo "" 33 @echo "Services available at:" 34 @echo " - PDS (XRPC): http://localhost:3001" 35 @echo " - PDS Firehose (WS): ws://localhost:3001/xrpc/com.atproto.sync.subscribeRepos" 36 @echo " - AppView (API): http://localhost:8081 (when uncommented)" 37 @echo "" 38 @echo "Run 'make dev-logs' to view logs" 39 40dev-down: ## Stop the atProto development stack 41 @echo "$(YELLOW)Stopping Coves development stack...$(RESET)" 42 @docker-compose -f docker-compose.dev.yml down 43 @echo "$(GREEN)✓ Development stack stopped$(RESET)" 44 45dev-logs: ## Tail logs from all development services 46 @docker-compose -f docker-compose.dev.yml logs -f 47 48dev-status: ## Show status of all development containers 49 @echo "$(CYAN)Development Stack Status:$(RESET)" 50 @docker-compose -f docker-compose.dev.yml ps 51 @echo "" 52 @echo "$(CYAN)Database Status:$(RESET)" 53 @cd internal/db/local_dev_db_compose && docker-compose ps 54 55dev-reset: ## Nuclear option - stop everything and remove all volumes 56 @echo "$(YELLOW)⚠️ WARNING: This will delete all PDS data and volumes!$(RESET)" 57 @read -p "Are you sure? (y/N): " confirm && [ "$$confirm" = "y" ] || exit 1 58 @echo "$(YELLOW)Stopping and removing containers and volumes...$(RESET)" 59 @docker-compose -f docker-compose.dev.yml down -v 60 @echo "$(GREEN)✓ Reset complete - all data removed$(RESET)" 61 @echo "Run 'make dev-up' to start fresh" 62 63##@ Database Management 64 65dev-db-up: ## Start local PostgreSQL database (port 5433) 66 @echo "$(GREEN)Starting local PostgreSQL database...$(RESET)" 67 @cd internal/db/local_dev_db_compose && docker-compose up -d 68 @echo "$(GREEN)✓ Database started on port 5433$(RESET)" 69 @echo "Connection: postgresql://dev_user:dev_password@localhost:5433/coves_dev" 70 71dev-db-down: ## Stop local PostgreSQL database 72 @echo "$(YELLOW)Stopping local PostgreSQL database...$(RESET)" 73 @cd internal/db/local_dev_db_compose && docker-compose down 74 @echo "$(GREEN)✓ Database stopped$(RESET)" 75 76dev-db-reset: ## Reset database (delete all data and restart) 77 @echo "$(YELLOW)⚠️ WARNING: This will delete all database data!$(RESET)" 78 @read -p "Are you sure? (y/N): " confirm && [ "$$confirm" = "y" ] || exit 1 79 @echo "$(YELLOW)Resetting database...$(RESET)" 80 @cd internal/db/local_dev_db_compose && docker-compose down -v 81 @cd internal/db/local_dev_db_compose && docker-compose up -d 82 @echo "$(GREEN)✓ Database reset complete$(RESET)" 83 84##@ Testing 85 86test: ## Run all tests with test database 87 @echo "$(GREEN)Starting test database...$(RESET)" 88 @cd internal/db/test_db_compose && ./start-test-db.sh 89 @echo "$(GREEN)Running tests...$(RESET)" 90 @./run-tests.sh 91 @echo "$(GREEN)✓ Tests complete$(RESET)" 92 93test-db-reset: ## Reset test database 94 @echo "$(GREEN)Resetting test database...$(RESET)" 95 @cd internal/db/test_db_compose && ./reset-test-db.sh 96 @echo "$(GREEN)✓ Test database reset$(RESET)" 97 98##@ Build & Run 99 100build: ## Build the Coves server 101 @echo "$(GREEN)Building Coves server...$(RESET)" 102 @go build -o server ./cmd/server 103 @echo "$(GREEN)✓ Build complete: ./server$(RESET)" 104 105run: ## Run the Coves server (requires database running) 106 @echo "$(GREEN)Starting Coves server...$(RESET)" 107 @go run ./cmd/server 108 109##@ Cleanup 110 111clean: ## Clean build artifacts and temporary files 112 @echo "$(YELLOW)Cleaning build artifacts...$(RESET)" 113 @rm -f server main validate-lexicon 114 @go clean 115 @echo "$(GREEN)✓ Clean complete$(RESET)" 116 117clean-all: clean ## Clean everything including Docker volumes (DESTRUCTIVE) 118 @echo "$(YELLOW)⚠️ WARNING: This will remove ALL Docker volumes!$(RESET)" 119 @read -p "Are you sure? (y/N): " confirm && [ "$$confirm" = "y" ] || exit 1 120 @make dev-reset 121 @make dev-db-reset 122 @echo "$(GREEN)✓ All clean$(RESET)" 123 124##@ Workflows (Common Tasks) 125 126fresh-start: ## Complete fresh start (reset DB, reset stack, start everything) 127 @echo "$(CYAN)Starting fresh development environment...$(RESET)" 128 @make dev-db-reset 129 @make dev-reset || true 130 @sleep 2 131 @make dev-db-up 132 @sleep 2 133 @make dev-up 134 @echo "" 135 @echo "$(GREEN)✓ Fresh environment ready!$(RESET)" 136 @make dev-status 137 138quick-restart: ## Quick restart of development stack (keeps data) 139 @make dev-down 140 @make dev-up 141 142##@ Utilities 143 144validate-lexicon: ## Validate all Lexicon schemas 145 @echo "$(GREEN)Validating Lexicon schemas...$(RESET)" 146 @./validate-lexicon 147 @echo "$(GREEN)✓ Lexicon validation complete$(RESET)" 148 149db-shell: ## Open PostgreSQL shell for local database 150 @echo "$(CYAN)Connecting to local database...$(RESET)" 151 @PGPASSWORD=dev_password psql -h localhost -p 5433 -U dev_user -d coves_dev 152 153##@ Documentation 154 155docs: ## Open project documentation 156 @echo "$(CYAN)Project Documentation:$(RESET)" 157 @echo " - Setup Guide: docs/LOCAL_DEVELOPMENT.md" 158 @echo " - Project Structure: PROJECT_STRUCTURE.md" 159 @echo " - Build Guide: CLAUDE.md" 160 @echo " - atProto Guide: ATPROTO_GUIDE.md" 161 @echo " - PRD: PRD.md"