How mfang0126/grab-youtube works
Project type and purpose
• This is a Next.js–based full-stack web application (“Grab your YouTube”) that lets users submit YouTube URLs, select formats, enqueue download jobs, and watch real-time progress.
• Key indicators:
• A typical Next.js directory (pages, public, next.config.mjs)
• API routes under src/pages/api/* for auth, video, jobs, cron
• Services calling MongoDB (mongodb.ts) and YouTube download logic (youtube-services.ts)
• Dockerfile and env examples for deployment.
File structure
• Top-level:
• src/pages → Next.js pages and API routes
• src/components → UI components (forms, tables, progress bars)
• src/contexts & src/hooks → React context and custom hooks (SSE, toasts, video logic)
• src/services → boundary layer for external resources (MongoDB, YouTube, generic API calls)
• src/libs → business logic like ProgressTracker
• src/utils → pure helpers (file I/O, formatting, merging audio/video)
• Config, build, and deployment: Dockerfile, .dockerignore, vercel.json, next.config.mjs, TypeScript (tsconfig.json), Tailwind config, ESLint, Prettier.
README for additional insights
• Describes Docker-based deployment, environment variables (MongoDB URI, Node version, etc.).
• Mentions UI irregularities and job‐progress logic, hinting at two key flows: enqueueing jobs and streaming progress events.
Elements
• Labels: e.g., “Next.js Frontend,” “API /jobs Queue,” “MongoDB Cluster,” “YouTube Service.”
• Blue for client/UI
• Green for API routes/services
• Yellow for external dependencies (YouTube, MongoDB)
• Docker container outline for the entire system
• Cloud or external-service cloud for YouTube/OAuth