- Don't edit generated go code like the templ.go or mock files manually. Always generate them using the make targets
- Don't invoke ANY go commands, the development workflow is orchestrated with make targets
Ytrssil is a YouTube RSS feed aggregator with video download capabilities built with Go, Gin, PostgreSQL, and Templ for server-side rendering.
Tech Stack: Go, Gin (HTTP), Templ (SSR), PostgreSQL (pgx), yt-dlp (downloads), Datastar (frontend interactivity via SSE), Bootstrap 5 (UI)
Layers:
- HTTP: Gin router with dual interfaces (HTML pages + JSON API), authentication middleware, Datastar SSE-driven templates
- Handler: Business logic layer orchestrating channels, videos, downloads, and cleanup routines
- Database: PostgreSQL with pgx connection pooling, embedded migrations run at startup via golang-migrate
- External: YouTube API client, RSS feed parser, yt-dlp downloader wrapper
Key Features: Subscribe to YouTube channels via RSS, track watched/unwatched videos with progress, async video downloads with status polling, automatic file cleanup (2 days after watched), YouTube Shorts detection
Background Jobs: Video fetcher (5min intervals), cleanup routine (1hr intervals) - both disabled in dev mode
ytrssil/
├── cmd/ # Application entry point
├── handler/ # Business logic
├── httpserver/ # HTTP routes (HTML + API)
├── pages/ # UI templates
├── lib/ # External clients (YouTube, RSS, downloader)
├── db/ # Database operations
├── migrations/ # Database schema changes
└── assets/ # Static files
All Go tooling is managed via make targets. Never run go commands directly.
Make Targets:
make lint— runsgo mod tidy,go vet, and golangci-lint (lint + fmt). Use to check code quality.make test— runsgo test -timeout=30s -race ./...make templ— generates Go code from.templfiles viatempl generate. Required before build.make gen-mocks— regenerates mock files inmocks/using moq. Run after changing interfaces indb/,feedparser/, orlib/clients/youtube/.make migrate— applies PostgreSQL migrations via CLI tool (for local dev/CI). In production, migrations are embedded in the binary and run at startup. Configurable viaDB_URIenv var (default:postgres://ytrssil:ytrssil@localhost:5432/ytrssil?sslmode=disable)
Tool binaries are installed into bin/ locally (golangci-lint, moq, migrate) and auto-installed by their respective targets.