|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Podsync is a Go-based service that converts YouTube, Vimeo, and SoundCloud channels into podcast feeds. It downloads video/audio content and generates RSS feeds that can be consumed by podcast clients. |
| 8 | + |
| 9 | +## Key Architecture Components |
| 10 | + |
| 11 | +### Main Application (`cmd/podsync/`) |
| 12 | +- **main.go**: Entry point with CLI argument parsing, signal handling, and service orchestration |
| 13 | +- **config.go**: TOML configuration loading and validation with defaults |
| 14 | + |
| 15 | +### Core Packages (`pkg/`) |
| 16 | +- **builder/**: Media downloaders for different platforms (YouTube, Vimeo, SoundCloud) |
| 17 | +- **feed/**: RSS/podcast feed generation and management, OPML export |
| 18 | +- **db/**: BadgerDB-based storage for metadata and state |
| 19 | +- **fs/**: Storage abstraction supporting local filesystem and S3-compatible storage |
| 20 | +- **model/**: Core data structures and domain models |
| 21 | +- **ytdl/**: YouTube-dl wrapper for media downloading |
| 22 | + |
| 23 | +### Services (`services/`) |
| 24 | +- **update/**: Feed update orchestration and scheduling |
| 25 | +- **web/**: HTTP server for serving podcast feeds and media files |
| 26 | + |
| 27 | +### Key Dependencies |
| 28 | +- youtube-dl/yt-dlp for media downloading |
| 29 | +- BadgerDB for local storage |
| 30 | +- go-toml for configuration |
| 31 | +- robfig/cron for scheduling |
| 32 | +- AWS SDK for S3 storage |
| 33 | + |
| 34 | +## Common Development Commands |
| 35 | + |
| 36 | +### Building |
| 37 | +```bash |
| 38 | +make build # Build binary to bin/podsync |
| 39 | +make # Build and run tests |
| 40 | +``` |
| 41 | + |
| 42 | +### Testing |
| 43 | +```bash |
| 44 | +make test # Run all unit tests |
| 45 | +go test -v ./... # Run tests with verbose output |
| 46 | +go test ./pkg/... # Test specific packages |
| 47 | +``` |
| 48 | + |
| 49 | +### Running |
| 50 | +```bash |
| 51 | +./bin/podsync --config config.toml # Run with config file |
| 52 | +./bin/podsync --debug # Run with debug logging |
| 53 | +./bin/podsync --headless # Run once and exit (no web server) |
| 54 | +``` |
| 55 | + |
| 56 | +### Docker |
| 57 | +```bash |
| 58 | +make docker # Build local Docker image |
| 59 | +docker run -it --rm localhost/podsync:latest |
| 60 | +``` |
| 61 | + |
| 62 | +### Development Debugging |
| 63 | +Use VS Code with the Go extension. The repository includes `.vscode/launch.json` with a "Debug Podsync" configuration that runs with `config.toml`. |
| 64 | + |
| 65 | +## Configuration |
| 66 | + |
| 67 | +The application uses TOML configuration files. See `config.toml.example` for all available options. Key sections: |
| 68 | +- `[server]`: Web server settings (port, hostname, TLS) |
| 69 | +- `[storage]`: Local or S3 storage configuration |
| 70 | +- `[tokens]`: API keys for YouTube/Vimeo |
| 71 | +- `[feeds]`: Feed definitions with URLs and settings |
| 72 | +- `[downloader]`: youtube-dl configuration |
| 73 | + |
| 74 | +## Development Guidelines |
| 75 | + |
| 76 | +### Code Quality |
| 77 | +- Write clean, idiomatic Go code following Go conventions and best practices |
| 78 | +- Use structured logging with logrus for consistent log formatting |
| 79 | +- Ensure proper error handling and meaningful error messages |
| 80 | +- Follow the existing code style and patterns in the repository |
| 81 | + |
| 82 | +### Testing and Quality Assurance |
| 83 | +- Always run `make test` before committing changes or opening pull requests |
| 84 | +- Ensure all tests pass and maintain or improve test coverage |
| 85 | +- Review code carefully for spelling errors, typos, and grammatical mistakes |
| 86 | +- Test changes locally with different configurations when applicable |
| 87 | + |
| 88 | +### Git Workflow |
| 89 | +- Write short, expressive commit messages that clearly describe the change |
| 90 | +- Do not include automated signatures or generation notices in commit messages |
| 91 | +- Keep commits focused and atomic - one logical change per commit |
| 92 | +- Ensure the build passes before pushing commits |
| 93 | + |
| 94 | +## Key Conventions |
| 95 | + |
| 96 | +- Configuration validation happens at startup |
| 97 | +- Graceful shutdown with context cancellation |
| 98 | +- Storage abstraction allows switching between local/S3 |
| 99 | +- API key rotation support for rate limiting |
| 100 | +- Cron-based scheduling for feed updates |
| 101 | +- Episode filtering and cleanup capabilities |
0 commit comments