A production-ready radio streaming proxy backend built with Go, designed for high performance, security, and scalability. It follows strict Clean Architecture principles to ensure maintainability and testability.
# Start all services (PostgreSQL + Redis + App)
./docker.sh up
# The app will be available at http://localhost:8080Infrastructure as Code with automated deployment to manage the entire stack:
# 1. Initialize Terraform
make tf-init
# 2. Preview changes
make tf-plan
# 3. Apply infrastructure (one-time setup)
make tf-apply
# 4. Configure GitHub Secrets (one-time setup)
make tf-github-secrets
# 5. Automatic Deploy!
git push origin main # GitHub Actions handles the restBenefits:
- Fully automated CI/CD with GitHub Actions
- Infrastructure as Code (IaC) with Terraform
- State tracked in GCS bucket
- Drift detection
- Automated Tests + Linting + Build + Deploy
- Zero-downtime deployments
- Multi-environment support (staging/production)
📖 Terraform Quick Start → 📖 GitHub Actions Workflows →
- Clean Architecture: Strictly layered design (Domain, Use Cases, Adapters, Infrastructure).
- Advanced Authentication: JWT with RFC 7519 claims, session management, and token revocation.
- Security Hardening:
- Timing attack prevention.
- Account lockout policies.
- Rate limiting (IP & Email based).
- Redis-based token blacklisting.
- Strict security headers (CSP, HSTS).
- Audio Proxy: Securely proxies radio streams to hide source IPs and manage bandwidth/connections.
- Ad Campaign Management: Create and schedule audio ad campaigns.
- Dynamic Insertion: Intelligent ad injection into streams.
- Impression Tracking: Accurate recording of ad plays with anti-fraud measures.
- User Profiling: Builds anonymous listener profiles for targeted advertising.
- Analytics: Comprehensive reporting on impressions, clicks, and revenue.
- Aggregator Integration: Seamlessly fetches stations from Radio Browser API.
- Search & Discovery: High-performance search with caching.
- Favorites: User-specific station collections.
- Popularity Tracking: Real-time tracking of trending stations and genres.
- SEO Optimization: Dynamic sitemaps, semantic URLs, and rich metadata for high search visibility.
- Behavioral Analytics: Tracks user listening habits, search trends, and geographic distribution.
- Admin Dashboard: Specialized endpoints for monitoring system health and business metrics.
- Language: Go 1.24+
- Database: PostgreSQL 15+
- Cache: Redis 7+
- Infrastructure: Google Cloud Run, Docker, Terraform
- CI/CD: GitHub Actions
┌─────────────────────────────────────────────────────────┐
│ External Interfaces │
│ (HTTP, CLI, Message Queues) │
└───────────────────┬─────────────────────────────────────┘
│
┌───────────────────▼─────────────────────────────────────┐
│ Interface Adapters │
│ (Handlers, Presenters, Controllers) │
└───────────────────┬─────────────────────────────────────┘
│
┌───────────────────▼─────────────────────────────────────┐
│ Application Business Rules │
│ (Use Cases / Services) │
└───────────────────┬─────────────────────────────────────┘
│
┌───────────────────▼─────────────────────────────────────┐
│ Enterprise Business Rules │
│ (Entities / Domain) │
└─────────────────────────────────────────────────────────┘
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- LoginPOST /api/v1/auth/refresh- Refresh tokenPOST /api/v1/auth/logout- Logout (blacklist token)POST /api/v1/auth/revoke- Revoke specific tokens/sessions
GET /api/v1/stations/search- Search stationsGET /api/v1/stations/popular- Get trending stationsGET /api/v1/stream/:id- Secure Audio Proxy Endpoint
GET /api/v1/ads/serve- Request an ad for insertionPOST /api/v1/ads/impression- Record ad impressionPOST /api/v1/ads/click- Record ad click
GET /api/v1/admin/security/metrics- Security overviewGET /api/v1/admin/monitoring/health- System health statusGET /api/v1/admin/maintenance/recommendations- Database optimization tips
📖 View Interactive API Docs (Swagger) →
- Go 1.24+
- PostgreSQL
- Redis
- Make
# Run locally
make run
# Run tests
make test
# Format code
make fmt
# Run linters
make lint
# Generate Swagger docs
make swagger-generate
# Database migrations
make migrate-upSee CONTRIBUTING.md for detailed guidelines.
MIT License - see LICENSE file for details.