About This App
YTPLen is a simple yet powerful web app designed to calculate the total and average lengths of YouTube playlists, along with durations at various playback speeds. This app is a great utility for content creators, students, teachers, and anyone looking to explore a particular YouTube playlist in detail. It’s a hobby project I built to provide a quick and detailed analysis of YouTube playlists.
Technologies Used
- Frontend: Next.js, TypeScript, SimpleAnalytics
- Backend: Go, Docker
- Deployment & CI/CD: AWS EC2, DigitalOcean, Vercel CDN, GitHub Actions
- Monitoring: Prometheus, Loki, Grafana
Key Components
The app is composed of four main components:
- Frontend (Next.js): Built with Next.js, coded in TypeScript, and deployed on Vercel CDN with HTTPS via this domain
ytplen.com
. It’s integrated with privacy-friendly SimpleAnalytics. - Backend (Go): Written in Go and running in a Docker container on an auto-scalable AWS EC2 instance. Secure HTTPS access is provided via DuckDNS.
- Monitoring Stack: A small-scale monitoring stack deployed on DigitalOcean, which includes Prometheus, Loki, and Grafana.
- CI/CD: GitHub Actions are used for automated builds and deployments across all components (Frontend, Backend, and Monitoring Stack).
How It Works
- User Input: The user enters a YouTube playlist link or ID into the frontend. The frontend sends an HTTPS request via REST endpoint to the backend to fetch the playlist data and displays the results fetched from the YouTube API.
- Backend Processing: The backend retrieves all video IDs from YouTube’s
/list
endpoint, processes the playlist by breaking it into batches of up to 50 video IDs (the YouTube API limit), and then makes concurrent calls to the/video
endpoint of the YouTube Data v3 API to fetch video details. These details are formatted and sent to the frontend. - Metrics and Logs: The monitoring stack captures and stores metrics and logs during the process to monitor app performance and reliability. Grafana displays logs collected via Loki and metrics like API request response time and total calls, captured by Prometheus on a single dashboard.